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

Change version checker to use rawURL instead of calling API #593

Merged
merged 2 commits into from
Sep 5, 2018

Conversation

syamgk
Copy link
Member

@syamgk syamgk commented Jul 23, 2018

Modify getLatestReleaseTag function to
fetch version using raw.github* URL

@syamgk syamgk mentioned this pull request Jul 23, 2018
@syamgk syamgk changed the title Change version check using API to rawURL Change version checker to use rawURL instead of calling API Jul 23, 2018
@surajnarwade
Copy link
Contributor

surajnarwade commented Jul 23, 2018

can we remove version from version.go and call that file instead of doing string magic on version.go
Reference: #122 (comment)

@cdrage
Copy link
Member

cdrage commented Jul 26, 2018

I don't know about this. The API implementation seems a lot cleaner than using raw URL's. APIs would (IMO) be more stable than relying on the raw URL.

How big is this library? I think we should just keep it in.

@kadel
Copy link
Member

kadel commented Jul 31, 2018

I don't know about this. The API implementation seems a lot cleaner than using raw URL's. APIs would (IMO) be more stable than relying on the raw URL.

How big is this library? I think we should just keep it in.

The problem is not about the library.
I would like to do it using GitHub Releases and its API, but the problem are unauthenticated API. They are pretty heavily rate limited. (60 requests per hour per IP) This is a big problem on a corporate network with NAT.

@kadel
Copy link
Member

kadel commented Jul 31, 2018

can we remove version from version.go and call that file instead of doing string magic on version.go
Reference: #122 (comment)

It might be better to have two separate values. Kepp version.go as it is and create new file called .latest-release that will contain just a number of latest released version. Minikube does something similar but they host this file in on GCloud and have all history of all releases there. https://github.com/kubernetes/minikube/blob/232080ae0cbcf9cb9a388eb76cc11cf6884e19c0/pkg/minikube/constants/constants.go#L112

Otherwise, there might be a problem when doing a release:
The current release process is:

  1. New PR is opened with updated versions.go, links and docs
  2. PR is merged
  3. New git tag is created to mark the version
  4. Travis builds binaries and uploads them to the Github release page

if we use the value from versions.go than the update checker will report that new version is available directly after step 2. "PR is merged" But it can take 30mins and more before all checks and tests are done and new release is created with binaries on github release page.

syamgk added a commit to syamgk/odo that referenced this pull request Aug 2, 2018
add file to track latest release version
as mentioned in redhat-developer#593 (comment)
syamgk added a commit to syamgk/odo that referenced this pull request Aug 2, 2018
add a file to track latest release version
as mentioned in redhat-developer#593 (comment)
@surajnarwade
Copy link
Contributor

I agree with @kadel
@syamgk instead of doing string magic on version.go, use .release or whatever file name which consist of only version

@syamgk
Copy link
Member Author

syamgk commented Aug 23, 2018

@surajnarwade yes that sounds good, am adding a file for tracking the latest version in PR #613

@surajnarwade
Copy link
Contributor

@syamgk I can't build binary from source:

go build -o odo ./main.go
# github.com/redhat-developer/odo/pkg/notify
pkg/notify/notify.go:34:10: cannot use s[0] (type byte) as type string in return argument

@@ -11,7 +11,7 @@ import (

const (
// URL to fetch latest version number
VersionFetchURL = "https://raw.githubusercontent.com/redhat-developer/odo/master/cmd/version.go"
VersionFetchURL = "https://raw.githubusercontent.com/redhat-developer/odo/master/build/VERSION"
Copy link
Member

Choose a reason for hiding this comment

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

👍

@syamgk
Copy link
Member Author

syamgk commented Aug 29, 2018

@surajnarwade can you try once now?

@surajnarwade
Copy link
Contributor

@syamgk,

$ cd odo-example/nodejs-ex/
[snarwade@redsuraj nodejs-ex]$ 
[snarwade@redsuraj nodejs-ex]$ odo create nodejs -v4
I0829 17:26:39.100469   23383 create.go:58] Component create called with args: "nodejs", flags: binary=, git=, local=
I0829 17:26:39.109923   23383 occlient.go:244] Trying to connect to server 192.168.42.169:8443 - %!v(MISSING)
I0829 17:26:39.110299   23383 occlient.go:250] Server https://192.168.42.169:8443 is up
I0829 17:26:39.125867   23383 occlient.go:227] isLoggedIn err:  <nil> 
 output: "developer"
I0829 17:26:39.177402   23383 application.go:171] Setting application app as current.
I0829 17:26:39.199608   23383 catalog.go:127] Found builder images: [{dotnet [2.0 latest]} {httpd [2.4 latest]} {nginx [1.10 1.12 1.8 latest]} {nodejs [0.10 4 6 8 latest]} {perl [5.16 5.20 5.24 latest]} {php [5.5 5.6 7.0 7.1 latest]} {python [2.7 3.3 3.4 3.5 3.6 latest]} {ruby [2.0 2.2 2.3 2.4 2.5 latest]} {wildfly [10.0 10.1 11.0 12.0 8.1 9.0 latest]}]
I0829 17:26:39.216273   23383 catalog.go:127] Found builder images: [{dotnet [2.0 latest]} {httpd [2.4 latest]} {nginx [1.10 1.12 1.8 latest]} {nodejs [0.10 4 6 8 latest]} {perl [5.16 5.20 5.24 latest]} {php [5.5 5.6 7.0 7.1 latest]} {python [2.7 3.3 3.4 3.5 3.6 latest]} {ruby [2.0 2.2 2.3 2.4 2.5 latest]} {wildfly [10.0 10.1 11.0 12.0 8.1 9.0 latest]}]
I0829 17:26:39.219208   23383 occlient.go:384] Checking for exact match of builderImage with ImageStream
I0829 17:26:39.229195   23383 occlient.go:395] Found exact image tag match for nodejs:latest
I0829 17:26:39.329618   23383 root.go:133] Error checking if newer odo release is available: unable to make semver from the latest release tag: 0.0.10

can you please look into this line:

I0829 17:26:39.329618   23383 root.go:133] Error checking if newer odo release is available: unable to make semver from the latest release tag: 0.0.10

Copy link
Contributor

@surajnarwade surajnarwade left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@syamgk
Copy link
Member Author

syamgk commented Aug 30, 2018

squashed and ready to merge now!

Modify getLatestReleaseTag function to
fetch version using raw.github* URL
Copy link
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Is there any way we can add a small test to getLatestReleaseTag? I think that function is pretty important since if it fails for any reason in the future, I'd error out Odo each time a user would fetch the newest release.

if err != nil {
return "", errors.Wrap(err, "error getting latest release")
}
return *release.TagName, nil
version_string := string(body)
version_string = strings.TrimSuffix(version_string, "\n")
Copy link
Member

Choose a reason for hiding this comment

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

this can be refactored to:

return strings.TrimSuffix(string(body), "\n"), nil

  + rephrase version tag stripping
@cdrage
Copy link
Member

cdrage commented Sep 4, 2018

Thanks for writing the test. If you can please re-base to latest master, that'd be great! After all tests have passed, this LGTM / can be merged.

Copy link
Contributor

@surajnarwade surajnarwade left a comment

Choose a reason for hiding this comment

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

LGTM && Merging 😃

@surajnarwade surajnarwade merged commit 2a19c67 into redhat-developer:master Sep 5, 2018
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.

None yet

5 participants