Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
feat: Add Keptn dev version to integration tests (#314)
Browse files Browse the repository at this point in the history
* feat: Add Keptn dev version to Integration tests

Signed-off-by: TannerGabriel <gabrieltanner.code@gmail.com>

* Sort before picking release version

Signed-off-by: TannerGabriel <gabrieltanner.code@gmail.com>

* Change Helm repo validation

Signed-off-by: TannerGabriel <gabrieltanner.code@gmail.com>

* Use specific actions version + Change action name

Signed-off-by: TannerGabriel <gabrieltanner.code@gmail.com>
  • Loading branch information
TannerGabriel committed Jul 18, 2022
1 parent c9667b1 commit db5686a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .github/actions/github-script/fetch_keptn_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Fetch latest release and prerelease
prerelease=$(curl -s https://api.github.com/repos/keptn/keptn/releases | jq -r 'map(select(.prerelease)) | sort_by(.tag_name)[-1].tag_name')
release=$(curl --silent "https://api.github.com/repos/keptn/keptn/releases/latest" | jq -r '.tag_name')

# Write variables as output
echo "::set-output name=LATEST_RELEASE::$release"
echo "::set-output name=LATEST_PRERELEASE::$prerelease"
48 changes: 41 additions & 7 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,28 @@ defaults:
shell: bash

jobs:
fetch_latest_keptn_versions:
name: Fetch latest Keptn version for integration test run
runs-on: ubuntu-20.04
outputs:
LATEST_KEPTN_RELEASE: ${{ steps.prepare_keptn_version_matrix.outputs.LATEST_RELEASE }}
LATEST_KEPTN_PRERELEASE: ${{ steps.prepare_keptn_version_matrix.outputs.LATEST_PRERELEASE }}
steps:
- name: Check out code.
uses: actions/checkout@v3.0.2

- name: Prepare Keptn version matrix
id: prepare_keptn_version_matrix
run: |
./.github/actions/github-script/fetch_keptn_versions.sh
integration_test:
name: "Integration Tests"
needs: fetch_latest_keptn_versions
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
keptn-version: ["0.13.5", "0.14.2", "0.15.1", "0.16.0"] # https://github.com/keptn/keptn/releases
keptn-version: ["0.13.5", "0.14.2", "0.15.1", "0.16.0", "${{ needs.fetch_latest_keptn_versions.outputs.LATEST_KEPTN_RELEASE }}", "${{ needs.fetch_latest_keptn_versions.outputs.LATEST_KEPTN_PRERELEASE }}"] # https://github.com/keptn/keptn/releases
network-policy: [true, false]
job-network-policy: [true, false]
env:
Expand Down Expand Up @@ -116,9 +131,27 @@ jobs:
--set gitea.admin.password=${GITEA_ADMIN_PASSWORD} \
--wait
- name: Check Helm repo for image
id: helm_repo_check
shell: bash
env:
KEPTN_VERSION: ${{ matrix.keptn-version }}
run: |
echo "Keptn Version: $KEPTN_VERSION"
helm repo add keptn https://charts.keptn.sh
helm_search=$(helm search repo keptn/keptn --version $KEPTN_VERSION -o json | jq '. | length')
if [[ "$helm_search" != "0" ]]; then
echo "Using standard Helm repo"
echo "::set-output name=HELM_REPO::https://charts.keptn.sh"
else
echo "Using dev Helm repo"
echo "::set-output name=HELM_REPO::https://charts-dev.keptn.sh"
fi
- name: Install Keptn
id: install_keptn
uses: keptn-sandbox/action-install-keptn@v2.0.0
uses: keptn-sandbox/action-install-keptn@v3.0.0
timeout-minutes: 5
with:
KEPTN_VERSION: ${{ matrix.keptn-version }}
Expand All @@ -129,6 +162,7 @@ jobs:
features:
automaticProvisioningURL: http://keptn-gitea-provisioner-service.default
KUBECONFIG: ${{ env.KUBECONFIG }}
KEPTN_HELM_CHART_REPO: ${{ steps.helm_repo_check.outputs.HELM_REPO }}

- name: Test connection to keptn
run: |
Expand Down Expand Up @@ -255,14 +289,14 @@ jobs:
fileList.forEach(fileName => {
console.log(`Reading file: ${fileName}`);
const platformReportFile = fs.readFileSync(TEST_REPORTS_PATH + fileName, {encoding:'utf8', flag:'r'});
const keptnVersion = keptnVersionRegex.exec(fileName)[1];
const testResults = ndJsonParser(platformReportFile);
keptnVersionCount++;
testResults.forEach(testResult => {
if (testResult.Test !== undefined && (testResult.Action === "pass" || testResult.Action === "fail" || testResult.Action === "skip")) {
Expand Down Expand Up @@ -339,7 +373,7 @@ jobs:
fi
INTEGRATION_FILE_LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/blob/$BRANCH/.github/workflows/integration_tests.yaml
# Create issue for the failed integration test:
cat <<EOT >> integration-tests-failed.md
---
Expand Down

0 comments on commit db5686a

Please sign in to comment.