Repository navigation
fix(upgrade): serialize installation changes and keep existing version directories #3412
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
Open
jong-kyung
wants to merge
8
commits into
voidzero-dev:main
Choose a base branch
from
jong-kyung:fix/upgrade-install-lock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
324a449
fix(upgrade): keep existing version directories when an upgrade fails
jong-kyung ac63d13
fix(upgrade): serialize upgrades and rollbacks
jong-kyung 2643c13
fix(setup): serialize standalone deployment and legacy installation
jong-kyung 36f7a8e
test(upgrade): cover rollback and failed reinstall
jong-kyung df1d906
test(upgrade): serve the failed reinstall payload from a local fixture
jong-kyung 3ae04b7
fix(upgrade): repair an active version whose binary is missing
jong-kyung dba1ef4
Merge branch 'main' into fix/upgrade-install-lock
jong-kyung 6137a5e
Merge branch 'main' into fix/upgrade-install-lock
jong-kyung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
88 changes: 88 additions & 0 deletions
88
...vp_cli_snapshots/tests/cli_snapshots/fixtures/command_upgrade_rollback/mock-manifest.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| { | ||
| "vite-plus/999.0.1": { | ||
| "name": "vite-plus", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "unused", | ||
| "integrity": "sha512-unused" | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-darwin-arm64/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-darwin-arm64", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-darwin-arm64/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-darwin-x64/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-darwin-x64", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-darwin-x64/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-linux-arm64-gnu/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-linux-arm64-gnu", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-linux-arm64-gnu/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-linux-x64-gnu/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-linux-x64-gnu", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-linux-x64-gnu/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-linux-arm64-musl/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-linux-arm64-musl", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-linux-arm64-musl/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "@voidzero-dev/vite-plus-cli-linux-x64-musl/999.0.1": { | ||
| "name": "@voidzero-dev/vite-plus-cli-linux-x64-musl", | ||
| "version": "999.0.1", | ||
| "dist": { | ||
| "tarball": "{REGISTRY}/@voidzero-dev/vite-plus-cli-linux-x64-musl/-/vite-plus-cli-999.0.1.tgz", | ||
| "integrity": "sha512-up15UEnVySULq4e34BEg8s9e2A6VLyjwUZrD++6PWXpfwFwkkysfTM21sIsx5mKwwHlfpRRO43C9zySvPMMTCQ==", | ||
| "attestations": { | ||
| "provenance": { | ||
| "predicateType": "https://slsa.dev/provenance/v1" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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
27 changes: 27 additions & 0 deletions
27
...e_rollback/snapshots/command_upgrade_failed_reinstall_keeps_existing_version.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # command_upgrade_failed_reinstall_keeps_existing_version | ||
|
|
||
| A failed upgrade into an existing version directory keeps that directory, which can be the rollback target. | ||
|
|
||
| ## `vpt write-file $VP_HOME/999.0.1/keep.txt 'rollback target | ||
| '` | ||
|
|
||
|
|
||
| ## `vpt write-file $VP_HOME/999.0.1/bin 'not a directory | ||
| '` | ||
|
|
||
| Make extraction fail after the download is verified | ||
|
|
||
|
|
||
| ## `vp upgrade 999.0.1 --silent` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| error: I/O error: File exists (os error 17) | ||
| ``` | ||
|
|
||
| ## `vpt print-file $VP_HOME/999.0.1/keep.txt` | ||
|
|
||
| ``` | ||
| rollback target | ||
| ``` |
30 changes: 30 additions & 0 deletions
30
...and_upgrade_rollback/snapshots/command_upgrade_repairs_broken_active_version.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # command_upgrade_repairs_broken_active_version | ||
|
|
||
| An upgrade to the version that `current` names still installs it when the active binary is missing. | ||
|
|
||
| ## `vpt mkdir external` | ||
|
|
||
|
|
||
| ## `vpt cp $VP_HOME/bin/vp external/vp` | ||
|
|
||
|
|
||
| ## `vpt chmod +x external/vp` | ||
|
|
||
|
|
||
| ## `VP_HOME=${workspace}/home VP_VERSION=999.0.1 ./external/vp` | ||
|
|
||
| Activate a 999.0.1 directory | ||
|
|
||
|
|
||
| ## `vpt rm -r home/999.0.1/bin` | ||
|
|
||
| Break the active installation | ||
|
|
||
|
|
||
| ## `VP_HOME=${workspace}/home vp upgrade 999.0.1 --silent` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| error: Upgrade error: Binary not found after extraction. The download may be corrupted. | ||
| ``` |
50 changes: 50 additions & 0 deletions
50
...ixtures/command_upgrade_rollback/snapshots/command_upgrade_rollback_deployed.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # command_upgrade_rollback_deployed | ||
|
|
||
| A rollback holds the installation lock while an unmarked target completes in-place setup, so the child must not take that lock. | ||
|
|
||
| ## `vpt mkdir external` | ||
|
|
||
|
|
||
| ## `vpt cp $VP_HOME/bin/vp external/vp` | ||
|
|
||
|
|
||
| ## `vpt chmod +x external/vp` | ||
|
|
||
|
|
||
| ## `VP_HOME=${workspace}/home VP_VERSION=rollback-a ./external/vp` | ||
|
|
||
| Deploy the first version | ||
|
|
||
|
|
||
| ## `VP_HOME=${workspace}/home VP_VERSION=rollback-b ./external/vp` | ||
|
|
||
| Deploy the second version, which records the first as the rollback target | ||
|
|
||
|
|
||
| ## `vpt print-file home/.previous-version` | ||
|
|
||
| ``` | ||
| rollback-a | ||
| ``` | ||
|
|
||
| ## `vpt rm home/rollback-a/bin/.vp-setup-complete` | ||
|
|
||
| The rollback target must run in-place setup during the shim refresh | ||
|
|
||
|
|
||
| ## `VP_HOME=${workspace}/home vp upgrade --rollback` | ||
|
|
||
| A deadlock fails this step by timeout | ||
|
|
||
|
|
||
| ## `vpt print-file home/.previous-version` | ||
|
|
||
| ``` | ||
| rollback-b | ||
| ``` | ||
|
|
||
| ## `vpt stat-file home/rollback-a/bin/.vp-setup-complete --assert file` | ||
|
|
||
| ``` | ||
| home/rollback-a/bin/.vp-setup-complete: file | ||
| ``` |
Binary file added
BIN
+200 Bytes
.../tests/cli_snapshots/fixtures/command_upgrade_rollback/tarballs/vite-plus-cli-999.0.1.tgz
Binary file not shown.
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.