-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): connect repo to Community-TC
- Loading branch information
1 parent
1fc8f5f
commit fdb1dab
Showing
11 changed files
with
738 additions
and
9 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,5 @@ | ||
#!/usr/bin/env bash | ||
if [ -f .pre-commit-config.yaml ]; then | ||
echo 'pre-commit configuration detected, but `pre-commit install` was never run' 1>&2 | ||
exit 1 | ||
fi |
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,21 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
# Trims trailing whitespace | ||
- id: trailing-whitespace | ||
# Makes sure files end in a newline and only a newline | ||
- id: end-of-file-fixer | ||
# Check for files that contain merge conflict strings | ||
- id: check-merge-conflict | ||
|
||
- repo: https://github.com/marco-c/taskcluster_yml_validator | ||
rev: v0.0.9 | ||
hooks: | ||
# Validates .taskcluster.yml file against possible GitHub events | ||
- id: taskcluster_yml | ||
|
||
ci: | ||
skip: [taskcluster_yml] |
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,153 @@ | ||
--- | ||
version: 1 | ||
reporting: checks-v1 | ||
policy: | ||
pullRequests: public | ||
tasks: | ||
- $let: | ||
ownerEmail: | ||
$if: 'tasks_for == "github-push"' | ||
then: '${event.pusher.email}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: '${event.pull_request.user.login}@users.noreply.github.com' | ||
else: | ||
$if: 'tasks_for == "github-release"' | ||
then: '${event.sender.login}@users.noreply.github.com' | ||
baseRepoUrl: | ||
$if: 'tasks_for == "github-push"' | ||
then: '${event.repository.html_url}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: '${event.pull_request.base.repo.html_url}' | ||
base_ref: | ||
$if: 'tasks_for[:19] == "github-pull-request"' | ||
then: ${event.pull_request.base.ref} | ||
else: | ||
# event.base_ref is barely documented[1]. Testing showed it's only | ||
# defined when creating a new branch. It's null when pushing to an | ||
# existing branch | ||
# | ||
# [1] https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push | ||
# [2] https://taskcluster-taskgraph.readthedocs.io/en/latest/reference/parameters.html#base-ref | ||
$if: 'tasks_for == "github-push" && event.base_ref' | ||
then: ${event.base_ref} | ||
else: | ||
$if: 'tasks_for == "github-push"' | ||
then: ${event.ref} | ||
else: | ||
$if: 'tasks_for in ["cron", "action"]' | ||
then: '${push.branch}' | ||
repoUrl: | ||
$if: 'tasks_for == "github-push"' | ||
then: '${event.repository.html_url}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: '${event.pull_request.head.repo.html_url}' | ||
project: | ||
$if: 'tasks_for == "github-push"' | ||
then: '${event.repository.name}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: '${event.pull_request.head.repo.name}' | ||
headBranch: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: ${event.pull_request.head.ref} | ||
else: | ||
$if: 'tasks_for == "github-push"' | ||
then: ${event.ref} | ||
headSha: | ||
$if: 'tasks_for == "github-push"' | ||
then: '${event.after}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: '${event.pull_request.head.sha}' | ||
pullRequestAction: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: ${event.action} | ||
else: 'UNDEFINED' | ||
in: | ||
$if: > | ||
tasks_for == "github-push" && headBranch == "main" | ||
|| (tasks_for == "github-pull-request" && pullRequestAction in ["opened", "reopened", "synchronize"]) | ||
then: | ||
taskId: {$eval: as_slugid("decision_task")} | ||
taskGroupId: {$eval: as_slugid("decision_task")} | ||
schedulerId: homebrew-level-1 | ||
created: {$fromNow: ''} | ||
deadline: {$fromNow: '1 day'} | ||
expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors | ||
metadata: | ||
owner: "${ownerEmail}" | ||
name: Decision Task | ||
description: Task that generates a taskgraph and submits it to Taskcluster | ||
source: '${repoUrl}/raw/${headSha}/.taskcluster.yml' | ||
provisionerId: proj-taskcluster | ||
workerType: ci | ||
scopes: | ||
$if: 'tasks_for == "github-push"' | ||
then: | ||
# ${repoUrl[8:]} strips out the leading 'https://' | ||
# while ${headBranch[11:]} strips out 'refs/heads/' | ||
- 'assume:repo:${repoUrl[8:]}:branch:${headBranch[11:]}' | ||
else: | ||
$if: 'tasks_for == "github-pull-request"' | ||
then: | ||
- 'assume:repo:github.com/${event.pull_request.base.repo.full_name}:pull-request' | ||
dependencies: [] | ||
requires: all-completed | ||
payload: | ||
image: mozillareleases/taskgraph:decision-10378fde0bf12adbd64e74313bf72ea3c6caf311ad6af23e2bff1d8f1232a221@sha256:7518c410bdf91142b0e26455d26ddaf861202cfbb3c35d0b1ef85d1ed577a5bd | ||
cache: | ||
homebrew-level-1-checkouts-sparse-v2: /builds/worker/checkouts | ||
features: | ||
taskclusterProxy: true | ||
# chainOfTrust: true | ||
maxRunTime: 300 | ||
env: | ||
$merge: | ||
# run-task uses these environment variables to clone your | ||
# repo and checkout the proper revision | ||
- HOMEBREW_BASE_REPOSITORY: '${baseRepoUrl}' | ||
HOMEBREW_BASE_REF: '${base_ref}' | ||
HOMEBREW_HEAD_REPOSITORY: '${repoUrl}' | ||
HOMEBREW_HEAD_REF: '${headBranch}' | ||
HOMEBREW_HEAD_REV: '${headSha}' | ||
HOMEBREW_PIP_REQUIREMENTS: taskcluster/requirements.txt | ||
HOMEBREW_REPOSITORY_TYPE: git | ||
REPOSITORIES: {$json: {homebrew: "homebrew"}} | ||
command: | ||
- run-task | ||
- '--homebrew-checkout=/builds/worker/checkouts/src' | ||
- '--task-cwd=/builds/worker/checkouts/src' | ||
- '--' | ||
- bash | ||
- -cx | ||
- > | ||
~/.local/bin/taskgraph decision | ||
--pushlog-id='0' | ||
--pushdate='0' | ||
--project='${project}' | ||
--message="" | ||
--owner='${ownerEmail}' | ||
--level='1' | ||
--base-repository="$HOMEBREW_BASE_REPOSITORY" | ||
--base-ref="$HOMEBREW_BASE_REF" | ||
--head-repository="$HOMEBREW_HEAD_REPOSITORY" | ||
--head-ref="$HOMEBREW_HEAD_REF" | ||
--head-rev="$HOMEBREW_HEAD_REV" | ||
--repository-type="$HOMEBREW_REPOSITORY_TYPE" | ||
--tasks-for='${tasks_for}' | ||
artifacts: | ||
'public': | ||
type: 'directory' | ||
path: '/builds/worker/artifacts' | ||
expires: {$fromNow: '1 year'} | ||
'public/docker-contexts': | ||
type: 'directory' | ||
path: '/builds/worker/checkouts/src/docker-contexts' | ||
# This needs to be at least the deadline of the | ||
# decision task + the docker-image task deadlines. | ||
# It is set to a week to allow for some time for | ||
# debugging, but they are not useful long-term. | ||
expires: {$fromNow: '7 day'} |
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
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
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,25 @@ | ||
--- | ||
trust-domain: homebrew | ||
treeherder: | ||
group-names: | ||
'I': 'Docker Image Builds' | ||
|
||
task-priority: low | ||
|
||
taskgraph: | ||
repositories: | ||
ci: | ||
name: homebrew | ||
|
||
workers: | ||
aliases: | ||
images: | ||
provisioner: proj-taskcluster | ||
os: linux | ||
implementation: docker-worker | ||
worker-type: ci | ||
ci: | ||
provisioner: proj-taskcluster | ||
os: linux | ||
implementation: docker-worker | ||
worker-type: ci |
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,10 @@ | ||
loader: taskgraph.loader.transform:loader | ||
|
||
transforms: | ||
- taskgraph.transforms.docker_image:transforms | ||
- taskgraph.transforms.cached_tasks:transforms | ||
- taskgraph.transforms.task:transforms | ||
|
||
tasks: | ||
homebrew: | ||
symbol: I(homebrew-image) |
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,23 @@ | ||
--- | ||
loader: taskgraph.loader.transform:loader | ||
|
||
transforms: | ||
- taskgraph.transforms.job:transforms | ||
- taskgraph.transforms.task:transforms | ||
|
||
tasks: | ||
tests: | ||
description: brew {audit, install, test} | ||
worker-type: ci | ||
worker: | ||
max-run-time: 300 | ||
docker-image: | ||
in-tree: homebrew | ||
run: | ||
using: run-task | ||
cwd: '{checkout}' | ||
cache-dotcache: true | ||
command: >- | ||
brew audit --strict --online --formula ./Formula/taskcluster.rb && | ||
brew install --formula ./Formula/taskcluster.rb && | ||
brew test ./Formula/taskcluster.rb |
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,31 @@ | ||
FROM homebrew/brew | ||
|
||
USER root | ||
|
||
# Add worker user and setup its workspace. | ||
RUN mkdir /builds && \ | ||
groupadd -g 1001 worker && \ | ||
useradd -u 1001 -g 1001 -d /builds/worker -s /bin/bash -m worker && \ | ||
mkdir -p /builds/worker/workspace && \ | ||
chown -R worker:worker /builds && \ | ||
apt-get update && \ | ||
apt-get upgrade -y | ||
|
||
USER linuxbrew | ||
|
||
RUN brew update && \ | ||
brew upgrade && \ | ||
brew cleanup | ||
|
||
# Declare default working folder | ||
WORKDIR /builds/worker | ||
|
||
ENV SHELL=/bin/bash \ | ||
HOME=/builds/worker \ | ||
PATH=/builds/worker/.local/bin:$PATH | ||
|
||
VOLUME /builds/worker/checkouts | ||
VOLUME /builds/worker/.cache | ||
|
||
# Set a default command useful for debugging | ||
CMD ["/bin/bash", "--login"] |
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,7 @@ | ||
# For instructions on managing dependencies, see: | ||
# https://taskcluster-taskgraph.readthedocs.io/en/latest/howto/bootstrap-taskgraph.html | ||
|
||
arrow | ||
pyyaml | ||
taskcluster | ||
taskcluster-taskgraph |
Oops, something went wrong.