Skip to content

Commit

Permalink
load external lockfiles also on checkout --update
Browse files Browse the repository at this point in the history
When running the checkout plugin (or any derived plugin) with --update,
lockfiles were not considered. This logic ensures that the repos can be
updated and later-on be pinned to the new revisions (by updating the
lockfiles). However, any external lockfile (from an external repo)
should always be loaded, as these are not under our control and we
cannot update them. By that, it also makes no sense to move the
externally-pinned repos forward as the next kas invocation without
--update will bring them back to the pinned state.

To fix this, we now always load the lockfiles of external repos (by
that, also on --update).

Note: This introduces a slight behavior change, but only on executions
with --update.

Signed-off-by: Felix Moessbauer <[email protected]>
  • Loading branch information
fmoessbauer committed Feb 12, 2025
1 parent f20835c commit 1e55031
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/userguide/project-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ If this is found, kas loads this file right before processing the current one
.. note::
The locking logic applies to both files on the kas cmdline and include files.

When performing any kas operation with ``--update``, kas will not load the
lockfiles of the local repository. By that, the repos can be checked out to
the latest version and later the lockfiles can be regenerated (e.g. by the
``lock`` plugin).

The following example shows this mechanism for a file ``kas/kas-isar.yml``
and its corresponding lockfile ``kas/kas-isar.lock.yml``.

Expand Down
5 changes: 4 additions & 1 deletion kas/includehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ def _internal_dict_merge(dest, upd):

config_files = self.config_files
if not self.use_lock:
config_files = [x for x in config_files if not x.is_lockfile]
# remove all local lockfiles from the list.
# remote locks cannot be updated, hence keep them
config_files = [x for x in config_files
if x.is_external or not x.is_lockfile]

config = functools.reduce(_internal_dict_merge,
map(lambda x: x.config, config_files))
Expand Down

0 comments on commit 1e55031

Please sign in to comment.