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

Make GitHub Versioner configurable. #236

Merged
merged 2 commits into from Mar 29, 2021

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 25, 2021

Problem: We want to start integrating a new binary for local testing, which will be published as a public GitHub release, but the current Versioner type has hardcoded references to the CLI binary.

Notes: Because in future there will be two instances of a Versioner type in the code, I decided it best to rename all references to the variable v or versioner to be cliVersioner so it's clearer what versioner instance is being referred to.

The primary change is in pkg/update/versioner.go

@Integralist Integralist requested review from phamann, a team, triblondon and cratelyn and removed request for a team March 25, 2021 18:19
@Integralist Integralist added the enhancement New feature or request label Mar 25, 2021
@@ -135,7 +139,7 @@ func (g GitHub) getReleaseID(ctx context.Context, version semver.Version) (id in
}

func (g GitHub) getAssetID(assets []github.ReleaseAsset, version semver.Version) (id int64, err error) {
target := fmt.Sprintf("fastly_v%s_%s-%s.tar.gz", version, runtime.GOOS, runtime.GOARCH)
target := fmt.Sprintf("%s_v%s_%s-%s.tar.gz", g.org, version, runtime.GOOS, runtime.GOARCH)
Copy link
Contributor

Choose a reason for hiding this comment

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

fastly here is possibly not a github org

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, fastly in this context is the name of the binary program not the org. This is also applicable to many references above in the LatestVersion() method above, thus similar comments have been elided.

Furthermore, the filename pattern fastly_v0.26.2_linux-amd64.tar.gz is tightly coupled to the CLI release implementation and thus very opinionated and might not be the pattern that Viceroy or other future binaries use. Easy option is we ensure Viceroy uses this pattern or we will have to give some thought and refactoring as to how we generate the asset filename.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cratelyn 👋🏻 would you be able to offer any insights here ^^ re: filename pattern. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this filename pattern sounds okay to me. Using semantic versioning would be fine, and putting a target/arch at the end is definitely worthwhile. No objections here!

Copy link
Member

@phamann phamann left a comment

Choose a reason for hiding this comment

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

Per the inline discussion, I think we need to put more thought into how the filenames are constructed to be forwards compatible.

Personal preference/opinion, but I also found the renaming of a local variable s/versioner/cliVersioner/g unnecessary and made the review harder than it needed to be.

@@ -135,7 +139,7 @@ func (g GitHub) getReleaseID(ctx context.Context, version semver.Version) (id in
}

func (g GitHub) getAssetID(assets []github.ReleaseAsset, version semver.Version) (id int64, err error) {
target := fmt.Sprintf("fastly_v%s_%s-%s.tar.gz", version, runtime.GOOS, runtime.GOARCH)
target := fmt.Sprintf("%s_v%s_%s-%s.tar.gz", g.org, version, runtime.GOOS, runtime.GOARCH)
Copy link
Member

Choose a reason for hiding this comment

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

Agreed, fastly in this context is the name of the binary program not the org. This is also applicable to many references above in the LatestVersion() method above, thus similar comments have been elided.

Furthermore, the filename pattern fastly_v0.26.2_linux-amd64.tar.gz is tightly coupled to the CLI release implementation and thus very opinionated and might not be the pattern that Viceroy or other future binaries use. Easy option is we ensure Viceroy uses this pattern or we will have to give some thought and refactoring as to how we generate the asset filename.

@Integralist Integralist force-pushed the integralist/20210325_configure_versioner branch from f6bcc5a to 50394dd Compare March 26, 2021 11:35
@Integralist
Copy link
Collaborator Author

@phamann @triblondon looks like Viceroy team are happy with the file format used here and so are we unblocked on this PR now?

Copy link
Member

@phamann phamann left a comment

Choose a reason for hiding this comment

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

👍🏻 LGTM

@Integralist Integralist force-pushed the integralist/20210325_configure_versioner branch from 50394dd to d1013c7 Compare March 29, 2021 14:26
@Integralist Integralist merged commit d1dd34c into master Mar 29, 2021
@Integralist Integralist deleted the integralist/20210325_configure_versioner branch March 29, 2021 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants