Closed Bug 1070037 Opened 10 years ago Closed 10 years ago

update_shared_repos exits non zero if find returns no repos

Categories

(Release Engineering :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rail, Assigned: pmoore)

Details

Attachments

(1 file, 3 obsolete files)

Updating hg repos in /builds/hg-shared
hg pull -R 
hg pull: option -R requires argument
hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]

pull changes from the specified source

options:

 -u --update                update to new branch head if changesets were
                            pulled
 -f --force                 run even when remote repository is unrelated
 -r --rev REV [+]           a remote changeset intended to be added
 -B --bookmark BOOKMARK [+] bookmark to pull
 -b --branch BRANCH [+]     a specific branch you would like to pull
 -e --ssh CMD               specify ssh command to use
    --remotecmd CMD         specify hg command to run on the remote side
    --insecure              do not verify server certificate (ignoring
                            web.cacerts config)
    --rebase                rebase working directory to branch head
 -t --tool VALUE            specify merge tool for rebase
    --mq                    operate on patch repository

[+] marked option can be specified multiple times

use "hg help pull" to show the full help text
xargs: hg: exited with status 255; aborting
2014-09-19 10:03:32,514 - WARNING - maximum attempts reached
Attached patch runner-puppet.diff (obsolete) — Splinter Review
xargs all the things!
Attachment #8493146 - Flags: review?(dustin)
Attachment #8493146 - Flags: review?(dustin) → review?(pmoore)
Comment on attachment 8493146 [details] [diff] [review]
runner-puppet.diff

Review of attachment 8493146 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me! Since all buildbot masters run on linux, it shouldn't be a problem that --no-run-if-empty is not mac-compatible. However, if we start using runner on non-linux machines, we may need to tweak it - but I don't think there are any plans to use it on anything other than buildbot masters at the moment, which are all linux, afaik.

If I'm wrong about this, let me know!

Thanks Rail!
Pete
Attachment #8493146 - Flags: review?(pmoore) → review+
Ruh, roh. Thanks for the catch... Bad Mac, bad!
Probably it's not a good idea to land a not portable change. Need to rethink...
Attached patch update_shared_repos.diff (obsolete) — Splinter Review
how about this?
Attachment #8493146 - Attachment is obsolete: true
Attachment #8494160 - Flags: review?(pmoore)
Comment on attachment 8494160 [details] [diff] [review]
update_shared_repos.diff

Review of attachment 8494160 [details] [diff] [review]:
-----------------------------------------------------------------

::: modules/runner/templates/tasks/update_shared_repos.erb
@@ +28,5 @@
>      fi
> +    if [ -z $hgrc_found ]; then
> +        echo "No valid mercurial repos found. Exiting early"
> +        exit 0
> +    fi

I think this might not work, because the if condition is inside the loop, and the unsetting of hgrc_found is also inside the loop, and both would need to be outside.

However, I think there may be another way, I'll attach a counter patch with my idea.
Attachment #8494160 - Flags: review?(pmoore) → review-
Attached patch bug1070037_puppet_v1.patch (obsolete) — Splinter Review
I think this should be mac and linux compatible. Haven't considered windows! Maybe it is, not sure - would need to test.
Attachment #8494160 - Attachment is obsolete: true
Attachment #8494513 - Flags: review?(rail)
Comment on attachment 8494513 [details] [diff] [review]
bug1070037_puppet_v1.patch

A nit. Can you use "rm -f" to make sure there no user interaction.
Attachment #8494513 - Flags: review?(rail) → review+
So out of curiosity, I tested on Mac, and it seems sed actually adds a line ending on mac, even though the input has no line ending. On linux this works fine, but also this does not work on Mac as desired, due to the difference in the sed implementation! For example:

Mac
===
pmoore@Elisandra:~ $ echo -n 'hi' | sed 's/hi/hello/'
hello
pmoore@Elisandra:~ $ 

Linux
=====
[cltbld@b-linux64-hp-0012.try.releng.scl3.mozilla.com ~]$ echo -n 'hi' | sed 's/hi/hello/'
hello[cltbld@b-linux64-hp-0012.try.releng.scl3.mozilla.com ~]$ 

So I'll tweak it again just so slightly to get it working on both.
This time I tested on both mac and linux when there are both results and not results. :)
Attachment #8494513 - Attachment is obsolete: true
Attachment #8494622 - Flags: review?(rail)
Attachment #8494622 - Flags: review?(rail) → review+
Pete, thanks for fixing this!
Assignee: rail → pmoore
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Component: General Automation → General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: