Skip to content

Commit

Permalink
gha: ci-on-push adapt chained jobs to workflow_run
Browse files Browse the repository at this point in the history
As we're using the `workflow_run` event, the checkout action would
pull the **current target branch** instead of the PR one.

Signed-off-by: Fabiano Fidêncio <[email protected]>
  • Loading branch information
fidencio committed Apr 5, 2023
1 parent adacdb3 commit b412349
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-kata-static-tarball-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Build kata-static tarball for amd64
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand All @@ -25,6 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
fetch-depth: 0 # This is needed in order to keep the commit ids history
- name: Build ${{ matrix.asset }}
run: |
Expand All @@ -50,6 +55,8 @@ jobs:
needs: build-asset
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- name: get-artifacts
uses: actions/download-artifact@v3
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-kata-static-tarball-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Build kata-static tarball for arm64
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand Down Expand Up @@ -29,6 +33,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
fetch-depth: 0 # This is needed in order to keep the commit ids history
- name: Build ${{ matrix.asset }}
run: |
Expand Down Expand Up @@ -58,6 +63,8 @@ jobs:
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- name: get-artifacts
uses: actions/download-artifact@v3
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-kata-static-tarball-s390x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Build kata-static tarball for s390x
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand All @@ -25,6 +29,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
fetch-depth: 0 # This is needed in order to keep the commit ids history
- name: Build ${{ matrix.asset }}
run: |
Expand Down Expand Up @@ -55,6 +60,8 @@ jobs:
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- name: get-artifacts
uses: actions/download-artifact@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-on-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/workflows/build-kata-static-tarball-amd64.yaml
with:
checkout-ref: ${{ github.event.workflow_run.head_sha }}
tarball-suffix: -${{ github.event.workflow_run.head_sha }}

publish-kata-deploy-payload-amd64:
needs: build-kata-static-tarball-amd64
uses: ./.github/workflows/publish-kata-deploy-payload-amd64.yaml
with:
checkout-ref: ${{ github.event.workflow_run.head_sha }}
tarball-suffix: -${{ github.event.workflow_run.head_sha }}
registry: ghcr.io
repo: ${{ github.repository_owner }}/kata-deploy-ci
Expand All @@ -28,6 +30,7 @@ jobs:
needs: publish-kata-deploy-payload-amd64
uses: ./.github/workflows/run-k8s-tests-on-aks.yaml
with:
checkout-ref: ${{ github.event.workflow_run.head_sha }}
registry: ghcr.io
repo: ${{ github.repository_owner }}/kata-deploy-ci
tag: ${{ github.event.workflow_run.head_sha }}-amd64
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish-kata-deploy-payload-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Publish kata-deploy payload for amd64
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand All @@ -24,6 +28,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- name: get-kata-tarball
uses: actions/download-artifact@v3
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish-kata-deploy-payload-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Publish kata-deploy payload for arm64
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand All @@ -28,6 +32,8 @@ jobs:
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- name: get-kata-tarball
uses: actions/download-artifact@v3
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish-kata-deploy-payload-s390x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Publish kata-deploy payload for s390x
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
tarball-suffix:
required: false
type: string
Expand All @@ -28,6 +32,8 @@ jobs:
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- name: get-kata-tarball
uses: actions/download-artifact@v3
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run-k8s-tests-on-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI | Run kubernetes tests on AKS
on:
workflow_call:
inputs:
checkout-ref:
required: false
tyoe: string
default: ${{ github.sha }}
registry:
required: true
type: string
Expand Down Expand Up @@ -36,6 +40,8 @@ jobs:
needs: create-aks
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- name: Install `bats`
run: |
sudo apt-get update
Expand Down

0 comments on commit b412349

Please sign in to comment.