From 49d4d780ee2aade8386e7ce309838007e11baef8 Mon Sep 17 00:00:00 2001 From: Ben Hearsum Date: Thu, 26 Jul 2018 08:56:08 -0400 Subject: [PATCH] bug 1477021: create pipfile-update task for funsize-update-generator. r=sfraser --HG-- extra : rebase_source : 8a7bc1b481b6d477dc6b1ea6a0bd392e73f16f74 --- taskcluster/ci/config.yml | 1 + taskcluster/ci/pipfile-update/kind.yml | 44 +++++++++++++++++++ taskcluster/docs/kinds.rst | 5 +++ taskcluster/taskgraph/target_tasks.py | 10 +++++ .../taskgraph/transforms/pipfile_update.py | 27 ++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 taskcluster/ci/pipfile-update/kind.yml create mode 100644 taskcluster/taskgraph/transforms/pipfile_update.py diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index 04934be19a35..12208735c657 100755 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -70,6 +70,7 @@ treeherder: 'langpack': 'Langpack sigatures and uploads' 'TPS': 'Sync tests' 'UV': 'Update verify' + 'pipfu': 'pipfile update' index: products: diff --git a/taskcluster/ci/pipfile-update/kind.yml b/taskcluster/ci/pipfile-update/kind.yml new file mode 100644 index 000000000000..520016c681db --- /dev/null +++ b/taskcluster/ci/pipfile-update/kind.yml @@ -0,0 +1,44 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +loader: taskgraph.loader.transform:loader + +transforms: + - taskgraph.transforms.pipfile_update:transforms + - taskgraph.transforms.task:transforms + + +job-defaults: + name: pipfile_update + description: Update Pipfile.lock + run-on-projects: [] + treeherder: + kind: build + platform: linux64/opt + tier: 1 + worker-type: aws-provisioner-v1/gecko-{level}-b-linux + worker: + implementation: docker-worker + os: linux + docker-image: {in-tree: pipfile-updates} + max-run-time: 2400 + command: + - /runme.sh + artifacts: + - name: 'public/build/Pipfile.lock.diff' + path: '/home/worker/artifacts/Pipfile.lock.diff' + type: file + scopes: + - secrets:get:project/releng/gecko/build/level-{level}/arc-phabricator-token + + +jobs: + funsize-update-generator: + treeherder: + symbol: pipfu(fug) + worker: + env: + PIPFILE_DIRECTORY: "taskcluster/docker/funsize-update-generator" + PYTHON3: "1" + REVIEWERS: "sfraser, bhearsum" diff --git a/taskcluster/docs/kinds.rst b/taskcluster/docs/kinds.rst index 004bc1915323..cfcbbd8e98e9 100644 --- a/taskcluster/docs/kinds.rst +++ b/taskcluster/docs/kinds.rst @@ -448,6 +448,11 @@ repo-update Repo-Update tasks are tasks that perform some action on the project repo itself, in order to update its state in some way. +pipfile-update +-------------- +Pipfile-update tasks generate update Pipfile.lock for in-tree Pipfiles, and attach +patches with the updates to Phabricator. + partials -------- Partials takes the complete.mar files produced in previous tasks and generates partial diff --git a/taskcluster/taskgraph/target_tasks.py b/taskcluster/taskgraph/target_tasks.py index b71910f221e0..f61dff33dbf6 100644 --- a/taskcluster/taskgraph/target_tasks.py +++ b/taskcluster/taskgraph/target_tasks.py @@ -572,6 +572,16 @@ def target_tasks_searchfox(full_task_graph, parameters, graph_config): 'searchfox-macosx64-searchfox/debug'] +@_target_task('pipfile_update') +def target_tasks_pipfile_update(full_task_graph, parameters, graph_config): + """Select the set of tasks required to perform nightly in-tree pipfile updates + """ + def filter(task): + # For now any task in the repo-update kind is ok + return task.kind in ['pipfile-update'] + return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)] + + @_target_task('file_update') def target_tasks_file_update(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform nightly in-tree file updates diff --git a/taskcluster/taskgraph/transforms/pipfile_update.py b/taskcluster/taskgraph/transforms/pipfile_update.py new file mode 100644 index 000000000000..0f97a93726c4 --- /dev/null +++ b/taskcluster/taskgraph/transforms/pipfile_update.py @@ -0,0 +1,27 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +""" +Transform the repo-update task into an actual task description. +""" + +from __future__ import absolute_import, print_function, unicode_literals + +from taskgraph.transforms.base import TransformSequence +from taskgraph.util.schema import resolve_keyed_by + +transforms = TransformSequence() + + +@transforms.add +def resolve_keys(config, tasks): + for task in tasks: + env = task['worker'].setdefault('env', {}) + env['BRANCH'] = config.params['project'] + for envvar in env: + resolve_keyed_by(env, envvar, envvar, **config.params) + + for envvar in list(env.keys()): + if not env.get(envvar): + del env[envvar] + yield task