From 4b2309140a0bae59da2936073e853f84d78f92f6 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 15 Feb 2019 10:32:27 +0900 Subject: [PATCH] Bug 1528123 - Allow artifact builds to pull from a specific taskid. r=chmanchester Currently, artifact builds pull from some task they determine from the job type, and finding a pushhead. Sometimes that latter fails, most notably on automation. But automation can already know the right task to use without guesswork. This change allows artifact builds to pull from a specific taskid given through an environment variable, and make tasks from the artifact-build kind (not the --artifact builds from try) use that. Remove the workaround from bug 1382982 because it's now dead code. Differential Revision: https://phabricator.services.mozilla.com/D19881 --- python/mozbuild/mozbuild/artifacts.py | 27 +++++++++++++++++++------- taskcluster/ci/artifact-build/kind.yml | 3 +++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py index 5eee57f17df4..d51c3899676a 100644 --- a/python/mozbuild/mozbuild/artifacts.py +++ b/python/mozbuild/mozbuild/artifacts.py @@ -1051,13 +1051,6 @@ class Artifacts(object): found_pushids = {} search_trees = list(CANDIDATE_TREES) - # We aren't generally interested in pushes from autoland because - # people aren't generally working off of autoland locally, but we - # sometimes find errant public pushheads on autoland in automation, - # so we check autoland in automation as a workaround. - if os.environ.get('MOZ_AUTOMATION'): - search_trees += ['integration/autoland'] - for tree in search_trees: self.log(logging.INFO, 'artifact', {'tree': tree, @@ -1318,6 +1311,23 @@ class Artifacts(object): pushheads = [(list(CANDIDATE_TREES) + ['try'], revision)] return self._install_from_hg_pushheads(pushheads, distdir) + def install_from_task(self, taskId, distdir): + artifacts = list_artifacts(taskId) + + urls = [] + for artifact_name in self._artifact_job.find_candidate_artifacts(artifacts): + # We can easily extract the task ID from the URL. We can't easily + # extract the build ID; we use the .ini files embedded in the + # downloaded artifact for this. + url = get_artifact_url(taskId, artifact_name) + urls.append(url) + if not urls: + raise ValueError('Task {taskId} existed, but no artifacts found!'.format(taskId=taskId)) + for url in urls: + if self.install_from_url(url, distdir): + return 1 + return 0 + def install_from(self, source, distdir): """Install artifacts from a ``source`` into the given ``distdir``. """ @@ -1332,6 +1342,9 @@ class Artifacts(object): if source: return self.install_from_revset(source, distdir) + if 'MOZ_ARTIFACT_TASK' in os.environ: + return self.install_from_task(os.environ['MOZ_ARTIFACT_TASK'], distdir) + return self.install_from_recent(distdir) diff --git a/taskcluster/ci/artifact-build/kind.yml b/taskcluster/ci/artifact-build/kind.yml index 8f300983e338..4073a54b90c4 100644 --- a/taskcluster/ci/artifact-build/kind.yml +++ b/taskcluster/ci/artifact-build/kind.yml @@ -31,6 +31,7 @@ jobs: max-run-time: 3600 env: PERFHERDER_EXTRA_OPTIONS: artifact + MOZ_ARTIFACT_TASK: {task-reference: ''} run: using: mozharness actions: [get-secrets, build] @@ -42,5 +43,7 @@ jobs: tooltool-downloads: public need-xvfb: true keep-artifacts: false + dependencies: + linux64-opt: build-linux64/opt toolchains: - linux64-node