Skip to content

ENT-14170: Fixed updating to a pinned module version#313

Merged
nickanderson merged 1 commit into
cfengine:masterfrom
nickanderson:ENT-14170/master
Jun 4, 2026
Merged

ENT-14170: Fixed updating to a pinned module version#313
nickanderson merged 1 commit into
cfengine:masterfrom
nickanderson:ENT-14170/master

Conversation

@nickanderson
Copy link
Copy Markdown
Member

@nickanderson nickanderson commented Jun 3, 2026

Previously doing something like cfbs update masterfiles@3.24.4 when running 3.24.1 would simply update to the latest version available in the index (while telling you it updated to the version you requested)

cfbs update masterfiles@3.24.4
    [main 8ab9378] Updated module 'masterfiles' from version 3.24.1 to version 3.24.4
     1 file changed, 3 insertions(+), 3 deletions(-)
    Updated module 'masterfiles' from version 3.24.1 to version 3.24.4?
jq -r '.build[] | select(.name=="masterfiles") | {version, commit}' cfbs.json
  {
    "version": "3.27.1",
    "commit": "15d8ca2ca951db3ddf197b90c9dea6ef75f5fa89"
  }

Ticket: ENT-14170

@nickanderson
Copy link
Copy Markdown
Member Author

First commit failed the test as expected, second commit made it pass.

@nickanderson nickanderson changed the title ENT-14170: Added shell test for updating to a pinned module version ENT-14170: Fixed updating to a pinned module version Jun 3, 2026
Comment on lines +35 to +36
cfbs --non-interactive update masterfiles@3.24.1
[ "$(mf version)" = "3.24.4" ]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am unsure that this is exactly desired behavior ^

Copy link
Copy Markdown
Contributor

@craigcomstock craigcomstock Jun 3, 2026

Choose a reason for hiding this comment

The 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 @version is specified.

If that is the case then I suppose cfbs add would have to be used to change the version of an already installed module?

Comment thread tests/shell/050_update_masterfiles_specific_version.sh Outdated
Comment on lines +35 to +36
cfbs --non-interactive update masterfiles@3.24.1
[ "$(mf version)" = "3.24.4" ]
Copy link
Copy Markdown
Contributor

@craigcomstock craigcomstock Jun 3, 2026

Choose a reason for hiding this comment

The 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 @version is specified.

If that is the case then I suppose cfbs add would have to be used to change the version of an already installed module?

Comment thread tests/shell/050_update_masterfiles_specific_version.sh
Comment thread tests/shell/050_update_masterfiles_specific_version.sh
Comment thread cfbs/index.py
Comment thread cfbs/index.py
Copy link
Copy Markdown
Contributor

@craigcomstock craigcomstock left a comment

Choose a reason for hiding this comment

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

squash the commits yeah?

The @Version was parsed but discarded: only the module name was passed to
get_module_object(), so update always resolved the latest index entry and
wrote that to cfbs.json while reporting the requested version. Now the
pinned version is resolved from the version index, unknown versions are
skipped with a warning.

Ticket: ENT-14170
Changelog: Made cfbs update honor a pinned module version (NAME@VERSION)
@nickanderson nickanderson merged commit e3b825f into cfengine:master Jun 4, 2026
11 checks passed
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