Skip to content

[6.18.z] Replace library/busybox with lighter container repo - #20856

Merged
Satellite-QE merged 1 commit into
6.18.zfrom
cherry-pick-6.18.z-8ac73bc97a2531bb9b282f00adced329b16c0c93
Feb 25, 2026
Merged

[6.18.z] Replace library/busybox with lighter container repo#20856
Satellite-QE merged 1 commit into
6.18.zfrom
cherry-pick-6.18.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 container image defaults to use a lighter test repository and adjust container management tests accordingly.

Bug Fixes:

  • Prevent container cleanup failures in tests by validating and conditionally using the container ID returned from docker run.

Enhancements:

  • Switch the default upstream container image from library/busybox to jmalloc/echo-server to reduce sync size and improve reliability of container-related tests.

Tests:

  • Update the container management CLI test to run containers in detached mode and clean them up using the ID returned by docker run instead of parsing docker ps output.

@Satellite-QE Satellite-QE added 6.18.z Introduced in or relating directly to Satellite 6.18 Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Feb 24, 2026
@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

Replace the default test container image from library/busybox to jmalloc/echo-server and adapt the CLI container management test logic to work with the new image and output format while ensuring containers and images are still cleaned up properly.

Sequence diagram for updated container pull and run CLI test

sequenceDiagram
    title Container_pull_and_run_test_with_jmalloc_echo_server

    actor Tester
    participant TestRunner
    participant ContainerCLI
    participant ContainerEngine
    participant Registry

    Tester ->> TestRunner: start_container_pull_and_run_test

    TestRunner ->> ContainerCLI: pull_image(container.upstream_name = jmalloc/echo-server)
    ContainerCLI ->> ContainerEngine: pull_image(jmalloc/echo-server)
    ContainerEngine ->> Registry: fetch_image_layers(jmalloc/echo-server)
    Registry -->> ContainerEngine: image_layers
    ContainerEngine -->> ContainerCLI: pull_result
    ContainerCLI -->> TestRunner: pull_output

    TestRunner ->> ContainerCLI: run_container_detached(jmalloc/echo-server)
    ContainerCLI ->> ContainerEngine: run_detached(jmalloc/echo-server)
    ContainerEngine -->> ContainerCLI: container_id_in_output
    ContainerCLI -->> TestRunner: run_output_with_container_id

    TestRunner ->> TestRunner: extract_container_id_from_output

    TestRunner ->> ContainerCLI: stop_container(container_id)
    ContainerCLI ->> ContainerEngine: stop(container_id)
    ContainerEngine -->> ContainerCLI: stop_result
    ContainerCLI -->> TestRunner: stop_output

    TestRunner ->> ContainerCLI: remove_container(container_id)
    ContainerCLI ->> ContainerEngine: rm(container_id)
    ContainerEngine -->> ContainerCLI: rm_result
    ContainerCLI -->> TestRunner: rm_output

    TestRunner ->> ContainerCLI: remove_image(jmalloc/echo-server)
    ContainerCLI ->> ContainerEngine: rmi(jmalloc/echo-server)
    ContainerEngine -->> ContainerCLI: rmi_result
    ContainerCLI -->> TestRunner: rmi_output

    TestRunner -->> Tester: test_result_success
Loading

File-Level Changes

Change Details Files
Update the default upstream container image used in tests and configuration from busybox to a lighter echo-server image.
  • Change the default value of container.upstream_name to jmalloc/echo-server in configuration validators.
  • Align the container configuration template with the new default image where applicable.
robottelo/config/validators.py
conf/container.yaml.template
Adjust the positive container pull-and-run CLI test to run containers in detached mode and capture the container ID directly from docker run output for cleanup.
  • Run docker containers with -d flag so docker run returns a container ID instead of attaching to the process.
  • Parse docker run stdout as a hex container ID using a regex instead of grepping docker ps output.
  • Guard cleanup (docker stop/rm) on container_id being present, and retain image removal via docker rmi after 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 is only defined inside the if match block but referenced in the finally clause; initialize container_id = None before the try so the finally block cannot raise an UnboundLocalError.
  • When parsing the container ID from result.stdout, consider stripping whitespace or using the first line (e.g., result.stdout.strip().splitlines()[0]) before applying the regex to avoid failures due to trailing newlines or additional output.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_positive_pull_image`, `container_id` is only defined inside the `if match` block but referenced in the `finally` clause; initialize `container_id = None` before the `try` so the `finally` block cannot raise an `UnboundLocalError`.
- When parsing the container ID from `result.stdout`, consider stripping whitespace or using the first line (e.g., `result.stdout.strip().splitlines()[0]`) before applying the regex to avoid failures due to trailing newlines or additional output.

## Individual Comments

### Comment 1
<location path="tests/foreman/cli/test_container_management.py" line_range="108-107" />
<code_context>
-                container_id = result.stdout[0].split()[0]
-                module_container_contenthost.execute(f'docker stop {container_id}')
-                module_container_contenthost.execute(f'docker rm {container_id}')
+                if container_id:
+                    module_container_contenthost.execute(f'docker stop {container_id}')
+                    module_container_contenthost.execute(f'docker rm {container_id}')
         finally:
             # Remove docker image
</code_context>
<issue_to_address>
**issue (bug_risk):** Possible `UnboundLocalError` for `container_id` in `finally` block and potential container leak

Because `container_id` is only assigned inside the `try` when the regex matches, any failure before that (or a non‑match) means the `finally` block will reference an undefined variable and hide the real error. It also means a container that was started but not matched will never be cleaned up. Initialize `container_id = None` before the `try`, and consider a fallback cleanup strategy (e.g., `docker ps -a | grep ...`) when the regex doesn’t match to avoid leaking containers and to keep the test robust.
</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.

if match:
container_id = match.group(0)
finally:
# Stop and remove the container

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): Possible UnboundLocalError for container_id in finally block and potential container leak

Because container_id is only assigned inside the try when the regex matches, any failure before that (or a non‑match) means the finally block will reference an undefined variable and hide the real error. It also means a container that was started but not matched will never be cleaned up. Initialize container_id = None before the try, and consider a fallback cleanup strategy (e.g., docker ps -a | grep ...) when the regex doesn’t match to avoid leaking containers and to keep the test robust.

@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_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_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

@SatelliteQE SatelliteQE deleted a comment from Satellite-QE Feb 24, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14435
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_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_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 : =========== 2 failed, 104 passed, 894 warnings in 4468.73s (1:14:28) ===========

@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: 14454
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 1404.41s (0:23:24) ==================

@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
@Satellite-QE
Satellite-QE merged commit 900d755 into 6.18.z Feb 25, 2026
20 of 24 checks passed
@Satellite-QE
Satellite-QE deleted the cherry-pick-6.18.z-8ac73bc97a2531bb9b282f00adced329b16c0c93 branch February 25, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.18.z Introduced in or relating directly to Satellite 6.18 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