Skip to content

Commit

Permalink
ci(integration): Run common Helm integration test from release and sn…
Browse files Browse the repository at this point in the history
…apshots (#2679)

* ci(integration): Use integration test workflow in release and deploy snapshots

* Update DEPLOY_SNAPSHOTS.yaml - re-use existing integration test workflow

* Update RELEASE.yaml - run as separate job

As is done in update snapshots workflow

* Update DEPLOY_SNAPSHOTS.yaml - inherit secrets

* Update INTEGRATION_TEST.yml - add on workflow_call, remove on push

- Add on workflow_call to support calling from other workflows (e.g., deploy snapshot, release
- Remove on push because it appears we can only run one integration test total at a time. Renovate often "pushes" many commits at once. In addition, integration tests are too flaky to be actioned on each time.

* Update DEPLOY_SNAPSHOTS.yaml - pass in main as helm branch

* Update helm-git-refs.json - use short branch names

For easier use with other workflows. integration test workflow will follow.

* Update INTEGRATION_TEST.yml - use short branch name

So we can more easily use either passed-in arg or where integration test is being run.

Hardcoded .json file already edited

* Update RELEASE.yaml - pass in release branch

* Update DEPLOY_SNAPSHOTS.yaml - pass in release-branch

External workflows shouldn't need to use helm-branch

* ci: access args from inputs

This will work with both workflow_call and workflow_dispatch

As discussed here:
https://docs.github.com/en/actions/using-workflows/reusing-workflows

* ci: remove helm-branch arg from workflow_call

This is not used by any workflow call - only workflow_dispatch

* ci: save release branch to outputs

Otherwise, won't be accessible in next helm-deploy job
  • Loading branch information
ev-codes authored May 31, 2024
1 parent 3270ba5 commit 272974f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/DEPLOY_SNAPSHOTS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,8 @@ jobs:
helm-deploy:
needs: deploy-snapshots
name: Helm chart Integration Tests
uses: camunda/camunda-platform-helm/.github/workflows/test-integration-template.yaml@main
uses: ./.github/workflows/INTEGRATION_TEST.yml
secrets: inherit
with:
identifier: connectors-int
test-enabled: true
extra-values: |
connectors:
image:
tag: SNAPSHOT
connectors-version: SNAPSHOT
release-branch: main
14 changes: 5 additions & 9 deletions .github/workflows/INTEGRATION_TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
description: 'The version of the Connectors to test. If not provided, the version is determined based on the Maven project version. On main branch, the default is SNAPSHOT'
required: false
type: string
helm-branch:
description: 'The branch of the Helm chart to test against. If not provided, the Helm branch is determined based on the release-branch or the ref (see helm-git-refs.json)'
required: false
type: string
release-branch:
description: 'Connectors release branch containing code to test. If not provided, the Helm branch is determined based on the ref (see helm-git-refs.json)'
required: false
Expand Down Expand Up @@ -52,28 +48,28 @@ jobs:
- name: Determine version of the Connectors image to use
id: connectors-version
run: |
if [ -z "${{ github.event.inputs.connectors-version }}" ]; then
if [ -z "${{ inputs.connectors-version }}" ]; then
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "connectors-version=SNAPSHOT" >> $GITHUB_OUTPUT
else
echo "connectors-version=${{ steps.maven-version.outputs.version }}" >> $GITHUB_OUTPUT
fi
else
echo "connectors-version=${{ github.event.inputs.connectors-version }}" >> $GITHUB_OUTPUT
echo "connectors-version=${{ inputs.connectors-version }}" >> $GITHUB_OUTPUT
fi
- name: Determine Helm chart ref to use
id: helm-branch
run: |
if [ -z "${{ github.event.inputs.helm-branch }}" ]; then
helm_branch=$(jq -r ".[\"${{ github.event.inputs.release-branch || github.ref_name }}\"]" .github/workflows/helm-git-refs.json)
if [ -z "${{ inputs.helm-branch }}" ]; then
helm_branch=$(jq -r ".[\"${{ inputs.release-branch || github.ref_name }}\"]" .github/workflows/helm-git-refs.json)
if [ -z "$helm_branch" ] || [ "$helm_branch" == "null" ]; then
echo "::error::Could not determine Helm chart branch to use, please provide helm-branch input or adjust the mappings in .github/workflows/helm-git-refs.json"
exit 1
fi
echo "helm-branch=$helm_branch" >> $GITHUB_OUTPUT
else
echo "helm-branch=${{ github.event.inputs.helm-branch }}" >> $GITHUB_OUTPUT
echo "helm-branch=${{ inputs.helm-branch }}" >> $GITHUB_OUTPUT
fi
- name: Log results
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/RELEASE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
build-and-push:
name: Build and push Docker images
runs-on: ubuntu-latest
outputs:
releaseBranch: ${{ steps.determine_release_branch.outputs.releaseBranch }}
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -264,3 +266,12 @@ jobs:
bundle/default-bundle/target/connectors-bundle-sbom.xml
connectors-bundle-templates-${{ github.event.release.tag_name }}.tar.gz
connectors-bundle-templates-${{ github.event.release.tag_name }}.zip
helm-deploy:
needs: build-and-push
name: Run Helm Integration Tests
uses: ./.github/workflows/INTEGRATION_TEST.yml
secrets: inherit
with:
connectors-version: ${{ github.event.release.tag_name }}
release-branch: ${{ needs.build-and-push.outputs.releaseBranch }}

0 comments on commit 272974f

Please sign in to comment.