Skip to content

Commit

Permalink
replace prow build job waiting with github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizanse committed Sep 17, 2024
1 parent 7ec59fb commit 0961aae
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 16 deletions.
48 changes: 42 additions & 6 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GIT_BOT_TOKEN }} # creating git tag using bot token because GITHUB_TOKEN would not trigger build workflow (https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow).

- name: Create changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/create_changelog.sh $RELEASE_VERSION

- name: Add lightweight tag to trigger release EPP build job
env:
GITHUB_TOKEN: ${{ secrets.GIT_BOT_TOKEN }} # creating git tag using bot token because GITHUB_TOKEN would not trigger build workflow (https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow).
run: |
git tag $RELEASE_VERSION
git push origin $RELEASE_VERSION
- name: Create the draft release
id: create-draft
env:
Expand All @@ -67,17 +75,45 @@ jobs:
RELEASE_ID=$(./scripts/create_draft_release.sh $RELEASE_VERSION)
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: Add lightweight tag to trigger release EPP build job
wait-for-build-job:
name: Wait for prow jobs
needs: [ verify-release, create-draft ]
runs-on: ubuntu-latest

steps:
- name: Checkout eventing-tools
uses: actions/checkout@v4
with:
repository: 'kyma-project/eventing-tools'
path: 'kyma-project/eventing-tools'
ref: main
sparse-checkout: 'scripts/wait-for-commit-check'

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install requirements
run: |
git tag $RELEASE_VERSION
git push origin $RELEASE_VERSION
pip install -r $GITHUB_WORKSPACE/kyma-project/eventing-tools/scripts/wait-for-commit-check/requirements.txt
- name: Verify build job status
run: ./scripts/verify_prow_post_job_status.sh ${{ github.ref_name }} 600 10 30
- name: wait for build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_FULL_NAME: ${{ github.repository_owner }}/eventing-publisher-proxy
GIT_REF: ${{ needs.verify-release.outputs.release_version }}
# The re-usable image-builder workflow from neighbors appends the "Build image" suffix to the check run name.
GIT_CHECK_RUN_NAME: "build-${{ needs.verify-release.outputs.release_version }} / Build image"
INTERVAL: 60
TIMEOUT: 900
run: |
python $GITHUB_WORKSPACE/kyma-project/eventing-tools/scripts/wait-for-commit-check/run.py
publish-release:
name: Publish release
needs: [verify-release, create-draft]
needs: [verify-release, create-draft, wait-for-build-job]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,35 @@ jobs:
echo "Using Eventing Manager image:"
kubectl get -n kyma-system deployment eventing-manager -o=jsonpath='{$.spec.template.spec.containers[:1].image}'
- name: Wait for build job to succeed
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
- name: Wait for build job - Checkout eventing-tools
uses: actions/checkout@v4
with:
repository: 'kyma-project/eventing-tools'
path: 'kyma-project/eventing-tools'
ref: main
sparse-checkout: 'scripts/wait-for-commit-check'

- name: Wait for build job - Setup python
uses: actions/setup-python@v5
with:
context: "pull-eventing-publisher-proxy-build"
commit_ref: "${{ github.event.pull_request.head.sha }}" # Note: 'github.event.pull_request.head.sha' is not same as 'github.sha' on pull requests.
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
python-version: '3.10'
cache: 'pip'

- name: Wait for build job - Install requirements
run: |
pip install -r $GITHUB_WORKSPACE/kyma-project/eventing-tools/scripts/wait-for-commit-check/requirements.txt
- name: Wait for build job
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_OWNER: "${{ github.repository_owner }}"
GITHUB_REPO: "eventing-publisher-proxy"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_FULL_NAME: ${{ github.repository_owner }}/eventing-publisher-proxy
GIT_REF: "${{ github.event.pull_request.head.sha }}" # Note: 'github.event.pull_request.head.sha' is not same as 'github.sha' on pull requests.
# The re-usable image-builder workflow from neighbors appends the "Build image" suffix to the check run name.
GIT_CHECK_RUN_NAME: "build / Build image"
INTERVAL: 60
TIMEOUT: 900
run: |
python $GITHUB_WORKSPACE/kyma-project/eventing-tools/scripts/wait-for-commit-check/run.py
- name: Setup Eventing Manager with new EPP image
run: |
Expand Down

0 comments on commit 0961aae

Please sign in to comment.