-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1622800 - part 5: Schedule a single screenshot job to Bitrise
- Loading branch information
1 parent
324fc94
commit f451a8f
Showing
9 changed files
with
380 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 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.docker_image:transforms | ||
- taskgraph.transforms.cached_tasks:transforms | ||
- taskgraph.transforms.task:transforms | ||
|
||
jobs: | ||
screenshots: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 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: | ||
- ffios_taskgraph.transforms.screenshots:transforms | ||
- ffios_taskgraph.transforms.secrets:transforms | ||
- taskgraph.transforms.job:transforms | ||
- taskgraph.transforms.task:transforms | ||
|
||
|
||
job-defaults: | ||
description: Generate localized screenshots by delegating the work to bitrise.io | ||
run: | ||
using: run-commands | ||
use-caches: false | ||
secrets: | ||
by-level: | ||
'3': | ||
- name: project/mobile/firefox-ios/bitrise | ||
key: api_key | ||
path: .bitrise_token | ||
default: [] | ||
dummy-secrets: | ||
by-level: | ||
'3': [] | ||
default: | ||
- content: "faketoken" | ||
path: .bitrise_token | ||
run-on-tasks-for: [] | ||
worker: | ||
artifacts: | ||
- type: file | ||
name: public/logs/bitrise.log | ||
path: /builds/worker/checkouts/src/bitrise.log | ||
docker-image: {in-tree: screenshots} | ||
max-run-time: 3600 | ||
worker-type: b-linux | ||
|
||
jobs: | ||
fr: | ||
locale: fr | ||
worker: | ||
# TODO: Move artifacts in transforms once we start supporting all locales | ||
artifacts: | ||
- type: file | ||
name: public/screenshots/fr.zip | ||
path: /builds/worker/checkouts/src/fr.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 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/. | ||
|
||
FROM ubuntu:18.04 | ||
|
||
MAINTAINER Johan Lorenzo "[email protected]" | ||
|
||
# Add worker user | ||
RUN mkdir /builds && \ | ||
useradd -d /builds/worker -s /bin/bash -m worker && \ | ||
chown worker:worker /builds/worker && \ | ||
mkdir /builds/worker/artifacts && \ | ||
chown worker:worker /builds/worker/artifacts | ||
|
||
WORKDIR /builds/worker/ | ||
|
||
|
||
ENV CURL='curl --location --retry 5' \ | ||
LANG='en_US.UTF-8' \ | ||
TERM='dumb' | ||
|
||
|
||
RUN apt-get update -qq \ | ||
# We need to install tzdata before all of the other packages. Otherwise it will show an interactive dialog that | ||
# we cannot navigate while building the Docker image. | ||
&& apt-get install -y tzdata \ | ||
&& apt-get install -y curl \ | ||
git \ | ||
locales \ | ||
mercurial \ | ||
python3 \ | ||
python3-pip \ | ||
&& apt-get clean | ||
|
||
RUN pip3 install --upgrade pip | ||
COPY requirements.txt ./ | ||
RUN pip3 install -r requirements.txt | ||
|
||
RUN locale-gen "$LANG" | ||
|
||
# %include-run-task | ||
|
||
ENV SHELL=/bin/bash \ | ||
HOME=/builds/worker \ | ||
PATH="/builds/worker/.local/bin:$PATH" | ||
|
||
|
||
VOLUME /builds/worker/checkouts | ||
VOLUME /builds/worker/.cache | ||
|
||
|
||
# run-task expects to run as root | ||
USER root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
aiohttp-retry | ||
taskcluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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/. | ||
""" | ||
Resolve secrets and dummy secrets | ||
""" | ||
|
||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
from taskgraph.transforms.base import TransformSequence | ||
|
||
|
||
transforms = TransformSequence() | ||
|
||
|
||
@transforms.add | ||
def add_command(config, tasks): | ||
for task in tasks: | ||
commands = task["run"].setdefault("commands", []) | ||
locale = task.pop("locale") | ||
commands.append([ | ||
"python3", | ||
"taskcluster/scripts/generate-screenshots.py", | ||
"--token-file", ".bitrise_token", | ||
"--branch", config.params["head_ref"], | ||
"--commit", config.params["head_rev"], | ||
"--locale", locale | ||
]) | ||
|
||
yield task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/. | ||
""" | ||
Resolve secrets and dummy secrets | ||
""" | ||
|
||
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: | ||
for key in ("run.secrets", "run.dummy-secrets"): | ||
resolve_keyed_by( | ||
task, | ||
key, | ||
item_name=task["name"], | ||
level=config.params["level"] | ||
) | ||
yield task |
Oops, something went wrong.