This is an automated email from the ASF dual-hosted git repository.
jibin pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-devlake-helm-chart.git
The following commit(s) were added to refs/heads/main by this push:
new 96d3fbd add lint scripts for check chart version (#55)
96d3fbd is described below
commit 96d3fbd62b06ee5884addb1ecd271a8bec9f7f50
Author: Ji Bin <[email protected]>
AuthorDate: Tue Nov 15 00:08:56 2022 +0800
add lint scripts for check chart version (#55)
- each merges to the main needs to promote the version if charts/ changed
- chart version should align with the app version
Signed-off-by: Ji Bin <[email protected]>
---
.github/workflows/lint-chart-versions.yml | 61 +++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/.github/workflows/lint-chart-versions.yml
b/.github/workflows/lint-chart-versions.yml
new file mode 100644
index 0000000..522a8a7
--- /dev/null
+++ b/.github/workflows/lint-chart-versions.yml
@@ -0,0 +1,61 @@
+name: Lint for chart versions
+on:
+ pull_request:
+ branches:
+ - main
+ paths:
+ - charts/**
+jobs:
+ check:
+ name: chart version change validation
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: install yq
+ run: echo yq should already in github ubuntu-latest
+ - name: chart version align with app version
+ run: |
+ set -e
+ chart_version_text=$(yq .version
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)
+ app_version_text=$(yq .appVersion
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)
+ chart_version_major=$(echo $chart_version_text | sed 's/v//;' | cut
-d. -f 1)
+ chart_version_minor=$(echo $chart_version_text | sed 's/v//;' | cut
-d. -f 2)
+ app_version_major=$(echo $app_version_text | sed 's/v//;' | cut -d.
-f 1)
+ app_version_minor=$(echo $app_version_text | sed 's/v//;' | cut -d.
-f 2)
+ if [[ "$chart_version_major" == "$app_version_major" &&
"$chart_version_minor" == "$app_version_minor" ]] ; then
+ echo version check for app and chart pass,
chart:$chart_version_text and app:$app_version_text
+ echo version check for app and chart pass,
chart:$chart_version_text and app:$app_version_text :green_heart: >>
$GITHUB_STEP_SUMMARY
+ else
+ echo chart version: $chart_version_text not align with app
version: $app_version_text
+ echo chart version: $chart_version_text not align with app
version: $app_version_text :broken_heart: >> $GITHUB_STEP_SUMMARY
+ exit 1
+ fi
+ - uses: actions/checkout@v3
+ with:
+ ref: main
+ - name: get base chart version
+ id: get-base-chart-version
+ run:
+ echo "CHART_VERSION=$(yq .version
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)" >> $GITHUB_OUTPUT
+ - uses: actions/checkout@v3
+ - name: chart version should be promoted
+ run: |
+ set -e
+ base_chart_version_text="${{
steps.get-base-chart-version.outputs.CHART_VERSION }}"
+ chart_version_text=$(yq .version
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)
+ chart_version_major=$(echo $chart_version_text | sed 's/v//;' | cut
-d. -f 1)
+ chart_version_minor=$(echo $chart_version_text | sed 's/v//;' | cut
-d. -f 2)
+ chart_version_patch=$(echo $chart_version_text | sed 's/v//;' | cut
-d. -f 3)
+ base_version_major=$(echo $base_chart_version_text | sed 's/v//;' |
cut -d. -f 1)
+ base_version_minor=$(echo $base_chart_version_text | sed 's/v//;' |
cut -d. -f 2)
+ base_version_patch=$(echo $base_chart_version_text | sed 's/v//;' |
cut -d. -f 3)
+ base_version=$(expr ${base_version_major} \* 1000000 +
${base_version_minor} \* 1000 + $base_version_patch)
+ chart_version=$(expr ${chart_version_major} \* 1000000 +
${chart_version_minor} \* 1000 + $chart_version_patch)
+ if [[ $chart_version > $base_version ]] ; then
+ echo chart version from $base_version to $chart_version
+ echo chart version from $base_version to $chart_version
:green_heart: >> $GITHUB_STEP_SUMMARY
+ else
+ echo chart version $chart_version_text is less or equal base
version $base_chart_version_text
+ echo chart version $chart_version_text is less or equal base
version $base_chart_version_text :broken_heart: >> $GITHUB_STEP_SUMMARY
+ exit 1
+ fi