-
Notifications
You must be signed in to change notification settings - Fork 15
ENT-14170: Fixed updating to a pinned module version #313
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| set -x | ||
| cd tests/ | ||
| mkdir -p ./tmp/ | ||
|
craigcomstock marked this conversation as resolved.
|
||
| cd ./tmp/ | ||
| touch cfbs.json && rm cfbs.json | ||
| rm -rf .git | ||
|
|
||
| # Inspect the masterfiles module specifically, rather than grepping the whole | ||
| # file (which could match a field belonging to a different module). | ||
| mf() { jq -r --arg k "$1" '.build[] | select(.name == "masterfiles") | .[$k]' cfbs.json; } | ||
| mf_has() { jq -r --arg k "$1" '.build[] | select(.name == "masterfiles") | has($k)' cfbs.json; } | ||
|
|
||
| # Start on an old version of masterfiles. | ||
| cfbs --non-interactive init --masterfiles=3.24.1 | ||
| [ "$(mf version)" = "3.24.1" ] | ||
| [ "$(mf commit)" = "1171e2e50a229d78e2fdd4357a5d07ecc19bdbf4" ] | ||
|
|
||
| # Update to a specific intermediate version (not the latest). This must pin to | ||
| # exactly 3.24.4, not jump to the newest release in the index. | ||
| cfbs --non-interactive update masterfiles@3.24.4 | ||
| [ "$(mf version)" = "3.24.4" ] | ||
| [ "$(mf commit)" = "ed4628805e352fd68d7d72664c859df5a4bb0715" ] | ||
| # Why we assert on "subdirectory" here: pinning an update to a version now routes | ||
| # through index.get_module_object() *with that version*, which reads the | ||
| # per-version index. That index stores an empty "subdirectory" ("") for modules | ||
| # that don't have one, and an empty subdirectory is invalid and breaks validation | ||
| # and build. So get_module_object() now has to drop it (matching how 'cfbs add' | ||
| # cleans the module up). This asserts it does not leak into cfbs.json, and the | ||
| # following 'cfbs validate' confirms the resulting module is actually valid. | ||
| [ "$(mf_has subdirectory)" = "false" ] | ||
|
craigcomstock marked this conversation as resolved.
|
||
| cfbs validate | ||
|
|
||
| # Asking again for the same version is a no-op. | ||
| cfbs --non-interactive update masterfiles@3.24.4 | ||
| [ "$(mf version)" = "3.24.4" ] | ||
|
|
||
| # Asking for an older version than the current one must not downgrade. | ||
| cfbs --non-interactive update masterfiles@3.24.1 | ||
| [ "$(mf version)" = "3.24.4" ] | ||
|
Comment on lines
+40
to
+41
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure that this is exactly desired behavior ^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @olehermanse why does "update" allow a version at all? It would seem to me that the update subcommand might just fail if a version with If that is the case then I suppose |
||
|
|
||
| # A plain update (no @version) still moves to a strictly newer version than the | ||
| # pin. Checking "!= 3.24.4" alone would also pass on a downgrade, so verify that | ||
| # 3.24.4 sorts before the new version (i.e. the new version is the greater one). | ||
| cfbs --non-interactive update masterfiles | ||
| new_ver="$(mf version)" | ||
| [ "$new_ver" != "3.24.4" ] | ||
| [ "$(printf '%s\n%s\n' "3.24.4" "$new_ver" | sort -V | tail -1)" = "$new_ver" ] | ||
|
|
||
| cfbs build | ||
Uh oh!
There was an error while loading. Please reload this page.