Skip to content

Instantly share code, notes, and snippets.

@catlee
Created May 27, 2020 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save catlee/3fa9e365a5e8da4e37dd5c7bd5fb6bb9 to your computer and use it in GitHub Desktop.
Save catlee/3fa9e365a5e8da4e37dd5c7bd5fb6bb9 to your computer and use it in GitHub Desktop.
diff --git a/taskcluster/ci/toolchain/geckodriver.yml b/taskcluster/ci/toolchain/geckodriver.yml
--- a/taskcluster/ci/toolchain/geckodriver.yml
+++ b/taskcluster/ci/toolchain/geckodriver.yml
@@ -7,16 +7,17 @@ job-defaults:
worker-type: b-linux
worker:
max-run-time: 1800
run-on-projects: ['trunk']
attributes:
build_type: opt
geckodriver: true
shippable: true
+ rebuild-on-release: true
run:
script: build-geckodriver.sh
toolchain-artifact: public/build/geckodriver.tar.gz
sparse-profile: null
resources:
- 'testing/geckodriver'
- 'testing/mozbase/rust'
- 'testing/webdriver'
diff --git a/taskcluster/docs/attributes.rst b/taskcluster/docs/attributes.rst
--- a/taskcluster/docs/attributes.rst
+++ b/taskcluster/docs/attributes.rst
@@ -376,8 +376,14 @@ If set to true, this task will not be ch
MOZ_AUTOMATION_PACKAGE_TESTS is set correctly based on whether or not the task
has dependent tests. This should only be used in very unique situations, such
as Windows AArch64 builds that copy test packages between build tasks.
geckodriver
===========
If non-empty, declares that the (toolchain) task is a `geckodriver`
task that produces a binary that should be signed.
+
+rebuild-on-release
+==================
+If true, the digest for this task will also depend on if the branch is a
+release branch. This will cause tasks like toolchains to be rebuilt as they
+move from e.g. autoland to mozilla-central.
diff --git a/taskcluster/taskgraph/optimize/strategies.py b/taskcluster/taskgraph/optimize/strategies.py
--- a/taskcluster/taskgraph/optimize/strategies.py
+++ b/taskcluster/taskgraph/optimize/strategies.py
@@ -33,21 +33,23 @@ class IndexSearch(OptimizationStrategy):
def should_replace_task(self, task, params, index_paths):
"Look for a task with one of the given index paths"
for index_path in index_paths:
try:
task_id = find_task_id(
index_path,
use_proxy=bool(os.environ.get('TASK_ID')))
+ logger.debug("found task %s for %s: %s", task_id, task.label, index_paths)
return task_id
except KeyError:
# 404 will end up here and go on to the next index path
pass
+ logger.debug("didn't find a cache hit for %s: %s", task.label, index_paths)
return False
@register_strategy("skip-unless-changed")
class SkipUnlessChanged(OptimizationStrategy):
def should_remove_task(self, task, params, file_patterns):
# pushlog_id == -1 - this is the case when run from a cron.yml job
if params.get('pushlog_id') == -1:
diff --git a/taskcluster/taskgraph/transforms/job/toolchain.py b/taskcluster/taskgraph/transforms/job/toolchain.py
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -16,16 +16,17 @@ from voluptuous import Optional, Require
from taskgraph.transforms.job import (
configure_taskdesc_for_run,
run_job_using,
)
from taskgraph.transforms.job.common import (
docker_worker_add_artifacts,
)
from taskgraph.util.hash import hash_paths
+from taskgraph.util.attributes import RELEASE_PROJECTS
from taskgraph import GECKO
import taskgraph
CACHE_TYPE = 'toolchains.v3'
toolchain_run_schema = Schema({
Required('using'): 'toolchain-script',
@@ -95,16 +96,20 @@ def get_digest_data(config, run, taskdes
image = taskdesc['worker'].get('docker-image', {}).get('in-tree')
if image:
data.append(image)
# Likewise script arguments should influence the index.
args = run.get('arguments')
if args:
data.extend(args)
+
+ if taskdesc['attributes'].get('rebuild-on-release'):
+ # Add whether this is a release branch or not
+ data.append(str(config.params['project'] in RELEASE_PROJECTS))
return data
toolchain_defaults = {
'tooltool-downloads': False,
'sparse-profile': 'toolchain-build',
}
diff --git a/taskcluster/taskgraph/util/taskcluster.py b/taskcluster/taskgraph/util/taskcluster.py
--- a/taskcluster/taskgraph/util/taskcluster.py
+++ b/taskcluster/taskgraph/util/taskcluster.py
@@ -172,16 +172,17 @@ def get_artifact_path(task, path):
def get_index_url(index_path, use_proxy=False, multiple=False):
index_tmpl = liburls.api(get_root_url(use_proxy), 'index', 'v1', 'task{}/{}')
return index_tmpl.format('s' if multiple else '', index_path)
def find_task_id(index_path, use_proxy=False):
+ logger.debug("looking for %s in the index", index_path)
try:
response = _do_request(get_index_url(index_path, use_proxy))
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
raise KeyError("index path {} not found".format(index_path))
raise
return response.json()['taskId']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment