-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge develop and release 0.4.0
- Loading branch information
Showing
42 changed files
with
2,750 additions
and
72 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 |
---|---|---|
|
@@ -21,6 +21,19 @@ name: Verify and Test Helm Chart | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
node_image: | ||
description: 'kindest/node image for k8s kind cluster' | ||
# k8s version from 3.1 release as default | ||
default: 'kindest/node:v1.27.3' | ||
required: false | ||
type: string | ||
upgrade_from: | ||
description: 'chart version to upgrade from' | ||
# chart version from 3.1 release as default | ||
default: '0.2.0' | ||
required: false | ||
type: string | ||
pull_request: | ||
paths: | ||
- 'charts/managed-identity-wallet/**' | ||
|
@@ -74,7 +87,7 @@ jobs: | |
with: | ||
image: jnorwood/helm-docs:v1.11.3 | ||
options: -v ${{ github.workspace }}/charts:/helm-docs | ||
run: helm-docs | ||
run: helm-docs -i managed-identity-wallet/.helmdocsignore | ||
|
||
- name: Verify that no changes are required | ||
run: | | ||
|
@@ -107,9 +120,10 @@ jobs: | |
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Add bitnami repo | ||
- name: Add bitnami and tractusx-dev repos | ||
run: | | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev | ||
helm repo update | ||
- name: Update Helm dependencies | ||
|
@@ -119,7 +133,7 @@ jobs: | |
- name: Install Helm unittest plugin | ||
run: | | ||
helm plugin install https://github.com/helm-unittest/helm-unittest.git | ||
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.3.5 | ||
- name: Run Helm unittests | ||
run: task helm:unittest | ||
|
@@ -132,7 +146,8 @@ jobs: | |
- name: Kubernetes KinD Cluster | ||
uses: container-tools/kind-action@v2 | ||
with: | ||
node_image: 'kindest/node:v1.27.3' | ||
# default value for event_name != workflow_dispatch | ||
node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }} | ||
version: v0.20.0 | ||
|
||
- name: Build image | ||
|
@@ -142,5 +157,80 @@ jobs: | |
push: true | ||
tags: kind-registry:5000/miw:testing | ||
|
||
- name: Install the chart on KinD cluster | ||
run: helm install -n apps --create-namespace --wait --set image.tag=testing --set=image.repository=kind-registry:5000/miw testing charts/managed-identity-wallet | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
check-latest: true | ||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
|
||
# ct list-changed will output all charts which have changed compared to the target-branch | ||
# Example: | ||
# Our branch has update the charts/managed-identity-wallet | ||
# When we compare with main/develop | ||
# We get the output | ||
# > charts/managed-identity-wallet | ||
# and subsequently set the variable `changed=true` | ||
- 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 | ||
# TODO: update the ci/all-values.yaml file before enabling this step | ||
- name: Run chart-testing (install) | ||
run: ct install --charts charts/managed-identity-wallet | ||
# if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' | ||
if: false | ||
|
||
# command breakdown | ||
# install: install the chart effectively creating a release | ||
# install arg 1 (testing): the name of the release | ||
# install arg 2 (tractusx-dev/managed-identity-wallet): the chart to install (in this case the official one from the dev repo) | ||
# -n/--namespace: the namespace to use when installing | ||
# --create-namespace: create the release namespace if it doesn't exist | ||
# --wait: wait for all resources to start | ||
# --version: The chart version to install | ||
- name: Install the default chart on KinD cluster | ||
run: | | ||
helm install \ | ||
testing \ | ||
tractusx-dev/managed-identity-wallet \ | ||
-n apps \ | ||
--create-namespace \ | ||
--wait \ | ||
--version ${{ github.event.inputs.upgrade_from || '0.2.0' }} | ||
# command breakdown | ||
# helm dependency update: update chart dependencies based on the content of Chart.yaml | ||
# update arg1 (charts/managed-identity-wallet): the location of Chart.yaml | ||
# -n/--namespace apps: run in the `apps` namespace | ||
# --- | ||
# helm upgrade: upgrade a release | ||
# upgrade arg1 (testing): the name of the release to upgrade | ||
# upgrade arg2 (charts/managed-identity-wallet): the location of Chart.yaml | ||
# -n/--namespace apps: run in the `apps` namespace | ||
# --wait: wait for all pods, services etc. ro run | ||
# --set image.tag=testing: overwrite the image.tag value to be `testing` | ||
# --set image.repository=kind-registry:5000/miw: overwrite the image.repository value to be `kind-registry:5000/miw` | ||
# --- | ||
# NOTE: the overwritten values for the image are used to ensure we use the latest chart version, which was | ||
# built during the workflow run. | ||
- name: Run helm upgrade | ||
run: | | ||
helm dependency \ | ||
update \ | ||
charts/managed-identity-wallet \ | ||
-n apps | ||
helm upgrade \ | ||
testing \ | ||
charts/managed-identity-wallet \ | ||
-n apps \ | ||
--wait \ | ||
--set image.tag=testing \ | ||
--set image.repository=kind-registry:5000/miw | ||
# only run if this is not a PR -OR- if there are new versions available | ||
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' |
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 |
---|---|---|
|
@@ -41,6 +41,9 @@ jobs: | |
contents: write | ||
pull-requests: write | ||
packages: write | ||
outputs: | ||
next_release: ${{ steps.semantic-release.outputs.next_release }} | ||
will_create_new_release: ${{ steps.semantic-release.outputs.will_create_new_release }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
@@ -57,21 +60,33 @@ jobs: | |
distribution: 'temurin' | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 # Replace with your desired Node.js version | ||
node-version: 20 | ||
|
||
# setup helm-docs as it is needed during semantic-release | ||
- uses: gabe565/setup-helm-docs-action@v1 | ||
name: Setup helm-docs | ||
if: github.event_name != 'pull_request' | ||
with: | ||
version: v1.11.3 | ||
|
||
- name: Run semantic release | ||
id: semantic-release | ||
if: github.event_name != 'pull_request' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
run: | | ||
npx --yes -p @semantic-release/exec -p @semantic-release/changelog -p @semantic-release/git -p @semantic-release/commit-analyzer -p @semantic-release/release-notes-generator semantic-release | ||
- name: Run semantic release (dry run) | ||
if: github.event_name == 'pull_request' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
run: | | ||
npx --yes -p @semantic-release/exec -p @semantic-release/github -p @semantic-release/changelog -p @semantic-release/git -p @semantic-release/commit-analyzer -p @semantic-release/release-notes-generator semantic-release --dry-run | ||
|
@@ -94,6 +109,11 @@ jobs: | |
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- name: Report semantic-release outputs | ||
run: | | ||
echo "::notice::${{ env.next_release }}" | ||
echo "::notice::${{ env.will_create_new_release }}" | ||
docker: | ||
name: Docker Release | ||
needs: semantic_release | ||
|
@@ -113,15 +133,6 @@ jobs: | |
name: charts | ||
path: ./charts | ||
|
||
- name: Extract new app version from Chart.yaml | ||
run: | | ||
chart_yaml_path="./charts/managed-identity-wallet/Chart.yaml" | ||
# Use grep to find the line containing appVersion, awk to split by ":" and cut to remove leading/trailing spaces | ||
app_version=$(grep 'appVersion:' "$chart_yaml_path" | awk -F: '{gsub(/^[ \t]+|[ \t]+$/,"", $2); print $2}') | ||
echo "RELEASE_VERSION=$app_version" >> $GITHUB_ENV | ||
# Create SemVer or ref tags dependent of trigger event | ||
- name: Docker meta | ||
id: meta | ||
|
@@ -134,9 +145,9 @@ jobs: | |
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}},value=${{ env.RELEASE_VERSION }} | ||
type=semver,pattern={{major}},value=${{ env.RELEASE_VERSION }} | ||
type=semver,pattern={{major}}.{{minor}},value=${{ env.RELEASE_VERSION }} | ||
type=semver,pattern={{version}},value=${{ needs.semantic_release.outputs.next_release }} | ||
type=semver,pattern={{major}},value=${{ needs.semantic_release.outputs.next_release }} | ||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.semantic_release.outputs.next_release }} | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | ||
- name: DockerHub login | ||
|
@@ -197,20 +208,12 @@ jobs: | |
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Extract new app version from Chart.yaml | ||
run: | | ||
chart_yaml_path="./charts/managed-identity-wallet/Chart.yaml" | ||
# Use grep to find the line containing appVersion, awk to split by ":" and gsub (awk) to remove leading/trailing spaces | ||
app_version=$(grep 'appVersion:' "$chart_yaml_path" | awk -F: '{gsub(/^[ \t]+|[ \t]+$/,"", $2); print $2}') | ||
echo "RELEASE_VERSION=$app_version" >> $GITHUB_ENV | ||
|
||
- name: Release chart | ||
if: github.event_name != 'pull_request' | ||
if: github.event_name != 'pull_request' && needs.semantic_release.outputs.will_create_new_release == 'true' | ||
run: | | ||
# Package MIW chart | ||
helm package -u -d helm-charts ./charts/managed-identity-wallet | ||
helm_package_path=$(helm package -u -d helm-charts ./charts/managed-identity-wallet | grep -o 'to: .*' | cut -d' ' -f2-) | ||
echo "HELM_PACKAGE_PATH=$helm_package_path" >> $GITHUB_ENV | ||
# Commit and push to gh-pages | ||
git add helm-charts | ||
|
@@ -224,6 +227,16 @@ jobs: | |
helm repo index . --merge index.yaml --url https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}/ | ||
git add index.yaml | ||
git commit -s -m "Release ${{ env.RELEASE_VERSION }}" | ||
git commit -s -m "Release ${{ needs.semantic_release.outputs.next_release }}" | ||
git push origin gh-pages | ||
- name: Upload chart to GitHub release | ||
if: github.event_name != 'pull_request' && needs.semantic_release.outputs.will_create_new_release == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_VERSION: ${{ needs.semantic_release.outputs.next_release }} | ||
HELM_PACKAGE_PATH: ${{ env.HELM_PACKAGE_PATH }} | ||
run: | | ||
echo "::notice::Uploading chart to GitHub release" | ||
gh release upload "v$RELEASE_VERSION" "$HELM_PACKAGE_PATH" |
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
Oops, something went wrong.