-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Checking for updates #31
Conversation
ecf49fe
to
2a7dafd
Compare
LOL, sure, I will do it this weekend. |
thanks @dborzov :) also, @inconshreveable made this: https://github.com/inconshreveable/go-update which could be pretty useful. I think though that for that sort of update, it should:
|
@jbenet go-update has built-in support for signing and validating releases |
@inconshreveable oh great! i somehow missed that, thanks 👍 |
609a71b
to
5fafaa4
Compare
2583167
to
1e70e7e
Compare
Hey, so I am halfway through the rebase. The key changes:
|
Will try to use go-update for the actual updating. Maybe in a separate pull-request? |
I think the best place for any code relating to the updating (CheckForUpdates()) should live in its own package, maybe in the root as "updates" or in "config/updates" |
@dborzov all this sgtm.
This is a fine place for now. Later on it can be in different common location for the
Agreed. i'd go for |
@@ -129,6 +129,12 @@ func initCmd(c *commander.Command, inp []string) error { | |||
}, | |||
} | |||
|
|||
// tracking ipfs version used to generate the init folder and adding update checker default setting. | |||
cfg.Updates = config.Updates{ | |||
Check: "error", |
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.
maybe these values ("error"
, "ignore"
, etc) should be constants in the update package:
const CheckError = "error"
const CheckIgnore = "ignore"
...
@whyrusleeping , @jbenet thanks for the feedback and CR. I updated the thing with all the changes you suggested. |
Being able to actually update |
@@ -58,7 +60,8 @@ Use "ipfs help <command>" for more information about a command. | |||
func init() { | |||
config, err := config.PathRoot() | |||
if err != nil { | |||
config = "" | |||
u.POut("Failure initializing the default Config Directory: ", err) | |||
os.Exit(1) |
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.
@dborzov this should probably not fail if the -c
flag is provided to a run, which we don't know about here. I'll leave this in for now, until the -c
flag works throughout commands. (doesn't atm i think)
// Version regulates checking if the most recent version is run | ||
type Version struct { | ||
Check string `json:"check"` // "ignore" for do not check, "warn" and "error" for reacting when obsolete | ||
Current string `json:"current"` // ipfs version for which config was generated |
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.
should we lowercase all config var names? the capitalized json is certainly odd-looking, but more admittedly more readable
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.
Will remove the lower case tags for now for consistency.
Not to bikeshed over this too much, but the obvious future for config files format is probably toml and we will need to adopt it at some point IMHO.
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 love all cases equally, i dont discriminate.
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.
Also, you dont have to specify the lower case tag names, if your struct field is "Test" and in json its "test", go figures it out just fine.
@dborzov sorry for extra comments after you thought we were all set! but i think these will help the UX of the updates. |
* master: (107 commits) bugfixes to prev commit u.DOut -> log.Debug fixed resolver test ipfs name cmd improvements Skip ipns_test.TestMultiWrite in darwin skip ipns fuse tests in travis add another test to try and reproduce data loss issue add in some extra debug logging, and increase routing table latencies comment out debug msg use encoded (pretty) keys only on fs ds make vendor is your friend keytransform ds Rework package structure for unixfs and subpackage update error handling in ipns add more comments! vendor things New NameSystem interface deprecate merkledag.Node.Update ipns TestFastRepublish init SetupLoggers ... Conflicts resolved: cmd/ipfs/gen.go cmd/ipfs/ipfs.go config/config.go
…P request time delay
@jbenet ok, added these changes too |
@dborzov ok, everything LGTM! thank you! I'll handle this merge later today, as tests failing, etc. |
Merged in 16b5345 |
Thank you @dborzov! |
feat: add a test server
This PR makes
ipfs
reach the Github API endpoint for the list of this repo's git tags on every run. It then attempts to read the tag names assemver
version labels and compares them to the running one (defined as aVersion
const literal incmd/ipfs/version.go
).If the running version is older than the most recent available, the error message is shown (suggesting strongly to update) and the program exits.
This behaviour can be changed with
updates.check
flag in the config file.ignore
andwarn
values are supported.Please also note the related issue.