Skip to content
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

system tests failing due to shortnames #3096

Closed
edsantiago opened this issue Mar 22, 2021 · 6 comments · Fixed by #3099
Closed

system tests failing due to shortnames #3096

edsantiago opened this issue Mar 22, 2021 · 6 comments · Fixed by #3099

Comments

@edsantiago
Copy link
Member

Fedora gating tests are now failing due to shortnames:

# [podman pull ubuntu]
# Error: error getting default registries to try: short-name resolution enforced but cannot prompt without a TTY

This is going to be difficult to solve due to the prevalence of shortnames in buildah tests. Possibilities I see are:

  • replace all shortnames in buildah/tests with FQINs - this might cost us test coverage of buildah shortname handling
  • hand-hack the podman shortnames file (~/.config/.cache/containers/short-name-aliases.conf) - this might not be appreciated by people running tests on a shared system.
  • override podman, just tell it "do what you used to do" - is that possible? I can't find much documentation on shortnames

Any other ideas?

@vrothberg
Copy link
Member

vrothberg commented Mar 22, 2021

Fedora gating tests are now failing due to shortnames:

# [podman pull ubuntu]
# Error: error getting default registries to try: short-name resolution enforced but cannot prompt without a TTY

This is going to be difficult to solve due to the prevalence of shortnames in buildah tests. Possibilities I see are:

* replace all shortnames in `buildah/tests` with FQINs - this might cost us test coverage of buildah shortname handling

Yes, we should aim for the test coverage. The failing tests are good sign in that context :)

* hand-hack the podman shortnames file (`~/.config/.cache/containers/short-name-aliases.conf`) - this might not be appreciated by people running tests on a shared system.

Note that the path is not ~/.config/.cache anymore (was a bug). It's now ~/.cache.

I think the tests should run with https://github.com/containers/shortnames/blob/main/shortnames.conf in the /etc/containers/registries.conf.d. This config is now also shipped in the Fedora package (the one that also install registries.conf).

* override podman, just tell it "do what you used to do" - is that possible? I can't find much documentation on shortnames

Prompting only works with a TTY. Please let me know if man registries.conf is missing information.

@edsantiago
Copy link
Member Author

edsantiago commented Mar 22, 2021

I think the tests should run with

Meaning, "I think the tests are probably running with [...]", or "I think we should change things such that"? I can't compare files now to verify, but from what I see in your link, that shortnames.conf wouldn't help in any way: it does not contain ubuntu or busybox or php.

Note that the path is not ~/.config/.cache anymore (was a bug). It's now ~/.cache.

Do you mean "It's now ~/.config"? containers-registries.conf(5) (thanks for the reference!) claims to use $XDG_CONFIG_HOME with fallback to ~/.config.

Regardless: I'm still not understanding what you suggest that I do. I see that buildah has a --registries-conf flag that could possibly be used to override shortnames.conf; does podman have an equivalent? Or an environment-variable way to override registries.conf, containers.conf, shortnames.conf? [EDIT: UPDATE: found it, yes, podman has --registries-conf, but it seems to ignore [aliases] entries in said file. I'm still struggling to figure this out]

@edsantiago
Copy link
Member Author

This may be connected to containers/podman#9766

@vrothberg
Copy link
Member

This may be connected to containers/podman#9766

AFAIK REGISTRIES_CONFIG_PATH is supported by Podman only. vgrep REGISTRIES revealed one reference in tests/helpers.bash. Do we need support in Buildah as well?

@vrothberg
Copy link
Member

I think the tests should run with

Meaning, "I think the tests are probably running with [...]", or "I think we should change things such that"? I can't compare files now to verify, but from what I see in your link, that shortnames.conf wouldn't help in any way: it does not contain ubuntu or busybox or php.

That may actually be the bug. Great catch! I would have put my hand in fire knowing that all these images already have aliases. I'll open a PR immediately. Thank you!

Note that the path is not ~/.config/.cache anymore (was a bug). It's now ~/.cache.

Do you mean "It's now ~/.config"? containers-registries.conf(5) (thanks for the reference!) claims to use $XDG_CONFIG_HOME with fallback to ~/.config.

The man page must be outdated (Cc: @lsm5).

Here's a link to release-5.10 docs: https://github.com/containers/image/blob/release-5.10/docs/containers-registries.conf.5.md#short-name-aliasing-modes

There are two kinds of configs to store aliases:

  1. The ordinary registries.conf files. Those are intended to be configured by the distros and the users.
  2. $CACHE/containers/short-name-aliases.conf which is meant to be written by machines only (i.e., after a prompt and successful pull).

Regardless: I'm still not understanding what you suggest that I do. I see that buildah has a --registries-conf flag that could possibly be used to override shortnames.conf;

Apologies for having been vague. On second thought, I think that explicitly pointing the tests to a registries.conf that we control is the right thing. I was first pointing out that Fedora should have the images aliased already but a) that doesn't seem to be true as you found out and b) the tests/CI should provide all data needed to execute properly.

That being said, I think we need to assemble a registries.conf and run Buildah with --registries.conf.

does podman have an equivalent? Or an environment-variable way to override registries.conf, containers.conf, shortnames.conf? [EDIT: UPDATE: found it, yes, podman has --registries-conf, but it seems to ignore [aliases] entries in said file. I'm still struggling to figure this out]

I think that podman's --registries-conf flag may only partially work if at all. The flag is hidden and untested.

@edsantiago
Copy link
Member Author

we need to assemble a registries.conf and run Buildah with --registries.conf.

That's already done in buildah tests.

I think there's some confusion here (my fault) due to the mix of buildah and podman. To make sure everyone is on the same page:

  • buildah tests use shortnames all over the place
  • ...including a helper function called prefetch, which is used to minimize registry hits (i.e. flake opportunities) by caching images
  • prefetch uses podman to pull images (because buildah has no save/load commands)
  • even with --registries-conf-file=same-as-buildah, podman ignores the shortnames directive

I suppose another possible fix is to replace podman pull with buildah pull in _prefetch(), keeping podman for save/load. I'll take a look at that today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants