Skip to content

Commit

Permalink
Use checkout GH action branch setting (#459)
Browse files Browse the repository at this point in the history
* Use checkout GH action branch setting

  * Set branch with checkout GH action
  * Don't set branch for post upgrade checkout

* Use commit sha to change next version commit
  • Loading branch information
muralov authored Feb 6, 2024
1 parent ffcdf50 commit bc8e97c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/e2e-upgrade-test-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@ env:
on:
workflow_call:
inputs:
# image tag before upgrade
pre-upgrade-image-tag:
required: true
type: string
# image tag after upgrade
description: "The image tag of the Eventing Manager before the upgrade"
post-upgrade-image-tag:
required: true
type: string
# job name of the prow build job
description: "The image tag of the Eventing Manager after the upgrade"
build-job-name:
type: string
# commit sha of the PR or main branch commit
build-job-commit-sha:
description: "The name of the build job to wait for"
commit-sha:
type: string
description: "The commit sha of the new version"
required: true

# PR: main -> PR
# main: release -> main

jobs:
e2e-upgrade: # This job tests the upgrade of Eventing module from the latest image of the main branch to the current commit.
Expand All @@ -31,8 +35,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pre-upgrade checkout
run: git checkout -b ${{ inputs.pre-upgrade-image-tag }}
with:
ref: ${{ inputs.pre-upgrade-image-tag }}

- name: Install k3d tools
run: make -C hack/ci/ install-k3d-tools
Expand Down Expand Up @@ -74,7 +78,7 @@ jobs:
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
with:
context: ${{ inputs.build-job-name }}
commit_ref: "${{ inputs.build-job-commit-sha }}" # Note: 'github.event.pull_request.head.sha' is not same as 'github.sha' on pull requests.
commit_ref: "${{ inputs.commit-sha }}"
timeout: 600000 # 10 minutes in milliseconds
# The check interval is kept long otherwise it will exhaust the GitHub rate limit (More info: https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting)
check_interval: 60000 # 1 minute in milliseconds
Expand All @@ -85,8 +89,8 @@ jobs:

- name: Checkout
uses: actions/checkout@v4
- name: Post-upgrade checkout
run: git checkout -b ${{ inputs.post-upgrade-image-tag }}
with:
ref: ${{ inputs.commit-sha }}

- name: Install Eventing manager after upgrade
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-e2e-upgrade-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
pre-upgrade-image-tag: main
post-upgrade-image-tag: PR-${{ github.event.number }}
build-job-name: pull-eventing-manager-build
build-job-commit-sha: ${{ github.event.pull_request.head.sha }}
commit-sha: ${{ github.event.pull_request.head.sha }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/push-e2e-upgrade-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
pre-upgrade-image-tag: ${{ needs.get-latest-release.outputs.latest_release_tag }}
post-upgrade-image-tag: main
build-job-name: post-eventing-manager-build
build-job-commit-sha: ${{ github.sha }}
commit-sha: ${{ github.sha }}
secrets: inherit

0 comments on commit bc8e97c

Please sign in to comment.