-
Notifications
You must be signed in to change notification settings - Fork 991
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
runtime: make kata-check check for newer release #735
runtime: make kata-check check for newer release #735
Conversation
/test |
84410f5
to
43f0328
Compare
This won't work for 2.0 yet as we haven't made any releases: $ ./kata-runtime kata-check --verbose
INFO[0000] IOMMUPlatform is disabled by default.
INFO[0000] arch=amd64 current-version=2.0.0-alpha3 name=kata-runtime pid=21324 source=runtime
No releases available ... But you can test how it would work for Kata 1.x by setting the $ KATA_RELEASE_URL=https://api.github.com/repos/kata-containers/runtime/releases/latest ./kata-runtime kata-check --verbose
INFO[0000] IOMMUPlatform is disabled by default.
INFO[0000] arch=amd64 current-version=2.0.0-alpha3 latest-version=1.11.3 name=kata-runtime pid=21336 source=runtime
No newer release available for download Notice the |
@jodh-intel, first of all, patch itself looks good, thanks for working on this one! Shall we ensure only official releases are used? If so, we could do that by enforcing a URL check and aborting if the URL doesn't point to the official repos. |
43f0328
to
a92af46
Compare
@fidencio - agreed and fixed 😄 |
$ KATA_RELEASE_URL=https://google.com ./kata-runtime kata-check
INFO[0000] IOMMUPlatform is disabled by default.
ERRO[0000] release URL "https://google.com" does not have expected prefix: "https://api.github.com/repos/kata-containers" arch=amd64 name=kata-runtime pid=24115 source=runtime
release URL "https://google.com" does not have expected prefix: "https://api.github.com/repos/kata-containers"
$ echo $?
1 |
/test |
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!
Thanks, @jodh-intel!
src/runtime/cli/kata-check.go
Outdated
projectAPIURLPrefix = "https://api.github.com/repos/kata-containers" | ||
|
||
// URL used to determine latest release | ||
defaultReleaseURL = projectAPIURLPrefix + "/kata-containers/releases/latest" |
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.
Marking as dnm for now since this isn't reliable - the "latest" release is simply the most recently uploaded release! The correct solution is to look through all releases, sort by semver and find the newest from that.
Thanks @jcvenegas for pointing this out!
a92af46
to
59598e7
Compare
Thanks for reviewing @fidencio - I've just updated the branch quite a lot if you want to take another look? /test |
641b7fb
to
547b3d9
Compare
/test |
@GabyCT, @lifupan - the clh CI is failing - looks like we might need to source
|
Update `kata-check` to see if there is a newer version available for download. Useful for users installing static packages (without a package manager). Fixes: kata-containers#734. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
547b3d9
to
1a77f69
Compare
Example behaviour:
Newly expanded $ ./kata-runtime kata-check --help
NAME:
kata-runtime kata-check - tests if system can run Kata Containers
USAGE:
kata-runtime kata-check [command options] [arguments...]
DESCRIPTION:
tests if system can run Kata Containers and version is current.
ENVIRONMENT VARIABLES:
- KATA_CHECK_NO_NETWORK: If set to any value, act as if "--no-network-checks" was specified.
EXAMPLES:
- Perform basic checks:
$ kata-runtime kata-check
- Local basic checks only:
$ kata-runtime kata-check --no-network-checks
- Perform further checks:
$ sudo kata-runtime kata-check
- Just check if a newer version is available:
$ kata-runtime kata-check --check-version-only
- List available releases (shows output in format "version;release-date;url"):
$ kata-runtime kata-check --only-list-releases
- List all available releases (includes pre-release versions):
$ kata-runtime kata-check --only-list-releases --include-all-releases
OPTIONS:
--check-version-only Only compare the current and latest available versions (requires network, non-root only)
--include-all-releases Don't filter out pre-release release versions
--no-network-checks, -n Do not run any checks using the network
--only-list-releases Only list newer available releases (non-root only)
--strict, -s perform strict checking
--verbose, -v display the list of checks performed |
/test |
Looks even better now! You already have my lgtm, thanks for working on this! |
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.
thanks @jodh-intel
This PR does change the behaviour of Note the following:
Given all that, I'm going to merge this... |
Fix the linter errors caught in the `runtime` repos `master` branch [1], but not in the `2.0-dev` branch [2]. See [3] for further details. [1] - kata-containers/runtime#2976 [2] - kata-containers#735 [3] - kata-containers/tests#2870 Fixes: kata-containers#783. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Fix the linter errors caught in the `runtime` repos `master` branch [1], but not in the `2.0-dev` branch [2]. See [3] for further details. [1] - kata-containers/runtime#2976 [2] - kata-containers#735 [3] - kata-containers/tests#2870 Fixes: kata-containers#783. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Fix the linter errors caught in the `runtime` repos `master` branch [1], but not in the `2.0-dev` branch [2]. See [3] for further details. [1] - kata-containers/runtime#2976 [2] - #735 [3] - kata-containers/tests#2870 Fixes: #783. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Fix the linter errors caught in the `runtime` repos `master` branch [1], but not in the `2.0-dev` branch [2]. See [3] for further details. [1] - kata-containers/runtime#2976 [2] - #735 [3] - kata-containers/tests#2870 Fixes: #783. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Fix the linter errors caught in the `runtime` repos `master` branch [1], but not in the `2.0-dev` branch [2]. See [3] for further details. [1] - kata-containers/runtime#2976 [2] - kata-containers#735 [3] - kata-containers/tests#2870 Fixes: kata-containers#783. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Update
kata-check
to see if there is a newer version available for download. Useful for users installing static packages (without a package manager).Fixes: #734.
Signed-off-by: James O. D. Hunt james.o.hunt@intel.com