Skip to content

[6.19.z] Replace library/busybox with lighter container repo - #20853

Merged
lpramuk merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-8ac73bc97a2531bb9b282f00adced329b16c0c93
Feb 25, 2026
Merged

[6.19.z] Replace library/busybox with lighter container repo#20853
lpramuk merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-8ac73bc97a2531bb9b282f00adced329b16c0c93

Conversation

@Satellite-QE

@Satellite-QE Satellite-QE commented Feb 24, 2026

Copy link
Copy Markdown
Collaborator

Cherrypick of PR: #20671

Problem Statement

Gradually over time the library/busybox repo is becoming more and more huge.
The problem with repo sync arises especially in IPv6 environment where the traffic goes over IPv6-to-4 proxy.

Testing revealed that syncing over IPv4 takes approx. 10 min while syncing over IPv6 takes 25 min and tends to time out quite often.

Solution

Find more suitable replacement for testing container repo target

Related Issues

SAT-41831

Summary by Sourcery

Update default container image configuration and adjust container management tests to work with the new image behavior.

Bug Fixes:

  • Ensure container cleanup in CLI container management tests uses the container ID returned by docker run instead of parsing docker ps output, avoiding failures when no container is listed.

Enhancements:

  • Change the default upstream container repository from library/busybox to jmalloc/echo-server for container-related tests and configuration.

Tests:

  • Modify the positive container image pull test to run containers in detached mode and capture the container ID from docker run output before performing stop and remove operations.

@Satellite-QE Satellite-QE added 6.19.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Feb 24, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator Author
trigger: test-robottelo
pytest: >-
  -v
  tests/foreman/api/test_capsulecontent.py::TestCapsuleContentManagement::test_positive_content_counts_for_mixed_cv
  tests/foreman/api/test_docker.py::TestDockerRepository
  tests/foreman/api/test_http_proxy.py::test_positive_end_to_end[module_repos_collection_with_manifest0-unauth_http_proxy-hostname]
  tests/foreman/api/test_product.py::test_positive_sync_several_repos
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_create
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_delete_product_with_synced_repo
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_synchronize_docker_repo_with_included_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_manifests_lists_in_docker_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_invalid_tags
  tests/foreman/cli/test_capsulecontent.py::test_positive_repair_artifacts
  tests/foreman/cli/test_capsulecontent.py::test_positive_content_counts_for_mixed_cv
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_image
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_search
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_pull
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_content_with_longer_name
  tests/foreman/cli/test_contentview.py::TestContentView::test_positive_remove_cv_version_from_multi_env
  tests/foreman/cli/test_contentview.py::TestContentViewFileRepo::test_promote_ccv_to_lce_with_nondefault_pattern
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_with_name
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_same_product
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_multiple_products
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_sync
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_delete_random_repo_by_id
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_negative_docker_upload_content
  tests/foreman/cli/test_docker.py::TestDockerContentView::test_positive_add_docker_repos_by_id
  tests/foreman/cli/test_pulp.py
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_upstream_name
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_name
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo
  tests/foreman/cli/test_repository.py::TestRepository::test_verify_checksum_container_repo
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_additive
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_content_only
  tests/foreman/cli/test_repository.py::TestRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags
  tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_repository_docker
  tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_version_docker
  tests/foreman/ui/test_containerimagetag.py::test_positive_search
network_type: ipv6

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label Feb 24, 2026
@sourcery-ai

sourcery-ai Bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces the heavy library/busybox default container image with the lighter jmalloc/echo-server in configuration and adapts the container pull-and-run CLI test to work with the new image and output format while simplifying container lifecycle handling.

Sequence diagram for the updated container pull and run CLI test

sequenceDiagram
    actor Tester
    participant TestCase as ContainerManagementTest
    participant CLI as ContainerCLI
    participant Registry as ContainerRegistry
    participant Runtime as ContainerRuntime

    Tester->>TestCase: execute test_container_pull_and_run
    TestCase->>CLI: pull_image(jmalloc/echo-server)
    CLI->>Registry: request image jmalloc/echo-server
    Registry-->>CLI: image layers
    CLI-->>TestCase: pull result

    TestCase->>CLI: run_container_detached(jmalloc/echo-server)
    CLI->>Runtime: run -d jmalloc/echo-server
    Runtime-->>CLI: container_id
    CLI-->>TestCase: container_id

    TestCase->>CLI: check_container_status(container_id)
    CLI->>Runtime: inspect container_id
    Runtime-->>CLI: status
    CLI-->>TestCase: status

    TestCase->>CLI: cleanup_container(container_id)
    CLI->>Runtime: stop container_id
    Runtime-->>CLI: stopped
    CLI->>Runtime: remove container_id
    Runtime-->>CLI: removed
    CLI-->>TestCase: cleanup complete
    TestCase-->>Tester: test result
Loading

Updated class diagram for container configuration validator defaults

classDiagram
    class Validator {
        +str key
        +bool must_exist
        +type is_type_of
        +any default
        +validate(value)
    }

    class ContainerConfig {
        +str container_upstream_name = jmalloc/echo-server
        +list container_alternative_upstream_names
        +get_value(key)
        +set_value(key, value)
    }

    class ConfigValidators {
        +Validator container_upstream_name_validator
        +Validator container_alternative_upstream_names_validator
        +load_defaults(ContainerConfig config)
    }

    ConfigValidators o-- Validator : uses
    ContainerConfig o-- ConfigValidators : configured_by
    ContainerConfig ..> Validator : validated_by
Loading

File-Level Changes

Change Details Files
Update default upstream container image used by tests and configuration to a lighter alternative.
  • Change the default container.upstream_name configuration value from library/busybox to jmalloc/echo-server.
  • Keep support for alternative upstream names while shifting the primary test target to the new image.
  • Ensure the container configuration template aligns with the new default image name.
robottelo/config/validators.py
conf/container.yaml.template
Adapt container management CLI test to run the new image in detached mode and robustly track the container lifecycle.
  • Modify the docker run invocation in the pull-image test to use -d so the container runs detached and returns a container ID.
  • Extract the container ID directly from the docker run stdout by validating it against a hex pattern instead of parsing docker ps output.
  • Guard stop/rm cleanup calls with a conditional so they execute only when a valid container ID was captured.
  • Retain image cleanup by removing the pulled docker image at the end of the test.
tests/foreman/cli/test_container_management.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In test_positive_pull_image, container_id can be referenced in the finally block before assignment if the docker run command fails or the regex doesn’t match; initialize container_id = None before the try and use that consistently in the finally.
  • The container ID extraction using re.match(r'^[0-9a-f]+$', result.stdout) is quite fragile (e.g., trailing newlines or extra output); consider a more robust approach such as result.stdout.split()[0] to obtain the ID from the docker run -d output.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_positive_pull_image`, `container_id` can be referenced in the `finally` block before assignment if the `docker run` command fails or the regex doesn’t match; initialize `container_id = None` before the try and use that consistently in the finally.
- The container ID extraction using `re.match(r'^[0-9a-f]+$', result.stdout)` is quite fragile (e.g., trailing newlines or extra output); consider a more robust approach such as `result.stdout.split()[0]` to obtain the ID from the `docker run -d` output.

## Individual Comments

### Comment 1
<location path="tests/foreman/cli/test_container_management.py" line_range="102-103" />
<code_context>
+                    f'docker run -d {repo["published-at"]}'
+                )
                 assert result.status == 0
+                match = re.match(r'^[0-9a-f]+$', result.stdout)
+                if match:
+                    container_id = match.group(0)
             finally:
</code_context>
<issue_to_address>
**issue (bug_risk):** Potential use of `container_id` before assignment and missing assertion that it was parsed correctly

`container_id` is only set when the regex matches, but it’s always referenced in the `finally` block. If `docker run -d` exits 0 but `stdout` is empty or doesn’t match, `container_id` will be undefined and cleanup will be skipped. Initialize `container_id = None` before the inner `try`, and when `result.status == 0` assert that `container_id is not None` (e.g., `assert container_id, 'Expected docker run to return a container ID'`) so failures are explicit and cleanup logic always has a defined value.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +102 to +103
match = re.match(r'^[0-9a-f]+$', result.stdout)
if match:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Potential use of container_id before assignment and missing assertion that it was parsed correctly

container_id is only set when the regex matches, but it’s always referenced in the finally block. If docker run -d exits 0 but stdout is empty or doesn’t match, container_id will be undefined and cleanup will be skipped. Initialize container_id = None before the inner try, and when result.status == 0 assert that container_id is not None (e.g., assert container_id, 'Expected docker run to return a container ID') so failures are explicit and cleanup logic always has a defined value.

@lpramuk

lpramuk commented Feb 24, 2026

Copy link
Copy Markdown
Contributor
trigger: test-robottelo
pytest: >-
  -v
  tests/foreman/api/test_capsulecontent.py::TestCapsuleContentManagement::test_positive_content_counts_for_mixed_cv
  tests/foreman/api/test_docker.py::TestDockerRepository
  tests/foreman/api/test_http_proxy.py::test_positive_end_to_end[module_repos_collection_with_manifest0-unauth_http_proxy-hostname]
  tests/foreman/api/test_product.py::test_positive_sync_several_repos
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_create
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_delete_product_with_synced_repo
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_synchronize_docker_repo_with_included_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_manifests_lists_in_docker_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags
  tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_invalid_tags
  tests/foreman/cli/test_capsulecontent.py::test_positive_repair_artifacts
  tests/foreman/cli/test_capsulecontent.py::test_positive_content_counts_for_mixed_cv
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_image
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_search
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_pull
  tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_content_with_longer_name
  tests/foreman/cli/test_contentview.py::TestContentView::test_positive_remove_cv_version_from_multi_env
  tests/foreman/cli/test_contentview.py::TestContentViewFileRepo::test_promote_ccv_to_lce_with_nondefault_pattern
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_with_name
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_same_product
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_multiple_products
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_sync
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_delete_random_repo_by_id
  tests/foreman/cli/test_docker.py::TestDockerRepository::test_negative_docker_upload_content
  tests/foreman/cli/test_docker.py::TestDockerContentView::test_positive_add_docker_repos_by_id
  tests/foreman/cli/test_pulp.py
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_upstream_name
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_name
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo
  tests/foreman/cli/test_repository.py::TestRepository::test_verify_checksum_container_repo
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_additive
  tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_content_only
  tests/foreman/cli/test_repository.py::TestRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags
  tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_repository_docker
  tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_version_docker
  tests/foreman/ui/test_containerimagetag.py::test_positive_search
network_type: ipv6

@Satellite-QE

Copy link
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14433
Build Status: UNSTABLE
PRT Comment: pytest -v tests/foreman/api/test_capsulecontent.py::TestCapsuleContentManagement::test_positive_content_counts_for_mixed_cv tests/foreman/api/test_docker.py::TestDockerRepository tests/foreman/api/test_http_proxy.py::test_positive_end_to_end[module_repos_collection_with_manifest0-unauth_http_proxy-hostname] tests/foreman/api/test_product.py::test_positive_sync_several_repos tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_create tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_delete_product_with_synced_repo tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_synchronize_docker_repo_with_included_tags tests/foreman/api/test_repository.py::TestDockerRepository::test_positive_manifests_lists_in_docker_tags tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags tests/foreman/api/test_repository.py::TestDockerRepository::test_negative_synchronize_docker_repo_with_invalid_tags tests/foreman/cli/test_capsulecontent.py::test_positive_repair_artifacts tests/foreman/cli/test_capsulecontent.py::test_positive_content_counts_for_mixed_cv tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_image tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_search tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_container_admin_end_to_end_pull tests/foreman/cli/test_container_management.py::TestDockerClient::test_positive_pull_content_with_longer_name tests/foreman/cli/test_contentview.py::TestContentView::test_positive_remove_cv_version_from_multi_env tests/foreman/cli/test_contentview.py::TestContentViewFileRepo::test_promote_ccv_to_lce_with_nondefault_pattern tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_with_name tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_same_product tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_create_repos_using_multiple_products tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_sync tests/foreman/cli/test_docker.py::TestDockerRepository::test_positive_delete_random_repo_by_id tests/foreman/cli/test_docker.py::TestDockerRepository::test_negative_docker_upload_content tests/foreman/cli/test_docker.py::TestDockerContentView::test_positive_add_docker_repos_by_id tests/foreman/cli/test_pulp.py tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_upstream_name tests/foreman/cli/test_repository.py::TestRepository::test_positive_create_docker_repo_with_name tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo tests/foreman/cli/test_repository.py::TestRepository::test_verify_checksum_container_repo tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_additive tests/foreman/cli/test_repository.py::TestRepository::test_positive_synchronize_docker_repo_set_tags_later_content_only tests/foreman/cli/test_repository.py::TestRepository::test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_repository_docker tests/foreman/cli/test_satellitesync.py::TestRepositoryExport::test_positive_export_version_docker tests/foreman/ui/test_containerimagetag.py::test_positive_search --external-logging
Test Result : =========== 1 failed, 125 passed, 996 warnings in 4823.78s (1:20:23) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Feb 24, 2026
@lpramuk

lpramuk commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

trigger: test-robottelo
pytest: -v tests/foreman/api/test_capsulecontent.py::TestCapsuleContentManagement::test_positive_content_counts_for_mixed_cv[unfiltered-repos_collection0]

@Satellite-QE

Copy link
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14455
Build Status: SUCCESS
PRT Comment: pytest -v tests/foreman/api/test_capsulecontent.py::TestCapsuleContentManagement::test_positive_content_counts_for_mixed_cv[unfiltered-repos_collection0] --external-logging
Test Result : ================= 1 passed, 10 warnings in 1421.25s (0:23:41) ==================

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Feb 25, 2026
@lpramuk
lpramuk enabled auto-merge (squash) February 25, 2026 13:19
@lpramuk
lpramuk disabled auto-merge February 25, 2026 13:20
@lpramuk
lpramuk merged commit 023de1e into 6.19.z Feb 25, 2026
19 of 24 checks passed
@lpramuk
lpramuk deleted the cherry-pick-6.19.z-8ac73bc97a2531bb9b282f00adced329b16c0c93 branch February 25, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.19.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants