This is an automated email from the ASF dual-hosted git repository.
warren 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 a8cebd0 check app and chart versions (#69)
a8cebd0 is described below
commit a8cebd0a2b6d71e894427007995ff7e155980945
Author: Ji Bin <[email protected]>
AuthorDate: Tue Feb 21 13:02:35 2023 +0800
check app and chart versions (#69)
- appVersion in Chart.yaml need equals image tag in values.yaml
- appVersion should equal version in Chart.yaml
- version in Chart.yaml should be always increased
Signed-off-by: Ji Bin <[email protected]>
---
.github/workflows/lint-chart-and-app-versions.yml | 78 +++++++++++++++++++++++
.github/workflows/lint-chart-versions.yml | 61 ------------------
.github/workflows/lint-image-chart-versions.yml | 26 --------
3 files changed, 78 insertions(+), 87 deletions(-)
diff --git a/.github/workflows/lint-chart-and-app-versions.yml
b/.github/workflows/lint-chart-and-app-versions.yml
new file mode 100644
index 0000000..4a78521
--- /dev/null
+++ b/.github/workflows/lint-chart-and-app-versions.yml
@@ -0,0 +1,78 @@
+name: Lint for chart versions
+on:
+ pull_request:
+ branches:
+ - main
+ paths:
+ - charts/**
+jobs:
+ check_chart_version_matches_app_version:
+ name: chart version matches app version
+ 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)
+ if [[ "v$chart_version_text" == "$app_version_text" ]] ; 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
+ check_chart_version_should_be_increased:
+ name: char version should be increased
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: ${{ github.base_ref }}
+ - 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
+ with:
+ ref: ${{ github.ref }}
+ - 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)
+ pip3 install semver
+ if python3 -c "from semver import VersionInfo as vi ;
vi.parse('${chart_version_text}')" ; then
+ echo "version ${chart_version_text} is a valid version string"
:green_heart: >> $GITHUB_STEP_SUMMARY
+ else
+ echo "version ${chart_version_text} is not a valid version string"
:broken_heart: >> $GITHUB_STEP_SUMMARY
+ exit 1
+ fi
+ if python3 -c "from semver import VersionInfo as vi ; assert
vi.parse('${chart_version_text}') > vi.parse('${base_chart_version_text}')" ;
then
+ echo "version ${chart_version_text} > ${base_chart_version_text}"
:green_heart: >> $GITHUB_STEP_SUMMARY
+ else
+ echo "version ${chart_version_text} <= ${base_chart_version_text}"
:broken_heart: >> $GITHUB_STEP_SUMMARY
+ exit 1
+ fi
+ check_image_version_matches_app_version:
+ name: image vesion matches app version
+ 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 image version
+ run: |
+ set -e
+ app_version_text=$(yq .appVersion
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)
+ image_version_text=$(yq .imageTag
${GITHUB_WORKSPACE}/charts/devlake/values.yaml)
+ if [[ $app_version_text != $image_version_text ]] ; then
+ echo chart version $app_version_text is not equal to image tag
$image_version_text :broken_heart: >> $GITHUB_STEP_SUMMARY
+ exit 1
+ else
+ echo all images version are equal to app version :green_heart: >>
$GITHUB_STEP_SUMMARY
+ fi
diff --git a/.github/workflows/lint-chart-versions.yml
b/.github/workflows/lint-chart-versions.yml
deleted file mode 100644
index 4253e90..0000000
--- a/.github/workflows/lint-chart-versions.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-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 $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
- else
- echo chart version from $base_version to $chart_version
- echo chart version from $base_version to $chart_version
:green_heart: >> $GITHUB_STEP_SUMMARY
- fi
diff --git a/.github/workflows/lint-image-chart-versions.yml
b/.github/workflows/lint-image-chart-versions.yml
deleted file mode 100644
index b57ba2f..0000000
--- a/.github/workflows/lint-image-chart-versions.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: validate image and chart version
-on:
- pull_request:
- branches:
- - main
- paths:
- - charts/**
-jobs:
- check:
- name: validate image and chart version
- 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 image version
- run: |
- set -e
- chart_version_text=$(yq .version
${GITHUB_WORKSPACE}/charts/devlake/Chart.yaml)
- image_version_text=$(yq .imageTag
${GITHUB_WORKSPACE}/charts/devlake/values.yaml)
- if [[ v$chart_version_text != $image_version_text ]] ; then
- echo chart version $chart_version_text is not equal to devlake
version $image_version_text
- exit 1
- else
- echo all images version are equal to chart version
- fi