Skip to content

allow adding image with sqfs file from internal store#125

Merged
bcumming merged 6 commits intoeth-cscs:mainfrom
finkandreas:fix/image_add
Dec 3, 2025
Merged

allow adding image with sqfs file from internal store#125
bcumming merged 6 commits intoeth-cscs:mainfrom
finkandreas:fix/image_add

Conversation

@finkandreas
Copy link
Contributor

This fixes #15
It does not fail anymore when referencing an internal sqfs file. Additionally it allows to retag by label, i.e. this is equivalent:

uenv image add numbat:24/v1 wombat:24/v1
uenv image add numbat:24/v1 $(uenv --repo=$RP image inspect --format='{sqfs}' wombat/24:v1@arapiles%zen3)

assert_line --partial 'bilby/24:v1'
assert_line --partial 'quokka/24:v1'
assert_line --partial 'wombat/24:replica'
assert_line --partial 'numbat/24:replica'
Copy link
Member

Choose a reason for hiding this comment

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

This test is applied twice (lines 402 and 403). Remove one?

Also, you probably only need to check for the presence of the incolved uenv, i.e. numbat/24:*?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to be consistent with the tests above, that checked for all images every time.
I don't mind changing this and only check for images that were added at this particular test, It is just inconsistent with the above testing style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in latest commit

run uenv --repo=$RP image ls --no-header
assert_success
assert_line --partial 'wombat/24:v1'
assert_line --partial 'numbat/24:v1'
Copy link
Member

Choose a reason for hiding this comment

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

You only need to check for wombat/*?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in latest commit

}
// fs::equivalent only works on existing files, check first if path even
// exists, and only then for equivalence
if (!fs::exists(uenv_paths.squashfs) ||
Copy link
Member

Choose a reason for hiding this comment

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

It isn't clear why these checks are being performed.

Ultimately, we want to perform this step if the source uenv/squashfs is not already in the repository, so it would be good if this changed to:

if (!source_in_repo) {
  ...

Where:

// get a reference to the concrete environment after parsing and validating
const auto& uenv = *env->uenvs.begin();

// check whether the squashfs file is inside the repository
const bool source_in_repo = util::is_child(uenv.second.squashfs_path, repo.path.value());

And we can add a new function to src/util/fs.{h,cpp}:

bool is_child(const std::filesystem::path& child, const std::filesystem::path& parent) {
    auto rel = child.lexically_relative(parent);
    return !rel.empty() && *rel.begin() != "..";
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in latest commit

@bcumming bcumming merged commit c187114 into eth-cscs:main Dec 3, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uenv image add fails when referencing internal store.squashfs

2 participants