Closed Bug 1279020 Opened 4 years ago Closed 4 years ago

Symlink mach to /home/worker/bin from the interactive wizard in desktop-test image

Categories

(Taskcluster Graveyard :: Docker Images, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ahal, Assigned: ahal)

References

Details

Attachments

(2 files)

After the interactive wizard has called run-mozharness, it should symlink the mach binary to /home/worker/bin so users don't need to go searching for it.
I see this was filed in docker-images. Should we find a way to specify this kind of thing in-tree instead?
Hm, yeah.. I guess it would be better if the wizard lived in-tree and was downloaded at runtime. I'll file a new bug.
Depends on: 1279040
The mach binary needs to find a srcdir (or test zip) to operator on. As a last resort,
it checks the directory containing the binary itself. If the binary has been symlinked
to say, $HOME/bin, it won't follow the symlink to the proper location, and the check
will fail.

Fixing this means developers can run `mach` from outside of the srcdir, as the symlink
will be followed to the actual srcdir. The motivation for this is actually to improve
the UX of debugging failures on interactive workers. With this fix, we can provide
developers with a mach environment directly from $HOME without them needing to go
find it.

Review commit: https://reviewboard.mozilla.org/r/58882/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/58882/
Did you mean to r? someone here?  I'd just review it but I'm probably not the best person..
Nope.. I like to use mozreview to store in-progress work sometimes. It doubles as a way to sync work between computers. Unfortunately the bugmail it generates can confuse people, sorry about that. I'll flag gps for this eventually when the rest of the commits are ready.
Comment on attachment 8761818 [details]
Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58882/diff/1-2/
Attachment #8761818 - Attachment description: Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir → Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir,
Attachment #8761819 - Attachment description: Symlink mach binary → Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers,
Attachment #8761818 - Flags: review?(gps)
Attachment #8761819 - Flags: review?(armenzg)
Comment on attachment 8761819 [details]
Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58884/diff/1-2/
Comment on attachment 8761819 [details]
Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers,

https://reviewboard.mozilla.org/r/58884/#review57894

Feel free to land once you add some comments that would answer the questions I raised.
No need to request for another review but I'm happy to take it if you want me to.

::: taskcluster/scripts/tester/run-wizard:23
(Diff revision 2)
>  
>  def resume():
>      call(['run-mozharness'])
>  
>  
>  def setup():

Could you please an overall comment as to what this code does?

::: taskcluster/scripts/tester/run-wizard:26
(Diff revision 2)
>  
>  
>  def setup():
> -    call(['run-mozharness', '--no-run-tests'])
> -    print("Mozharness has finished downloading the build and "
> -          "tests to {}.".format(os.path.join(os.getcwd(), 'build')))
> +    status = call(['run-mozharness', '--no-run-tests'])
> +
> +    if status:

Could you please add a comment as to what this means?

::: taskcluster/scripts/tester/run-wizard:33
(Diff revision 2)
> +
> +    build_dir = os.path.expanduser(os.path.join('~', 'workspace', 'build'))
> +    mach_src = os.path.join(build_dir, 'tests', 'mach')
> +    mach_dest = os.path.expanduser(os.path.join('~', 'bin', 'mach'))
> +
> +    if os.path.exists(mach_dest):

In which cases will we already have a mach binary?
Attachment #8761819 - Flags: review?(armenzg) → review+
Comment on attachment 8761818 [details]
Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir,

https://reviewboard.mozilla.org/r/58882/#review58282

Clever. Can you please add an in-line comment explaining why we do this.

FWIW, you can copy `mach` to e.g. ~/bin and it still works (but relies on CWD). Although symlinking is preferred as we obviously change the "mach" script from time to time.
Attachment #8761818 - Flags: review?(gps)
https://reviewboard.mozilla.org/r/58882/#review58282

Thanks, I'll add a comment.

Yeah, I don't want to rely on CWD because on a test worker it's not obvious to the developer where they are supposed to run 'mach' from (/home/worker/workspace/build/tests). Also note that directory is not a srcdir.
https://reviewboard.mozilla.org/r/58884/#review57894

> In which cases will we already have a mach binary?

Possible if the developer runs 'run-wizard' and chooses '2' twice, or if they create it manually. I wouldn't expect this to happen, but better to be safe than sorry. If you try to symlink a file to a destination that already exists, it will raise an exception.
Comment on attachment 8761818 [details]
Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58882/diff/2-3/
Attachment #8761818 - Flags: review?(gps)
Comment on attachment 8761819 [details]
Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58884/diff/2-3/
Comment on attachment 8761818 [details]
Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir,

https://reviewboard.mozilla.org/r/58882/#review59226
Attachment #8761818 - Flags: review?(gps) → review+
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/80eb5947da07
[mach] Follow symlinked mach binary when searching for a srcdir, r=gps
https://hg.mozilla.org/integration/autoland/rev/eb129a2466a9
Symlink mach binary to $HOME/bin after mozharness setup on interactive workers, r=armenzg
https://hg.mozilla.org/mozilla-central/rev/80eb5947da07
https://hg.mozilla.org/mozilla-central/rev/eb129a2466a9
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Product: Taskcluster → Taskcluster Graveyard
You need to log in before you can comment on or make changes to this bug.