Skip to content

Re-unify container & image name resolution and ensure that the 'distro' CLI and config file options are valid - #1080

Merged
debarshiray merged 4 commits into
containers:mainfrom
debarshiray:wip/rishi/resolve-v2
Sep 1, 2022
Merged

debarshiray merged 4 commits into
containers:mainfrom
debarshiray:wip/rishi/resolve-v2

Conversation

@debarshiray

@debarshiray debarshiray commented Jul 31, 2022 •

Copy link
Copy Markdown
Member

This reverts #977 to address the problems with it with the intention to fix the first part of #937

#937 points out several problems. This pull request only attempts to ensure that Toolbx errors out when the user specifies an invalid distro, instead of falling back to Fedora. It doesn't try to improve the error reporting for a missing or invalid release.

@debarshiray
debarshiray marked this pull request as draft July 31, 2022 16:12
@softwarefactory-delete-me

Copy link
Copy Markdown

Build failed.

❌ unit-test RETRY_LIMIT in 6m 37s
❌ system-test-fedora-rawhide RETRY_LIMIT in 7m 30s
❌ system-test-fedora-36 RETRY_LIMIT in 6m 36s
❌ system-test-fedora-35 RETRY_LIMIT in 6m 44s
❌ system-test-fedora-34 RETRY_LIMIT in 7m 23s

@debarshiray
debarshiray force-pushed the wip/rishi/resolve-v2 branch from 98103aa to 1eb1fa2 Compare July 31, 2022 16:41
@softwarefactory-delete-me

Copy link
Copy Markdown

Build failed.

✔️ unit-test SUCCESS in 6m 39s
❌ system-test-fedora-rawhide FAILURE in 16m 16s
❌ system-test-fedora-36 FAILURE in 9m 52s
❌ system-test-fedora-35 FAILURE in 10m 01s
❌ system-test-fedora-34 FAILURE in 10m 05s

@debarshiray
debarshiray force-pushed the wip/rishi/resolve-v2 branch from 1eb1fa2 to 0ff3964 Compare July 31, 2022 21:21
@softwarefactory-delete-me

Copy link
Copy Markdown

Build failed.

✔️ unit-test SUCCESS in 7m 07s
❌ system-test-fedora-rawhide FAILURE in 16m 23s
❌ system-test-fedora-36 FAILURE in 10m 01s
❌ system-test-fedora-35 FAILURE in 10m 24s

@debarshiray
debarshiray force-pushed the wip/rishi/resolve-v2 branch from 0ff3964 to cce7674 Compare August 1, 2022 22:40
@softwarefactory-delete-me

Copy link
Copy Markdown

Build succeeded.

✔️ unit-test SUCCESS in 6m 55s
✔️ system-test-fedora-rawhide SUCCESS in 16m 26s
✔️ system-test-fedora-36 SUCCESS in 9m 54s
✔️ system-test-fedora-35 SUCCESS in 10m 04s

@debarshiray
debarshiray force-pushed the wip/rishi/resolve-v2 branch 2 times, most recently from 1cdd5b7 to e627c98 Compare August 31, 2022 18:27
@softwarefactory-delete-me

Copy link
Copy Markdown

Build succeeded.

✔️ unit-test SUCCESS in 7m 27s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 20s
✔️ system-test-fedora-rawhide SUCCESS in 11m 59s
✔️ system-test-fedora-36 SUCCESS in 10m 59s
✔️ system-test-fedora-35 SUCCESS in 11m 00s

@softwarefactory-delete-me

Copy link
Copy Markdown

Build succeeded.

✔️ unit-test SUCCESS in 7m 54s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 55s
✔️ system-test-fedora-rawhide SUCCESS in 15m 55s
✔️ system-test-fedora-36 SUCCESS in 10m 11s
✔️ system-test-fedora-35 SUCCESS in 10m 39s

@debarshiray debarshiray changed the title [WIP] ... Re-unify container & image name resolution and ensure that the 'distro' CLI and config file options are valid Sep 1, 2022
@debarshiray
debarshiray marked this pull request as ready for review September 1, 2022 15:40
The idea of splitting ResolveContainerAndImageNames into two public
functions [1] didn't turn out to be so useful [2].  Splitting things
even further might make it worse.  A better approach might be to
(re-)unify the code further.

This is the first step towards that.

This reverts the following commits:
  * 5c8ad7a
  * 02f45fd
  * 8b6418d

... but retains the test cases that were not tied to the changes in
those commits.

[1] Commit fd75608
    containers#828
    containers#838

[2] containers#977

containers#937
containers#1080
The idea of splitting ResolveContainerAndImageNames into two public
functions [1] didn't turn out to be so useful [2].  It pushed the
burden on the callers, who needed to carefully call the split
functions in the right order, because the container, distro, image and
release values are very tightly related.  This opens the door for
mistakes.

A better approach would be to restore ResolveContainerAndImageNames as
the single public API.  If necessary it could be internally split into
smaller private functions.  It would keep things simple for the
callers.

Note that this commit doesn't include the private split.  If necessary,
it can be done in future.

This reverts commit fd75608.

[1] Commit fd75608
    containers#828
    containers#838

[2] containers#977

containers#937
containers#1080
The terms 'default' and 'fallback' are used to mean very specific
things in this context.

The 'default' values are those that are used when the 'create', 'enter'
and 'run' commands were used without any option.  These values are
picked to match the host operating system.

However, if there's no supported Toolbox image matching the host
operating system, and no options were provided to the 'create', 'enter'
and 'run' commands, then the 'fallback' values are used as a last
resort.

Consistently using this terminology leads to a clear mental model and
makes the code easier to read.

This rough arrangement of the code was already being used for
'release', and has now been been extended to 'container name prefix'
and 'distro'.  The suffix for the 'fallback' values was simplified to
'Fallback', instead of 'DefaultFallback'.

containers#937
containers#1080
Currently, if an invalid or unsupported string is specified as the
distro on the command line or in the configuration file, then it would
silently fallback to Fedora.  This shouldn't happen.

It should only fallback to Fedora when no distro was specified and
there's no supported Toolbox image matching the host operating system.
If a distro was explicitly specified then it should either be supported
or it should error out.

The test cases were resurrected from commit 8b6418d.

containers#937
containers#1080
@softwarefactory-delete-me

Copy link
Copy Markdown

Build succeeded.

✔️ unit-test SUCCESS in 7m 46s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 10s
✔️ system-test-fedora-rawhide SUCCESS in 15m 58s
✔️ system-test-fedora-36 SUCCESS in 10m 25s
✔️ system-test-fedora-35 SUCCESS in 11m 13s

@softwarefactory-delete-me

Copy link
Copy Markdown

Build succeeded.

✔️ unit-test SUCCESS in 7m 05s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 26s
✔️ system-test-fedora-rawhide SUCCESS in 15m 57s
✔️ system-test-fedora-36 SUCCESS in 10m 10s
✔️ system-test-fedora-35 SUCCESS in 10m 29s

@debarshiray
debarshiray merged commit df7e01d into containers:main Sep 1, 2022
@debarshiray
debarshiray deleted the wip/rishi/resolve-v2 branch September 1, 2022 16:32
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.

1 participant