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

Add Zarf Version to CLI options #116

Merged
merged 7 commits into from
Oct 26, 2021
Merged

Add Zarf Version to CLI options #116

merged 7 commits into from
Oct 26, 2021

Conversation

YrrepNoj
Copy link
Contributor

Since the zarf binary can be passed around easily, it would be useful for people who know what version of the binary they have. zarf version will now display the latest tag and the specific commit sha it was built with.

This also updates the Makefile to store the version as a string within a variable.

cli/Makefile Outdated Show resolved Hide resolved
@RothAndrew
Copy link
Contributor

Taking a look. In the meantime can you:

  • Link the PR to the issue
  • Move the issue to "Now" in the roadmap

@RothAndrew
Copy link
Contributor

Should we update the General CLI E2E test to test this new command?

@YrrepNoj YrrepNoj linked an issue Oct 20, 2021 that may be closed by this pull request
@jeff-mccoy
Copy link
Contributor

Should we update the General CLI E2E test to test this new command?

Yes I think we should add a quick test for this to the E2E. Also curious if we want to use this version info at all, like embedded into the packaging on package create. This would make it easy later on to notify on version mismatches or even auto-embedding the zarf binary into a package for updates.

@YrrepNoj
Copy link
Contributor Author

Should we update the General CLI E2E test to test this new command?

Yes I think we should add a quick test for this to the E2E. Also curious if we want to use this version info at all, like embedded into the packaging on package create. This would make it easy later on to notify on version mismatches or even auto-embedding the zarf binary into a package for updates.

Just to make sure I'm reading this correct. I don't think you're saying "Is this really the version number we want to use" but I'm not entirely sure what you're saying.

Are you suggesting we also add the zarf version into a yaml that gets packaged into the SOME_PACKAGE.tar.zst?

@jeff-mccoy
Copy link
Contributor

jeff-mccoy commented Oct 20, 2021

Should we update the General CLI E2E test to test this new command?

Yes I think we should add a quick test for this to the E2E. Also curious if we want to use this version info at all, like embedded into the packaging on package create. This would make it easy later on to notify on version mismatches or even auto-embedding the zarf binary into a package for updates.

Just to make sure I'm reading this correct. I don't think you're saying "Is this really the version number we want to use" but I'm not entirely sure what you're saying.

Are you suggesting we also add the zarf version into a yaml that gets packaged into the SOME_PACKAGE.tar.zst?

Yeah that's just bad wording, sorry. What I was trying to say was. Is there some place we'd like to actually use this besides a user manually running zarf version. E.g. we could auto-inject the zarf version used to create the package under:

type ZarfBuildData struct {
	Terminal  string `yaml:"terminal"`
	User      string `yaml:"user"`
	Timestamp string `yaml:"timestamp"`
	// Version of zarf used to create the zarf package
	Version   string `yaml:"string"`
}

We could then (maybe in a new issue/PR) add a feature to check this version in the package against the current zarf binary version and warn users on errors.

@jeff-mccoy
Copy link
Contributor

This should be correct. During build you will have the git repo and pass the build flag with the tag to make the version. The binary copying will then already have the compiled build arg injected to show the version.

@YrrepNoj
Copy link
Contributor Author

/test all

@YrrepNoj
Copy link
Contributor Author

/test all

@YrrepNoj
Copy link
Contributor Author

/test all

@YrrepNoj
Copy link
Contributor Author

/test all

jeff-mccoy
jeff-mccoy previously approved these changes Oct 25, 2021
Copy link
Contributor

@jeff-mccoy jeff-mccoy left a comment

Choose a reason for hiding this comment

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

Great work, thanks for adding the e2e and struct change

Copy link
Contributor

@RothAndrew RothAndrew left a comment

Choose a reason for hiding this comment

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

See above comment

@RothAndrew
Copy link
Contributor

/test all

@jeff-mccoy
Copy link
Contributor

Yeah I missed the space in the test, but agree the style for buildtime injection is a good pattern as when we cut a tag it will also reflect that in the resultant artifact.

@jeff-mccoy jeff-mccoy merged commit aa7857b into master Oct 26, 2021
@jeff-mccoy jeff-mccoy deleted the feature/zarf-version branch October 26, 2021 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zarf binary tells me it's version
4 participants