Skip to content

Commit

Permalink
chore(helm-test): update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
evegufy committed Jun 15, 2023
1 parent 80d39e9 commit a60de01
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/centralidp-chart-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
- name: Run chart-testing (lint)
run: ct lint --charts charts/centralidp --config charts/chart-testing-config.yaml

# 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/centralidp --config charts/chart-testing-config.yaml
Expand All @@ -92,7 +91,7 @@ jobs:
# Upgrade the released centralidp chart version with the locally available chart
- name: Run helm upgrade
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add bitnami-full-index https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev
helm install centralidp tractusx-dev/centralidp --version ${{ github.event.inputs.upgrade_from || '1.1.0' }}
helm dependency update charts/centralidp
Expand Down
56 changes: 40 additions & 16 deletions .github/workflows/sharedidp-chart-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,24 @@ on:
push:
paths:
- 'charts/sharedidp/**'
branches: [main, helm-environments]
branches: [ main ]
pull_request:
paths:
- 'charts/sharedidp/**'
workflow_dispatch:
inputs:
node_image:
description: 'kindest/node image for k8s kind cluster'
# k8s version from 3.1 release
default: 'kindest/node:v1.24.6'
required: false
type: string
upgrade_from:
description: 'portal chart version to upgrade from'
# sharedidp version from 3.1 release
default: '1.1.0'
required: false
type: string

jobs:
lint-test:
Expand All @@ -38,6 +51,12 @@ jobs:
with:
fetch-depth: 0

- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v2
with:
version: v0.19.0
node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.24.6' }}

- name: Set up Helm
uses: azure/setup-helm@v3
with:
Expand All @@ -46,30 +65,35 @@ jobs:
# 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/chart-testing-action@v2.3.1

# - 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/sharedidp --config charts/chart-testing-config.yaml

# Preparing a kind cluster to install and test charts on
- name: Create kind cluster
uses: helm/kind-action@v1.4.0
# if: steps.list-changed.outputs.changed == 'true'

# 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/sharedidp --config charts/chart-testing-config.yaml
# if: steps.list-changed.outputs.changed == 'true'
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true'

# Upgrade the released sharedidp chart version with the locally available chart
- name: Run helm upgrade
run: |
helm repo add bitnami-full-index https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev
helm install sharedidp tractusx-dev/sharedidp --version ${{ github.event.inputs.upgrade_from || '1.1.0' }}
helm dependency update charts/sharedidp
helm upgrade sharedidp charts/sharedidp
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true'

0 comments on commit a60de01

Please sign in to comment.