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

genpolicy: add --version flag #176

Merged
merged 1 commit into from
Apr 17, 2024
Merged

Conversation

Redent0r
Copy link

@Redent0r Redent0r commented Apr 15, 2024

Add a --version flag to the genpolicy tool that prints the current version

Merge Checklist
  • Followed patch format from upstream recommendation: https://github.com/kata-containers/community/blob/main/CONTRIBUTING.md#patch-format
    • Included a single commit in a given PR - at least unless there are related commits and each makes sense as a change on its own.
  • Aware about the PR to be merged using "create a merge commit" rather than "squash and merge" (or similar)
  • genPolicy only: Ensured the tool still builds on Windows
  • genPolicy only: Updated sample YAMLs' policy annotations, if applicable
  • The upstream-missing label (or upstream-not-needed) has been set on the PR.
Summary

Add --version flag

`
$ target/debug/genpolicy -v

Kata Containers policy tool (Rust): id: genpolicy, version: 3.2.0-azl0.genpolicy1, commit: ffc72e5
`

dev: instead of cargo build, we'd use LIBC=gnu BUILD_TYPE= make (cargo build still works, but you'll need to use LIBC=gnu BUILD_TYPE= make the first time at least to generate version.rs and not get a compile error)

release: instead of cargo build --release, we'd use LIBC=gnu make (Here we'll want to stick to LIBC=gnu make as this will embed the correct commit information to release binary)

Make build method is incompatible on Windows. For Windows releases:

  • set src/version.rs with correct commit info
  • cargo build --release

@Redent0r Redent0r added the upstream/missing PRs that are yet to be upstreamed label Apr 15, 2024
@sprt
Copy link
Collaborator

sprt commented Apr 16, 2024

Also to update the release process in the wiki to bump the version number.

@Redent0r Redent0r force-pushed the saulparedes/add_version_flag branch from ffc72e5 to 18485ae Compare April 16, 2024 20:17
@Redent0r
Copy link
Author

Just force pushed following changes:

  • Added commit info to version
  • Separated build and release recipes. Then we can use make/make build for dev and make release when doing release, which seems more straightforward than using a unified recipe
  • Added license to Cargo.toml

@Redent0r Redent0r force-pushed the saulparedes/add_version_flag branch 2 times, most recently from 041e9be to b3901b1 Compare April 16, 2024 23:49
@Redent0r Redent0r marked this pull request as ready for review April 16, 2024 23:52
@Redent0r Redent0r requested review from a team as code owners April 16, 2024 23:52
@Redent0r Redent0r requested review from danmihai1 and sprt April 16, 2024 23:53
Copy link
Collaborator

@sprt sprt left a comment

Choose a reason for hiding this comment

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

A couple comments. Also shouldn't we rather create this PR upstream?

@Redent0r Redent0r force-pushed the saulparedes/add_version_flag branch 2 times, most recently from 410ca1a to 070d7e1 Compare April 17, 2024 19:27
- Add --version flag to the genpolicy tool that prints the current
version
- Add version.rs.in template to store the version information
- Update makefile to autogenerate version.rs from version.rs.in
- Add license to Cargo.toml

Signed-off-by: Saul Paredes <[email protected]>
@Redent0r Redent0r force-pushed the saulparedes/add_version_flag branch from 070d7e1 to a067b65 Compare April 17, 2024 22:47
@Redent0r
Copy link
Author

Addressed feedback and corrected commit message

@Redent0r Redent0r merged commit b0a632c into msft-main Apr 17, 2024
42 of 54 checks passed
@Redent0r Redent0r deleted the saulparedes/add_version_flag branch April 17, 2024 23:00
@Redent0r Redent0r added upstream/merged PRs that have been merged upstream and removed upstream/missing PRs that are yet to be upstreamed labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream/merged PRs that have been merged upstream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants