Skip to content

Commit

Permalink
feat(zuul-deprecation): Add workflows
Browse files Browse the repository at this point in the history
JIRA: INFRA-3527
  • Loading branch information
metju-ac committed Jun 14, 2024
1 parent a67b617 commit 258c6ff
Show file tree
Hide file tree
Showing 4 changed files with 456 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/check-extended.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: check-extended
on:
issue_comment:
types:
- created
jobs:
prepare-env:
runs-on:
group: infra1-runners-arc
labels: runners-small
permissions: read-all
outputs:
branch: ${{ steps.branch.outputs.branch }}
ref: refs/pull/${{ github.event.issue.number }}/merge
commit: ${{ steps.commit.outputs.commit }}
pr_number: ${{ github.event.issue.number }}
project: ${{ github.repository }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- name: Branch name
id: branch
run: |-
branch=$(echo "${{ github.ref }}" | sed 's/^refs\/heads\///')
echo "branch=$branch" >> "$GITHUB_OUTPUT"
- name: Commit
id: commit
run: |-
pr_head_sha=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" | \
jq --raw-output .head.sha)
echo "commit=$pr_head_sha" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, 'extended test') }}
gooddata-react-components-pull-request-dispatcher-pipeline:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- prepare-env
permissions:
contents: read
id-token: write
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, 'extended test') }}
steps:
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: client-libs
job-name: gooddata-react-components-pull-request-dispatcher-pipeline
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "check-extended",
"GH_COMMENT": "${{ github.event.comment.body }}"
}
comment-pr: "true"
ready-to-merge:
runs-on:
group: infra1-runners-arc
labels: runners-small
if: always() && ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, 'extended test') }}
needs:
- prepare-env
- gooddata-react-components-pull-request-dispatcher-pipeline
steps:
- name: Check if needed jobs succeeded
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
110 changes: 110 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: check
on: pull_request
jobs:
prepare-env:
runs-on:
group: infra1-runners-arc
labels: runners-small
outputs:
branch: ${{ github.base_ref }}
ref: ${{ github.ref }}
commit: ${{ github.event.pull_request.head.sha }}
pr_number: ${{ github.event.pull_request.number }}
project: ${{ github.repository }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
gooddata-react-components-unit-tests-zuul-docker:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- prepare-env
permissions:
contents: read
id-token: write
steps:
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: client-libs
job-name: gooddata-react-components-unit-tests-zuul-docker
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "check"
}
comment-pr: "true"
gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- prepare-env
permissions:
contents: read
id-token: write
steps:
- name: Check if any matching file changed
id: changed-files
run: |
any_changed=false
patterns=('^NOTICE(S)?(.TXT)?$' '^LICENSE(S)?(.TXT)?$')
for file in ${{ needs.prepare-env.outputs.changed_files }}; do
for pattern in "${patterns[@]}"; do
if [[ $file =~ $pattern ]]; then
any_changed=true
fi
done
done
echo "any_changed=$any_changed" >> "$GITHUB_OUTPUT"
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: compliance
job-name: gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "check"
}
comment-pr: "true"
if: steps.changed-files.outputs.any_changed == 'true'
ready-to-merge:
runs-on:
group: infra1-runners-arc
labels: runners-small
if: always()
needs:
- prepare-env
- gooddata-react-components-unit-tests-zuul-docker
- gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
steps:
- name: Check if needed jobs succeeded
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
158 changes: 158 additions & 0 deletions .github/workflows/gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: gate
on:
merge_group:
types:
- checks_requested
jobs:
prepare-env:
runs-on:
group: infra1-runners-arc
labels: runners-small
outputs:
branch: ${{ steps.branch.outputs.branch }}
ref: ${{ github.event.merge_group.head_ref }}
commit: ${{ github.event.merge_group.head_sha }}
pr_number: ${{ steps.pr-number.outputs.pr_number }}
project: ${{ github.repository }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
- name: Branch name
id: branch
run: |-
branch=$(echo "${{ github.event.merge_group.base_ref }}" | sed 's/^refs\/heads\///')
echo "branch=$branch" >> "$GITHUB_OUTPUT"
- name: PR number
id: pr-number
run: |-
pr_num=$(echo "${{ github.ref }}" | sed -n 's/.*pr-\([0-9]*\).*/\1/p')
echo "pr_number=$pr_num" >> "$GITHUB_OUTPUT"
gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- prepare-env
permissions:
contents: read
id-token: write
steps:
- name: Check if any matching file changed
id: changed-files
run: |
any_changed=false
patterns=('^NOTICE(S)?(.TXT)?$' '^LICENSE(S)?(.TXT)?$')
for file in ${{ needs.prepare-env.outputs.changed_files }}; do
for pattern in "${patterns[@]}"; do
if [[ $file =~ $pattern ]]; then
any_changed=true
fi
done
done
echo "any_changed=$any_changed" >> "$GITHUB_OUTPUT"
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: compliance
job-name: gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "gate"
}
comment-pr: "true"
if: steps.changed-files.outputs.any_changed == 'true'
gooddata-react-components-unit-tests-zuul-docker:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
- prepare-env
permissions:
contents: read
id-token: write
steps:
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: client-libs
job-name: gooddata-react-components-unit-tests-zuul-docker
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "gate"
}
comment-pr: "true"
gooddata-react-components-storybook-zuul-docker:
runs-on:
group: infra1-runners-arc
labels: runners-small
needs:
- gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
- prepare-env
permissions:
contents: read
id-token: write
steps:
- name: Call Jenkins trigger
id: call-jenkins
uses: gooddata/github-actions-public/jenkins/trigger@master
with:
server: ${{ secrets.JENKINS_ADDRESS }}
folder: client-libs
job-name: gooddata-react-components-storybook-zuul-docker
vault-url: ${{ secrets.VAULT_ADDRESS }}
params: |-
{
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}",
"GH_REF": "${{ needs.prepare-env.outputs.ref }}",
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}",
"GH_URL": "git@github.com:",
"GH_CHANGE": "${{ needs.prepare-env.outputs.pr_number }}",
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}",
"BUILD_BY_GITHUB": "true",
"GH_PIPELINE": "gate"
}
comment-pr: "true"
ready-to-merge:
runs-on:
group: infra1-runners-arc
labels: runners-small
if: always()
needs:
- prepare-env
- gooddata-react-components-fossa-licenses-validate-LR-ticket-zuul
- gooddata-react-components-unit-tests-zuul-docker
- gooddata-react-components-storybook-zuul-docker
steps:
- name: Check if needed jobs succeeded
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
Loading

0 comments on commit 258c6ff

Please sign in to comment.