-
Notifications
You must be signed in to change notification settings - Fork 67
Make GitHub Versioner configurable. #236
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
Conversation
pkg/update/versioner.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this 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.
pkg/update/versioner.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
f6bcc5a
to
50394dd
Compare
@phamann @triblondon looks like Viceroy team are happy with the file format used here and so are we unblocked on this PR now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 LGTM
50394dd
to
d1013c7
Compare
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
orversioner
to becliVersioner
so it's clearer what versioner instance is being referred to.The primary change is in
pkg/update/versioner.go