Skip to content

Commit 1640cdb

Browse files
committed
Add build kind
1 parent 7e322f3 commit 1640cdb

3 files changed

Lines changed: 95 additions & 1 deletion

File tree

backend/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ printf '{"commit": "%s", "version": "%s", "source": "%s", "build": "%s"}\n' \
1414
# Run 'taskboot build' with our local copy of the Git repository where we updated the version.json with correct values.
1515
# To do so, we use '--target /path/to/existing/clone' instead of passing environment variables (GIT_REPOSITORY, GIT_REVISION)
1616
# to taskboot that would activate an automated clone.
17-
taskboot --target /code-review build --image mozilla/code-review --tag "$CHANNEL" --tag "$COMMIT_SHA" --write /backend.tar backend/Dockerfile
17+
taskboot --target . build --image mozilla/code-review --tag "$CHANNEL" --tag "$COMMIT_SHA" --write /builds/worker/artifacts/backend.tar backend/Dockerfile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from taskgraph.transforms.base import TransformSequence
2+
3+
transforms = TransformSequence()
4+
5+
6+
@transforms.add
7+
def add_index_routes(config, tasks):
8+
for task in tasks:
9+
params = config.params
10+
head_rev = params["head_rev"]
11+
head_ref = params["head_ref"]
12+
13+
if params["tasks_for"] == "github-pull-request":
14+
index_prefix = "code-review-pr"
15+
else:
16+
index_prefix = "code-review"
17+
18+
trust_domain = config.graph_config["trust-domain"]
19+
task.setdefault("routes", []).extend(
20+
[
21+
f"index.{trust_domain}.v2.{index_prefix}.{task['name']}.revision.{head_rev}",
22+
f"index.{trust_domain}.v2.{index_prefix}.{task['name']}.branch.{head_ref}",
23+
]
24+
)
25+
26+
yield task

taskcluster/kinds/build/kind.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
loader: taskgraph.loader.transform:loader
2+
3+
transforms:
4+
- code_review_taskgraph.transforms.build
5+
- taskgraph.transforms.task_context
6+
- taskgraph.transforms.run
7+
- taskgraph.transforms.task
8+
9+
kind-dependencies:
10+
- lint
11+
- test
12+
13+
task-defaults:
14+
description: Build {name} Docker image
15+
run-on-tasks-for:
16+
- github-pull-request
17+
- github-push
18+
worker-type: b-linux
19+
worker:
20+
docker-image: { in-tree: taskboot }
21+
max-run-time: 3600
22+
artifacts:
23+
- type: file
24+
name: public/code-review-{name}.tar.zst
25+
path: /builds/worker/artifacts/{name}.tar.zst
26+
run:
27+
using: run-task
28+
cwd: "{checkout}"
29+
run-as-root: true
30+
dependencies:
31+
lint: lint-pre-commit
32+
task-context:
33+
from-parameters:
34+
channel: channel
35+
head_rev: head_rev
36+
head_ref: head_ref
37+
head_repository: head_repository
38+
substitution-fields:
39+
- description
40+
- run.command
41+
- worker.artifacts
42+
43+
tasks:
44+
bot:
45+
run:
46+
command: >-
47+
taskboot --target /builds/worker/checkouts/vcs
48+
build --image mozilla/code-review
49+
--tag {channel} --tag {head_rev}
50+
--write /builds/worker/artifacts/bot.tar bot/docker/Dockerfile
51+
dependencies:
52+
test: test-bot
53+
54+
backend:
55+
run:
56+
command: backend/build.sh {head_rev} {head_ref} {head_repository} {channel}
57+
dependencies:
58+
test: test-backend
59+
60+
integration:
61+
run:
62+
command: >-
63+
taskboot --target /builds/worker/checkouts/vcs
64+
build --image mozilla/code-review
65+
--tag integration-{channel} --tag integration-{head_rev}
66+
--write /builds/worker/artifacts/integration.tar integration/docker/Dockerfile
67+
dependencies:
68+
test: test-integration

0 commit comments

Comments
 (0)