feat(BRE2-810): sudo gating, brev upgrade#320
Merged
Conversation
b0d324f to
16ab265
Compare
drewmalin
previously approved these changes
Mar 9, 2026
|
|
||
| const ( | ||
| // StatusRoot means the process is already running as root. | ||
| StatusRoot Status = iota |
Contributor
There was a problem hiding this comment.
Personal nitpick but I don't love iota as it ties data to the syntax of the code (if we ever change the order of these values, the Status integer value will change).
|
|
||
| const ( | ||
| // InstallMethodDirect means brev was installed via direct binary download. | ||
| InstallMethodDirect InstallMethod = iota |
| return fmt.Errorf("could not find release for %s/%s", osName, arch) | ||
| } | ||
| // Trim trailing newline | ||
| downloadURL = downloadURL[:len(downloadURL)-1] |
Contributor
There was a problem hiding this comment.
Is this newline guaranteed to be there?
Contributor
Author
There was a problem hiding this comment.
rewrote to use script instead
| downloadURL = downloadURL[:len(downloadURL)-1] | ||
|
|
||
| // Create temp directory | ||
| tmpDir, err := os.MkdirTemp("", "brev-upgrade-*") |
Contributor
Author
There was a problem hiding this comment.
apparently this controls where the random string goes. By default it gets appended, removing.
|
|
||
| // Install with sudo | ||
| brevPath := filepath.Join(tmpDir, "brev") | ||
| t.Vprint("Installing to /usr/local/bin/brev...") |
Contributor
There was a problem hiding this comment.
Nit: could throw /usr/local/bin/brev into a const
| if err != nil { | ||
| t.Fatalf("Exists error: %v", err) | ||
| exists, eerr := regStore.Exists() | ||
| if eerr != nil { |
Contributor
There was a problem hiding this comment.
Changing err to eerr seems unnecessary here
theFong
requested changes
Mar 9, 2026
| return upgradeViaDirect(t, deps) | ||
| default: | ||
| return fmt.Errorf("unknown install method") | ||
| } |
Member
There was a problem hiding this comment.
Can we also install the latest skill?
theFong
approved these changes
Mar 9, 2026
drewmalin
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.