Open vikramsubramanian opened 5 months ago
Define a YAML anchor for common settings in .taskcluster.yml
:
x-common-settings: &common_settings
provisionerId: proj-bugbug
workerType: batch
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
metadata:
owner: mcastelluccio@mozilla.com
source: ${repository}/raw/${head_rev}/.taskcluster.yml
Update tasks to use the anchor:
- taskId: { $eval: as_slugid("lint_task") }
<<: *common_settings
payload:
<<: *common_settings.payload
image: python:3.10
command:
- "/bin/bash"
- "-lcx"
- "git clone --quiet ${repository} &&
cd bugbug &&
git -c advice.detachedHead=false checkout ${head_rev} &&
pip install --disable-pip-version-check --no-cache-dir --progress-bar off -r test-requirements.txt &&
pre-commit run -a --show-diff-on-failure"
metadata:
<<: *common_settings.metadata
name: bugbug lint
description: bugbug lint
Repeat the above step for each task, customizing the command
, name
, and description
fields as necessary, and adding any task-specific settings that are not covered by the common anchor.
Ensure that any unique settings for a task are not overwritten by the anchor. If necessary, use YAML's merge key feature (<<: *anchor_name
) to combine the common settings with task-specific settings.
Remove any redundant declarations of settings that are now covered by the anchor.
Test the updated .taskcluster.yml
to ensure that all tasks are still defined correctly and that the refactoring has not introduced any errors.
This will make the file more readable. )