Bug 1760675 - Upload gecko run-task and fetch content scripts as decision artifacts - r=releng-reviewers,aki

Differential Revision: https://phabricator.services.mozilla.com/D142517
This commit is contained in:
Gabriel Bustamante 2022-04-01 15:19:41 +00:00
Родитель b1bff09171
Коммит 6bd24d3ead
3 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -7,6 +7,7 @@ import os
import json
import logging
import time
import shutil
import sys
from collections import defaultdict
@ -251,6 +252,15 @@ def taskgraph_decision(options, parameters=None):
if len(push_schedules) > 0:
write_artifact("bugbug-push-schedules.json", push_schedules.popitem()[1])
# cache run-task & misc/fetch-content
scripts_root_dir = os.path.join(
"/builds/worker/checkouts/gecko/taskcluster/scripts"
)
run_task_file_path = os.path.join(scripts_root_dir, "run-task")
fetch_content_file_path = os.path.join(scripts_root_dir, "misc/fetch-content")
shutil.copy2(run_task_file_path, ARTIFACTS_DIR)
shutil.copy2(fetch_content_file_path, ARTIFACTS_DIR)
# actually create the graph
create_tasks(
tgg.graph_config,

Просмотреть файл

@ -60,6 +60,8 @@ def transform(monkeypatch, config):
This gives test functions an easy way to generate the inputs required for
many of the `run_using` subsystems.
"""
# Needed by 'generic_worker_run_task'
monkeypatch.setenv("TASK_ID", "fakeid")
def inner(task_input):
task = deepcopy(TASK_DEFAULTS)

Просмотреть файл

@ -6,6 +6,8 @@ Support for running jobs that are invoked via the `run-task` script.
"""
import os
from mozpack import path
from gecko_taskgraph.transforms.task import taskref_or_string
@ -91,9 +93,11 @@ worker_defaults = {
def script_url(config, script):
return config.params.file_url(
f"taskcluster/scripts/{script}",
)
if "TASK_ID" not in os.environ:
raise Exception("TASK_ID must be defined to use run-task on generic-worker")
task_id = os.environ["TASK_ID"]
tc_url = "http://firefox-ci-tc.services.mozilla.com"
return f"{tc_url}/api/queue/v1/task/{task_id}/artifacts/public/{script}"
@run_job_using(
@ -198,7 +202,7 @@ def generic_worker_run_task(config, job, taskdesc):
worker["mounts"].append(
{
"content": {
"url": script_url(config, "misc/fetch-content"),
"url": script_url(config, "fetch-content"),
},
"file": "./fetch-content",
}