There are two main reasons why we reject promotion of CV with containers - at least one of repository name will turn out to be invalid (empty, too long, with invalid characters) or few repositories will get the same name on new LE (pattern is not unique enough). Katello app/lib/katello/validators/environment_docker_repositories_validator.rb does good job at distinguishing these two scenarios and returning helpful error message.
However, app/models/katello/content_view.rb:check_docker_repository_names! will swallow these helpful messages and return generic "Content View publish to environment $FOO will result in invalid container image name of member repositories".
Could we present error message returned from environment_docker_repositories_validator to user? This would really help in figuring out where the root cause of the problem is and what corrective steps should be taken.
Steps to Reproduce:
1. Add new Lifecycle environment
2. Prepare docker product with at least two repositories
3. Create CV with product from earlier step
4. Set up LE Registry Name Patter to something not unique enough (like `<%= organization.label %>`)
5. Try to promote CV to LE
Unhelpful generic error message appears
Helpful error message about registry names not unique enough appears
Mirosław, would this sound better:
Validation failed: Container repository name for repository 'docker' is not unique and cannot be created in 'Library'. Its Container Repository Name (busybox) conflicts with an existing repository. Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific.
Created redmine issue https://projects.theforeman.org/issues/25558 from this bug
yes, I think it's improvement.
But will we display that message every time when CV with docker repos promotion fails? I think promotion will usually fail due to registry name pattern not being specific enough, but may fail when published repository path is too long (over 255 characters) or contains invalid characters (not sure if possible to trigger, except for Bug 1646603). If we display this message when repository is rejected due to length, we are misleading users.
No, this message should only pop up when a non-unique registry name issue is encountered. The invalid name will declare that it is invalid.
OK, that sounds good for me.
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25558 has been resolved.
as we talked on IRC, when following steps to reproduce from original report, I still get generic error message.
I tested your proposed fix (https://github.com/Katello/katello/pull/7910) on my Satellite and this one will fix the issue.
Assigning it back to you, so this bugzilla can move back to ONQA once PR is included in Satellite snap.
The second issue tracker 25782 has been closed as the PR has been merged. Moving BZ to POST.
Re-tested after patch has been included in downstream Satellite build.
Error messages on both Lifecycle Environment and Content View pages point to registry name pattern as root cause of issue.
On Lifecycle Environment page error message is: "An error occurred saving the Environment: Registry name pattern results in duplicate container image names for these repositories: alpine, busybox."
On Content View page error message is: "Registry name pattern results in duplicate container image names for these repositories: alpine, busybox. Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific."
Satellite 6.5 snap 13
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.