-
Notifications
You must be signed in to change notification settings - Fork 22
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
Managed instance names don't take the base into account #544
Comments
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2524.
|
I haven't looked into the code but I can reproduce the problem: > lxc --project rockcraft list
+------+-------+------+------+------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+-------+------+------+------+-----------+
> sudo snap refresh rockcraft --channel=latest/edge
snap "rockcraft" has no updates available
> rockcraft init
> rockcraft pack
Packed my-rock-name_0.1_amd64.rock
> lxc --project rockcraft list
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| base-instance-rockcraft-buildd-base-v7-c-a38d05774a6de0cf6ab1 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| rockcraft-my-rock-name-on-amd64-for-amd64-18486507 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
> sed -i 's/22.04/24.04/g; $a\build-base: devel' rockcraft.yaml
> rockcraft pack
The development build-base should only be used for testing purposes, as its contents are bound to change with the opening of new Ubuntu releases, suddenly and without warning.
The development build-base should only be used for testing purposes, as its contents are bound to change with the opening of new Ubuntu releases, suddenly and without warning.
Packed my-rock-name_0.1_amd64.rock
> lxc --project rockcraft list
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| base-instance-rockcraft-buildd-base-v7-c-a38d05774a6de0cf6ab1 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| rockcraft-my-rock-name-on-amd64-for-amd64-18486507 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+ |
I think @tigarmo is spot on. We can quickly address this in craft-application by including the base in the instance_name. An alternative is to validate inside of craft-providers. After craft-providers creates a LXD instance, subsequent runs of craft-providers only look for an instance with that name and assume it is the correct base. They don't check the OS distro and version. |
As discussed as a team, we are going to fix this in craft-providers. This code should be catching this but is not. |
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2652.
|
After investigation, it was determined that the issue only occurs when the base is changed and the build-base is devel. This happens because this function doesn't perform the base version comparison when build-base is devel. In fact, the Base class hierarchy doesn't even store the OS version number for the container when using devel. It's also less desirable to be performing this check after the instance has started, though changing the base in devel mode may be rare enough to make the larger change (storing OS version as instance metadata) not worth it. Storing the base version in the instance name is infeasible due to name length issues. Always recreating the base instance when in devel mode would be expensive at runtime. |
We don't need to (and shouldn't) always recreate the base when it's devel, however migrating from devel to a production base is a common scenario after a release. Encoding the base in the hash solves this case, even if the base name is not human readable in the image name. |
@cmatsuoka, @mr-cal and I discussed the issues and came up with three possible solutions:
Our recommendation is to go with option # 1, and to reassess around the time of release for core26. |
After discussion with the team, we realized that if we went with option # 1,
|
In addition to the base, we also need to consider the platform. For example, these should build in different containers: base: [email protected]
platforms:
amd64:
build-on: amd64
build-for: amd64
amd64-debug:
build-on: amd64
build-for: amd64 |
Bug Description
The instance name currently reflects the app, project, build-on, build-for and inode of the directory, but not the project's base. What this means is that if a project's base changes (say, a Rockcraft's project
build-base
goes from[email protected]
to[email protected]
then the instance will be incorrectly reused with no warnings.Now granted this doesn't happen too often, mostly to us when developing, but it's still a simple issue to fix.
To Reproduce
Create a project and change its effective base.
part yaml
No response
Relevant log output
.
The text was updated successfully, but these errors were encountered: