Skip to content

Conversation

savil
Copy link
Collaborator

@savil savil commented Apr 28, 2023

Summary

Motivation:
We want to disable auto-update for devbox CLIs. This will minimize unexpected interruptions for our users.

To do so, we are going to do the following:

  1. Update launch.sh file in axiom repo to write new versions to {XDG_CACHE_HOME}/devbox/available-version. https://github.com/jetpack-io/axiom/pull/3150
  2. Change devbox version update to update the launcher (if needed) and else, update the CLI binary. (this PR).
  3. Change the vercheck.CheckVersion that runs in boxcli/root.go on every command to check if the launcher or CLI binary versions are out-of-date, and to print a notice if so. (reviewed in [version] part 2: print notice if devbox CLI binary or launcher version is outdated #966, but merged into this PR)

We will cherry-pick these two PRs this PR for the next release so auto-update stops for users.

Implementation:
This PR enables jetpack version update to:

  1. Update the launcher: We detect if the launcher version is outdated, and update it, if needed. This also updates the devbox CLI binary as a side-effect. This requires sudo so we only do it, if necessary.

  2. Update just the devbox CLI binary: If the launcher is up-to-date, then we update just the devbox CLI binary.

  3. Remove dependency on new code like env package to minimize cherry-picking merge conflicts.

TODO:

  • confirm that we can switch the devbox version operation after an update to StdOut. I feel this is better so user is informed about the new version.
    cc @mikeland86 for the above question.

Will only land this after the launch.sh file is updated in https://github.com/jetpack-io/axiom/pull/3150

How was it tested?

Did some basic testing:

hardcoded true to ensure selfUpdateLauncher runs, and did devbox version update:

Screenshot 2023-05-01 at 8 57 46 PM

regular devbox version update
Screenshot 2023-05-01 at 8 48 20 PM

Copy link
Collaborator Author

savil commented Apr 28, 2023

@savil savil changed the title [update] update command for binary and launcher updates [version] part 1: update command for binary and launcher updates Apr 28, 2023
@savil savil force-pushed the savil/version-update branch 2 times, most recently from 6496558 to 2ac75ab Compare April 28, 2023 00:45
@savil savil requested a review from mikeland73 April 28, 2023 00:53
@savil savil marked this pull request as ready for review April 28, 2023 00:53
@savil savil requested review from gcurtis and ipince April 28, 2023 00:58
Copy link
Collaborator Author

@savil savil left a comment

Choose a reason for hiding this comment

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

update coming...

@savil savil force-pushed the savil/version-update branch 3 times, most recently from 3b96873 to 4e6147a Compare May 2, 2023 00:57
@savil
Copy link
Collaborator Author

savil commented May 2, 2023

Updated code, but need to test properly.

@savil savil force-pushed the savil/version-update branch 7 times, most recently from bb7a730 to be109ec Compare May 2, 2023 04:10
@savil savil requested review from mikeland73 and removed request for gcurtis and ipince May 2, 2023 04:12
@savil savil changed the title [version] part 1: update command for binary and launcher updates [version] part 1: update command for devbox and launcher updates May 2, 2023
@savil savil force-pushed the savil/version-update branch 2 times, most recently from 3c86906 to 2d0590d Compare May 2, 2023 17:30
if err != nil {
return nil, errors.WithStack(err)
}
cmd := exec.Command(exe, "version", "-v")
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly future hardening is adding --json

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that would be a good idea

@savil savil force-pushed the savil/version-update branch from 2d0590d to af4992b Compare May 2, 2023 18:58
@savil
Copy link
Collaborator Author

savil commented May 2, 2023

I'm going to merge #966 into this PR, prior to merging to main so there is one commit to cherrypick and possibly resolve conflicts with.

@savil savil force-pushed the savil/version-update branch from af4992b to 892040c Compare May 2, 2023 19:18
…on is outdated (#966)

## Summary

This PR updates the `vercheck.CheckVersion` to check launcher and devbox
CLI binary versions,
and print a notice if either is out-of-date.

I print the message in all yellow similar to flyctl. But open to other
renderings.

## How was it tested?

`go test -run TestCheckVersion ./internal/vercheck/...`


<img width="596" alt="Screenshot 2023-04-27 at 5 55 04 PM"
src="https://user-images.githubusercontent.com/676452/235029194-d7d43c2a-0905-49e4-b90e-2be99a5a1a51.png">

- [ ] TODO: I need to do more manual testing.
@savil savil merged commit 7ba3661 into main May 2, 2023
@savil savil deleted the savil/version-update branch May 2, 2023 19:41
savil added a commit that referenced this pull request May 2, 2023
**Motivation:**
We want to disable auto-update for devbox CLIs. This will minimize
unexpected interruptions for our users.

To do so, we are going to do the following:

1. Update `launch.sh` file in `axiom` repo to write new versions to
`{XDG_CACHE_HOME}/devbox/available-version`.
jetify-com/axiom#3150
2. Change `devbox version update` to update the launcher (if needed) and
else, update the CLI binary. (this PR).
3. Change the `vercheck.CheckVersion` that runs in `boxcli/root.go` on
every command to check if the launcher or CLI binary versions are
out-of-date, and to print a notice if so. (reviewed in #966, but merged
into this PR)

We will cherry-pick ~these two PRs~ this PR for the next release so
auto-update stops for users.

**Implementation:**
This PR enables `jetpack version update` to:

1. Update the launcher: We detect if the launcher version is outdated,
and update it, if needed. This also updates the devbox CLI binary as a
side-effect. This requires `sudo` so we only do it, if necessary.

2. Update just the devbox CLI binary: If the launcher is up-to-date,
then we update just the devbox CLI binary.

3. Remove dependency on new code like `env` package to minimize
cherry-picking merge conflicts.

TODO:
- [x] confirm that we can switch the `devbox version` operation after an
update to `StdOut`. I feel this is better so user is informed about the
new version.
cc @mikeland86 for the above question.

Will only land this after the launch.sh file is updated in
jetify-com/axiom#3150

Did some basic testing:

hardcoded `true` to ensure `selfUpdateLauncher` runs, and did `devbox
version update`:

<img width="742" alt="Screenshot 2023-05-01 at 8 57 46 PM"
src="https://user-images.githubusercontent.com/676452/235576315-03069599-a469-4f3a-90c2-cc6a58ec648a.png">

regular `devbox version update`
<img width="332" alt="Screenshot 2023-05-01 at 8 48 20 PM"
src="https://user-images.githubusercontent.com/676452/235575369-f2a70299-4a3a-4b41-80ec-ecedb730ad0b.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants