Migration Guide#
This page can help when migrating Taskgraph across major versions.
12.x -> 13.x#
Remove all
run.cache-dotcachekeys. If it was set totrue, replace it with:run: use-caches: [checkout, <caches>]
Where caches can be any of
cargo,pip,uvornpm. If the task was setting up.cachefor another tool, a mount will need to be created for it manually. Ifuse-cacheswas previously set tofalse, omitcheckoutin the example above. Ifuse-cacheswas previously set totrue, replacetruewith the value above (includingcheckout).Invert any usage of the dict keys and values returned by get_ancestors:
For example, if you were using:
for label, taskid in get_ancestors(...): ...
Change it to:
for taskid, label in get_ancestors(...): ...
Note that due to this change get_ancestors may return multiple tasks with the same label now, which your code may need to deal with.
11.x -> 12.x#
Add
target_tasks_methodto the front of thefiltersparameter wherever you are also using a custom filter.For example, if you are passing in:
filters: ["my_custom_filter"]
Change it to:
filters: ["target_tasks_method", "my_custom_filter"]
No action is necessary if the
filtersparameter was empty.Change all references from
build-docker-imagetodocker-image.
10.x -> 11.x#
A hardcoded path to a Python installation was removed for MacOS generic-workers. If Mac tasks start failing after upgrade and you are able to change the worker environment, ensure the
python3binary is available on the$PATH. If you cannot change the worker environment, add the following to the definitions of the failing tasks:run: run-task-command: ["/tools/python36/bin/python3", "run-task"]
When defining custom actions with
taskgraph.actions.registry.register_callback_action, make the following changes:If you are passing
generic=Trueto the function, remove this argument.If the argument isn’t present, or you are passing
generic=False, then add a new argument calledpermission=<cb_name>, where<cb_name>is the value of whatever you are passing to thecb_nameargument.
9.x -> 10.x#
Directories listed as VOLUME in Dockerfiles are created before any other instructions, so those instructions may need to be updated (e.g. RUN mkdir)
fetch-content no longer relies on file extension to detect archives, so you. may need to explicitly disable extract for some fetches.
8.x -> 9.x#
Replace references to
taskgraph.util.memoize.memoizewithfunctools.cache. E.g, change@memoizeto@cache. If using Python 3.8, use@functools.lru_cache(maxsize=None)instead.Pay close attention to tasks that use
task-defaultsto merge configuration containingby-<attribute>keys. Thetaskgraph.util.templates.merge()function will no longer attempt to merge keys containing these attributes, which may result in changes to your graph. You can use the diff feature to help detect possible changes.
7.x -> 8.x#
Replace all references to
taskgraph.files_changed. Instead, use one of:The
files_changedparameterThe
get_files_changedmethod on an instance oftaskgraph.util.vcs.RepositoryMercurial repositories relying on hgmo’s
json-automationrelevanceendpoint will need to in-line this logic into their own custom Taskgraph logic
In tasks using the
from_depstransforms, removefrom-deps.set-nameif it is set totrueUpdate any references to pull request cached task indexes from
{cache_prefix}.cache.head.{head_ref}...to{cache_prefix}.cache.pr...(i.e, addprand remove thehead.{head_ref})
6.x -> 7.x#
Upgrade to Python 3.8 or higher
Ensure
root_dirnow points totaskclusterinstead oftaskcluster/ci. Typically this value is not passed in explicitly by consumers, but updates are likely required if you have custom code that uses any of the following objects:taskgraph.config.GraphConfigtaskgraph.config.load_graph_configtaskgraph.generator.TaskGraphGeneratortaskgraph.generator.load_tasks_for_kindsThe
-r/--rootflag on thetaskgraphbinary
Rename the
run_job_usingdecorator torun_task_usingMove
config.ymlfromtaskcluster/citotaskclusterRename the
taskcluster/cidirectory totaskcluster/kindsReplace references to
taskgraph.transforms.jobwithtaskgraph.transforms.runReplace references to
taskgraph.transforms.release_notificationswithtaskgraph.transforms.notifyReplace references to
taskgraph.target_tasks._target_taskwithtaskgraph.target_tasks.register_target_taskStop using or inline
taskgraph.util.decision.make_decision_taskStop using the
decision-mobiledocker imageEnsure MacOS workers that need Mercurial have
hgon theirPATH
5.x -> 6.x#
Replace all uses of
command-contextwith the more generalizedtask-context
4.x -> 5.x#
Upgrade to Python 3.7 or higher
3.x -> 4.x#
Remove all uses of the
disable-seccompkey in theworkersection of task definitions.
2.x -> 3.x#
Use a decision image at least as recent as this one.
Rename
config.kind_dependencies_taskstoconfig.kind_dependencies_tasks.values().Rename
vcs.head_reftovcs.head_rev.vcs.head_refstill exists but points to the actual reference instead of the revision.Rename
vcs.base_reftovcs.base_rev. Same rationale as above.
1.x -> 2.x#
For all kinds using the
transform loader, rename the following keys in both thekind.ymlfile and any files referenced injobs-from:jobs -> tasks jobs-from -> tasks-from job-defaults -> task-defaults
Rename
taskgraph.util.schema.WHITELISTED_SCHEMA_IDENTIFIERStotaskgraph.util.schema.EXCEPTED_SCHEMA_IDENTIFIERS.Rename any instances of
taskgraph.optimize.Eithertotaskgraph.optimize.Any.Add a
deadlineparameter as the third argument to any custom optimization strategies’should_replace_task()function. For migration purposes it doesn’t need to be used.Replace
taskgraph.util.taskcluster.status_taskwithtaskgraph.util.taskcluster.state_task.