Open elliotxx opened 1 month ago
I can take this if there is no urgency to complete this. I can work on it next week.
@rajeshkio Yeah, this issue is not very urgent, you can start when you are convenient.
I am confused. I do not see anything related to the helm chart in the current workflow; the helm chart has a different repo. So does the task include updating the Chart.yml in the helm chart repo?
@rajeshkio Ohh, I didn't make it clear. Chart repo is here.
The current workflow is as described in the issue, after each release, I manually update the version
and appVersion
in the chart repo, similar to this PR.
My idea is that after each release, this PR can be automatically generated through a github action (yaml-update-action is good), and maintainers only need to click merge
.
Example ( in release.yaml ):
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Bump version in the related HelmChart Chart.yaml
uses: fjogeleit/yaml-update-action@main
with:
repository: KusionStack/charts
valueFile: 'charts/karpor/Chart.yaml'
propertyPath: '{"version":"${{ steps.get_version.outputs.VERSION }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}'
value: ${{ steps.get_version.outputs.VERSION }}
branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }}
targetBranch: main
createPR: true
message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}'
token: ${{ secrets.GITHUB_TOKEN }}
workDir: .
Interesting. This would mean directly updating the version in the helm chart whenever there is a new image without considering if there are any changes in the helm chart repo. Also updating the appVersion in helm chart means we need to update the helm chart version as well, no?
@rajeshkio Yeah, as long as release has a new image, we can automatically generate a PR that only includes version bump. And just like you said, version
(chart version) and appVersion
(image version) need to be updated. We really need to consider how to update the version
, its target value is not easy to get. Let me see. 🤔
@rajeshkio I think of a way, it can obtain and automatically bump chart version:
- name: Get karpor version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Get new chart version
id: get-chart-version
run: |
helm repo add kusionstack https://kusionstack.github.io/charts
helm repo update
version=$(helm search repo kusionstack/karpor --versions | head -n 2 | tail -n 1 | awk '{print $2}')
echo "Current chart version is: $version"
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)
new_chart_version="${major}.${minor}.$((patch + 1))"
echo "New chart version is: $new_chart_version"
echo "::set-output name=new_chart_version::$new_chart_version"
- name: Bump version in the related HelmChart Chart.yaml
uses: fjogeleit/yaml-update-action@main
with:
repository: KusionStack/charts
valueFile: 'charts/karpor/Chart.yaml'
propertyPath: '{"version":"${{ steps.get-chart-version.outputs.new_chart_version }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}'
value: ${{ steps.get_version.outputs.VERSION }}
branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }}
targetBranch: main
createPR: true
message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}'
token: ${{ secrets.GITHUB_TOKEN }}
workDir: .
Bro, you have already done all the hard work. Now I just need to copy and update the release YAML
@rajeshkio Yeah, but I did not do any tests in the above yaml... and its verification and debug is also important!
Sure. I will try to complete it by the end of the week.
What would you like to be added?
Automatically update the appVersion in Chart when released.
Why is this needed?
The current release process is:
v0.4.5
appVersion
to the new version, such asv0.4.5
.We hope the 3 and 4 steps can be merged into the 2 step and automated together.