update_shared_repos exits non zero if find returns no repos

RESOLVED FIXED

Status

Release Engineering
General Automation
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: rail, Assigned: pmoore)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

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
Created attachment 8493146 [details] [diff] [review]
runner-puppet.diff

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...
Created attachment 8494160 [details] [diff] [review]
update_shared_repos.diff

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-
Created attachment 8494513 [details] [diff] [review]
bug1070037_puppet_v1.patch

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.
Created attachment 8494622 [details] [diff] [review]
bug1070037_puppet_v2.patch

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+
Comment on attachment 8494622 [details] [diff] [review]
bug1070037_puppet_v2.patch

http://hg.mozilla.org/build/puppet/rev/755b6d75d24c
http://hg.mozilla.org/build/puppet/rev/9e3fb9c73bde
Attachment #8494622 - Flags: checked-in+
Pete, thanks for fixing this!
Assignee: rail → pmoore
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.