-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from catenax-ng/fix/Helm_test_upgrade_and_work…
…flow TRG 5.09 - Helm test
- Loading branch information
Showing
1 changed file
with
53 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,19 @@ on: | |
pull_request: | ||
paths: | ||
- 'charts/country-risk/**' | ||
workflow_dispatch: | ||
# Trigger manually | ||
workflow_dispatch: # Trigger by another workflow | ||
inputs: | ||
node_image: | ||
description: 'kindest/node image for k8s kind cluster' | ||
default: 'kindest/node:v1.27.3' | ||
required: false | ||
type: string | ||
upgrade_from: | ||
description: 'chart version to upgrade from' | ||
default: '1.1.0' | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
lint-test: | ||
runs-on: ubuntu-latest | ||
|
@@ -21,38 +32,57 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Kubernetes KinD Cluster | ||
uses: container-tools/kind-action@v1 | ||
with: | ||
# upgrade version, default (v0.17.0) uses node image v1.21.1 and doesn't work with more recent node image versions | ||
version: v0.20.0 | ||
# default value for event_name != workflow_dispatch | ||
node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }} | ||
|
||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: v3.10.3 | ||
version: v3.9.3 | ||
|
||
# Setup python as a prerequisite for chart linting | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
python-version: '3.9' | ||
check-latest: true | ||
|
||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
|
||
# - name: Run chart-testing (list-changed) | ||
# id: list-changed | ||
# run: | | ||
# changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | ||
# if [[ -n "$changed" ]]; then | ||
# echo "::set-output name=changed::true" | ||
# fi | ||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
run: | | ||
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | ||
if [[ -n "$changed" ]]; then | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
# run chart linting | ||
- name: Run chart-testing (lint) | ||
run: ct lint --charts charts/country-risk --config charts/chart-testing-config.yaml | ||
|
||
# Preparing a kind cluster to install and test charts on | ||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
# if: steps.list-changed.outputs.changed == 'true' | ||
run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }} | ||
|
||
# install the chart to the kind cluster and run helm test | ||
# define charts to test with the --charts parameter | ||
- name: Run chart-testing (install) | ||
run: ct install --charts charts/country-risk --config charts/chart-testing-config.yaml | ||
# if: steps.list-changed.outputs.changed == 'true' | ||
run: | | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add pgadmin4 https://helm.runix.net | ||
ct install --charts charts/country-risk \ | ||
--helm-extra-set-args "\ | ||
--set country-risk-frontend.image.tag=latest \ | ||
--set country-risk-backend.image.tag=latest" | ||
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' | ||
# Upgrade the released chart version with the locally available chart | ||
# default value for event_name != workflow_dispatch | ||
|
||
- name: Run helm upgrade | ||
run: | | ||
helm repo add pgadmin4 https://helm.runix.net | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev | ||
helm install country-risk tractusx-dev/country-risk --version ${{ github.event.inputs.upgrade_from }} | ||
helm dependency update charts/country-risk | ||
helm upgrade country-risk charts/country-risk | ||
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' |