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 calculate the current version number through Git… #544

Merged

Conversation

rajeshkio
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Automates versioning and updates pkg/version/VERSION file

Which issue(s) this PR fixes:

Fixes #537

Copy link

github-actions bot commented Jul 25, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@rajeshkio
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@rajeshkio
Copy link
Contributor Author

recheck

@rajeshkio rajeshkio force-pushed the automatically-calculate-current-version branch from 67924ec to a7968c4 Compare July 25, 2024 17:37
@rajeshkio rajeshkio force-pushed the automatically-calculate-current-version branch from a7968c4 to 793d00c Compare July 25, 2024 17:42
@SparkYuan
Copy link
Member

@rajeshkio Welcome to join our community. Here is our slack

@rajeshkio rajeshkio changed the title feat: Automatically calculate the current version number through Git… feat: Automatically calculate the current version number through Git… Jul 26, 2024
@elliotxx
Copy link
Collaborator

@rajeshkio Nice! It seems to be able to automatically calculate the current version number, but, the make command still needs to be manually executed before each release. So I am thinking about how to integrate it in the release pipeline. Maybe we need to add a hook to the .goreleaser.yml. Do you have any good ideas?

@rajeshkio
Copy link
Contributor Author

rajeshkio commented Jul 26, 2024

sure. Let me see. I thought it will do the make call internally.

@elliotxx
Copy link
Collaborator

elliotxx commented Jul 26, 2024

@rajeshkio You can refer to this configuration: https://github.com/elliotxx/go-web-template/blob/master/.goreleaser.yml#L7

But this can only ensure that the version in the Image is correct and cannot guarantee that go install can get the correct version number.

@rajeshkio
Copy link
Contributor Author

rajeshkio commented Jul 26, 2024

make sense to hook it just after go mod tidy?

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
- go run pkg/version/scripts/gen/gen.go

@rajeshkio
Copy link
Contributor Author

@rajeshkio You can refer to this configuration: https://github.com/elliotxx/go-web-template/blob/master/.goreleaser.yml#L7

But this can only ensure that the version in the Image is correct and cannot guarantee that go install can get the correct version number.

This is interesting. Something I have never experienced. Can I test it locally?

@elliotxx
Copy link
Collaborator

elliotxx commented Jul 26, 2024

@rajeshkio You can refer to this configuration: https://github.com/elliotxx/go-web-template/blob/master/.goreleaser.yml#L7
But this can only ensure that the version in the Image is correct and cannot guarantee that go install can get the correct version number.

This is interesting. Something I have never experienced. Can I test it locally?

Of course, this is some ways to test this case locally:

You can compare the different version numbers they generate.

@elliotxx
Copy link
Collaborator

make sense to hook it just after go mod tidy?

before: hooks: # You may remove this if you don't use go modules. - go mod tidy - go run pkg/version/scripts/gen/gen.go

Yes, this hook ensures that the gen script is executed to update the version number before the go build.

@elliotxx
Copy link
Collaborator

elliotxx commented Jul 26, 2024

Maybe we don't need to consider go install for the time being. This is just considered for the future Standalone installation mode (such as homebrew, scoop, go install). #240

@rajeshkio
Copy link
Contributor Author

Maybe we do n’t need to consider go install for the time being. This is just considered for the future Standalone installation mode (such as homebrew, scoop, go install).

okay. Your decision. I am not well aware of this. If it can be ignored for now, we can create another issue for this, assigned to me, and I can work on it separately.

@rajeshkio
Copy link
Contributor Author

make sense to hook it just after go mod tidy?
before: hooks: # You may remove this if you don't use go modules. - go mod tidy - go run pkg/version/scripts/gen/gen.go

Yes, this hook ensures that the gen script is executed to update the version number before the go build.

added.

@rajeshkio
Copy link
Contributor Author

@elliotxx Let me know if anything is pending from my side

@elliotxx
Copy link
Collaborator

@rajeshkio You have done a good job, I just have no time to do full test. But I thought about it, this it doesn't matter. We are the trunk-based development mode, there will be a full test before the official version is released.

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 8c2f265 into KusionStack:main Jul 29, 2024
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2024
@elliotxx elliotxx added area/server Server related. governance labels Jul 29, 2024
@elliotxx elliotxx added this to the v0.5.0 milestone Jul 29, 2024
@elliotxx
Copy link
Collaborator

@rajeshkio Welcome to become a project contributor! #552 Looking forward to more communication between us 🍻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Governance: Automatically calculate the current version number through Git
3 participants