-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): connect repo to Community-TC #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
matt-boris
wants to merge
1
commit into
main
Choose a base branch
from
matt-boris/connectToTC
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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-d1ddb5593679cec9d7d2cdd8e9b8e2228b14ebe9b844411276cc3cfe37d189aa@sha256:b236321d98367f9cdbbd28c47bad7c0df34884897b75d266185d2e9e569ac0fa | ||
| 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.