Bug 1289249 - Add argument to perform build/tools checkout; r?dustin
Build tasks currently require a checkout of the build/tools repository.
I wish this weren't true and that all files references from this repo
were part of mozilla-central or tooltool, but that's how things are.
In preparation for running build tasks with run-task, teach run-task
to perform a checkout of the build/tools repo. Ideally we'd support
configuring the URL to this repository. But I'm not implementing that
since I'd prefer we stop relying on the build/tools repo.
MozReview-Commit-ID: B2Y1NwS3niO
--- a/testing/docker/recipes/run-task
+++ b/testing/docker/recipes/run-task
@@ -163,16 +163,18 @@ def main(args):
# dropped. This is often necessary for caches/volumes, since they default
# to root:root ownership.
parser.add_argument('--chown', action='append',
help='Directory to chown to --user:--group')
parser.add_argument('--chown-recursive', action='append',
help='Directory to recursively chown to --user:--group')
parser.add_argument('--vcs-checkout',
help='Directory where Gecko checkout should be created')
+ parser.add_argument('--tools-checkout',
+ help='Directory where build/tools checkout should be created')
args = parser.parse_args(our_args)
try:
user = pwd.getpwnam(args.user)
except KeyError:
print('could not find user %s; specify --user to a known user' %
args.user)
@@ -234,16 +236,17 @@ def main(args):
if e.errno != errno.EEXIST:
raise
# And that it is owned by the appropriate user/group.
os.chown('/home/worker/hg-shared', uid, gid)
os.chown(os.path.dirname(checkout), uid, gid)
prepare_checkout_dir(args.vcs_checkout)
+ prepare_checkout_dir(args.tools_checkout)
# Drop permissions to requested user.
# This code is modeled after what `sudo` was observed to do in a Docker
# container. We do not bother calling setrlimit() because containers have
# their own limits.
print_line(b'setup', b'running as %s:%s\n' % (args.user, args.group))
os.setgroups(gids)
os.umask(022)
@@ -269,16 +272,23 @@ def main(args):
revision=os.environ.get('GECKO_HEAD_REV'),
branch=os.environ.get('GECKO_HEAD_REF'))
elif not os.environ.get('GECKO_HEAD_REV') and \
os.environ.get('GECKO_HEAD_REF'):
print('task should be defined in terms of non-symbolic revision')
return 1
+ if args.tools_checkout:
+ vcs_checkout(b'https://hg.mozilla.org/build/tools',
+ args.tools_checkout,
+ # Always check out the latest commit on default branch.
+ # This is non-deterministic!
+ branch=b'default')
+
return run_and_prefix_output(b'task', task_args)
if __name__ == '__main__':
# Unbuffer stdio.
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)