Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automatically update the appVersion in Chart when release new version #596

Conversation

rajeshkio
Copy link
Contributor

#547

What type of PR is this?

/kind feature

What this PR does / why we need it:

Governance: Automatically update the appVersion in the Chart when released

Which issue(s) this PR fixes:

Fixes #547

@rajeshkio rajeshkio changed the title Governance: Automatically update the appVersion in Chart when release… feat : Governance: Automatically update the appVersion in Chart when release… Aug 16, 2024
@rajeshkio
Copy link
Contributor Author

I have raised this PR to test the changes. I couldn't find a better way to test it.

@elliotxx
Copy link
Collaborator

Yeah, I know. I will test it with you.

@rajeshkio
Copy link
Contributor Author

Yeah, I know. I will test it with you.

Do you need to approve or something? Not seeing the workflow running.

@elliotxx elliotxx changed the title feat : Governance: Automatically update the appVersion in Chart when release… feat : automatically update the appVersion in Chart when release new version Aug 19, 2024
@elliotxx elliotxx changed the title feat : automatically update the appVersion in Chart when release new version feat: automatically update the appVersion in Chart when release new version Aug 19, 2024
@elliotxx
Copy link
Collaborator

@rajeshkio The pipeline need to be triggered by pushing a new tag. Let me test it.

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 }}"}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be modify to steps.get_chart_version.outputs.new_chart_version, otherwise the version cannot be obtained.

image

@elliotxx
Copy link
Collaborator

There is also a strange error:
Error: failed to create PR: Error: could not parse file with path: /home/runner/work/karpor/karpor/charts/karpor/Chart.yaml
https://github.com/KusionStack/karpor/actions/runs/10465960133/job/28982008775

@rajeshkio
Copy link
Contributor Author

Is there a way for me to test it without disturbing you?

@elliotxx
Copy link
Collaborator

elliotxx commented Aug 20, 2024

@rajeshkio You can push the alpha tag to trigger the Release pipeline, just like this 👇. But I'm not sure if this will take effect in the fork repository.

image

@elliotxx
Copy link
Collaborator

There is also a strange error: Error: failed to create PR: Error: could not parse file with path: /home/runner/work/karpor/karpor/charts/karpor/Chart.yaml https://github.com/KusionStack/karpor/actions/runs/10465960133/job/28982008775

I think I know what this error is about. It need to first use checkout action to clone the charts repository locally.

image

You can reference to: https://github.com/fjogeleit/yaml-update-action?tab=readme-ov-file#advanced-example-with-an-separate-target-repository

@rajeshkio
Copy link
Contributor Author

Thank you. Today I am a bit busy with office stuff. I will check it soon.

@elliotxx
Copy link
Collaborator

Yeah, If you need help, please ping me anytime.

@elliotxx
Copy link
Collaborator

Hi, I re-triggered the pipeline and found a new problem:

image

It seems that we should replace propertyPath with changes here:

image

@rajeshkio
Copy link
Contributor Author

Thank you, but I need a concrete way to test it myself. This is not good, depending on you to find the problem and me just updating the code.

@elliotxx
Copy link
Collaborator

@rajeshkio Yeah, I know. The pipeline is triggered by tags. Have you tried pushing tags (such as v0.4.11-alpha.1) to your fork repository to see if the pipeline can be triggered.

@rajeshkio
Copy link
Contributor Author

Do you mean git tag? I will try with the change

@rajeshkio
Copy link
Contributor Author

I think it won't work with the fork repo. It didn't get the docker credentials

Run docker/login-action@v2
with:
ecr: auto
logout: true
Error: Username and password required

@elliotxx
Copy link
Collaborator

@rajeshkio OK, It seems that the pipeline can be triggered in the fork repository, and unrelated jobs can be deleted. Just keep the update-chart step.

@rajeshkio
Copy link
Contributor Author

Sorry bit new to this workflow. You are saying for testing I can remove unrelated jobs and only keep the steps I need in .github/workflows/release.yaml? After testing revert back all the jobs?

@elliotxx
Copy link
Collaborator

@rajeshkio Yes, just for testing.

@rajeshkio
Copy link
Contributor Author

rajeshkio commented Aug 28, 2024

Now it fails with httpError. I am doubting I GITHUB_TOKEN is available while running through fork repo. Can you test and let me know?

Run fjogeleit/yaml-update-action@main
with:
repository: KusionStack/charts
valueFile: charts/karpor/Chart.yaml
changes: {"version":"0.6.6", "appVersion":"v0.4.18-alpha.1"}
value: v0.4.18-alpha.1
branch: bump-karpor-to-v0.4.18-alpha.1
targetBranch: master
createPR: false
message: refactor: bump karpor version to v0.4.18-alpha.1
token: ***
workDir: charts
noCompatMode: false
quotingType: '
force: false
masterBranchName: master
githubAPI: https://api.github.com
commitChange: true
updateFile: false
labels: yaml-updates
commitUserName: github-actions[bot]
commitUserEmail: 41898282+github-actions[bot]@users.noreply.github.com
env:
GO_RELEASER_CONFIG: .goreleaser-dev.yml
Error: failed to create PR: HttpError: Resource not accessible by integration

@elliotxx
Copy link
Collaborator

@rajeshkio Yeah, let me try.

@elliotxx
Copy link
Collaborator

@rajeshkio I also encountered the same problem, maybe it's related to this:

image

Can you modify the target branch to chart-version-updater? Then I merged this PR, so that we can debug it in the upstream repo.

@rajeshkio rajeshkio force-pushed the automatically-update-chart-version branch from 6437ccd to 19b7738 Compare August 28, 2024 08:25
@rajeshkio
Copy link
Contributor Author

@rajeshkio I also encountered the same problem, maybe it's related to this:

image

Can you modify the target branch to chart-version-updater? Then I merged this PR, so that we can debug it in the upstream repo.

Done

@elliotxx elliotxx changed the base branch from main to chart-version-updater August 28, 2024 09:14
Copy link
Collaborator

@elliotxx elliotxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@elliotxx elliotxx merged commit 1e557f0 into KusionStack:chart-version-updater Aug 28, 2024
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Governance: Automatically update the appVersion in Chart when released
2 participants