Skip to content

[6.17.z] Replace library/busybox with lighter container repo - #20857

Merged
lpramuk merged 1 commit into
SatelliteQE:6.17.zfrom
lpramuk:617_replace_busybox_container_repo
Feb 25, 2026
Merged

[6.17.z] Replace library/busybox with lighter container repo#20857
lpramuk merged 1 commit into
SatelliteQE:6.17.zfrom
lpramuk:617_replace_busybox_container_repo

Conversation

@lpramuk

@lpramuk lpramuk commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Manual cherrypick of PR: #20671
(cherry picked from commit 8ac73bc)

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
#20854

Summary by Sourcery

Replace the default test container image with a lighter upstream repository and adjust container management tests accordingly.

Enhancements:

  • Change the default container upstream repository from library/busybox to jmalloc/echo-server to reduce sync size and improve performance.

Tests:

  • Update container management CLI test to run containers in detached mode and more robustly capture and clean up container IDs after execution.

@lpramuk lpramuk self-assigned this Feb 24, 2026
@lpramuk lpramuk added No-CherryPick PR doesnt need CherryPick to previous branches 6.17.z labels 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

This PR replaces the default container test image repository from the large library/busybox image to the lighter jmalloc/echo-server, and adjusts the container CLI test to run containers in detached mode and clean them up more robustly using the returned container ID.

Sequence diagram for updated container CLI test run and cleanup

sequenceDiagram
    actor Tester
    participant RobotteloTest as Robottelo_test
    participant ForemanCLI as Foreman_CLI
    participant ContainerRuntime as Container_runtime
    participant ContainerRegistry as Container_registry

    Tester->>RobotteloTest: start_container_cli_test
    RobotteloTest->>ForemanCLI: hammer_container_run image=jmalloc/echo-server detached=true
    ForemanCLI->>ContainerRuntime: run_container image=jmalloc/echo-server detached=true
    ContainerRuntime->>ContainerRegistry: pull_image jmalloc/echo-server
    ContainerRegistry-->>ContainerRuntime: image_layers
    ContainerRuntime-->>ForemanCLI: container_id
    ForemanCLI-->>RobotteloTest: container_id

    Note over RobotteloTest,ForemanCLI: Test logic uses returned container_id for cleanup

    RobotteloTest->>ForemanCLI: hammer_container_stop container_id
    ForemanCLI->>ContainerRuntime: stop_container container_id
    ContainerRuntime-->>ForemanCLI: stopped
    ForemanCLI-->>RobotteloTest: stopped

    RobotteloTest->>ForemanCLI: hammer_container_remove container_id
    ForemanCLI->>ContainerRuntime: remove_container container_id
    ContainerRuntime-->>ForemanCLI: removed
    ForemanCLI-->>RobotteloTest: removed
    RobotteloTest-->>Tester: test_passed
Loading

File-Level Changes

Change Details Files
Update container CLI test to run images in detached mode and safely capture/cleanup the container ID.
  • Change docker run invocation to use detached mode so the command returns immediately with a container ID instead of attaching to container output.
  • Parse the docker run output as a hex container ID and only attempt stop/rm if a valid ID was captured.
  • Remove reliance on `docker ps
grep` to discover the container ID, reducing flakiness and output parsing complexity in the test.
Switch default container upstream repository from library/busybox to a smaller jmalloc/echo-server image for test sync operations.
  • Change the configuration validator default for container.upstream_name to use jmalloc/echo-server.
  • Update the container configuration template to reflect the new default upstream repository used in tests.
robottelo/config/validators.py
conf/container.yaml.template

Possibly linked issues

  • #0: The PR is the manual cherry-pick that fixes the failed auto-cherrypick described in the issue.
  • #: Issue tracks failed auto-cherrypick of PR 20671; this PR is the manual cherry-pick replacement.

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

@lpramuk lpramuk changed the title Replace library/busybox with lighter container repo (#20671) [6.17.z] Replace library/busybox with lighter container repo Feb 24, 2026

@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 conditionally assigned inside the try block but referenced in the finally, which can raise an UnboundLocalError; initialize container_id = None before the try and then check it in the finally.
  • When extracting the container ID from docker run -d output, consider stripping or reading only the first line from result.stdout before applying the regex to avoid issues with 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 conditionally assigned inside the `try` block but referenced in the `finally`, which can raise an `UnboundLocalError`; initialize `container_id = None` before the `try` and then check it in the `finally`.
- When extracting the container ID from `docker run -d` output, consider stripping or reading only the first line from `result.stdout` before applying the regex to avoid issues with trailing newlines or additional output.

## Individual Comments

### Comment 1
<location path="tests/foreman/cli/test_container_management.py" line_range="101-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:
                 # Stop and remove the container
</code_context>
<issue_to_address>
**issue (bug_risk):** Potential use of `container_id` before assignment and missing negative-path handling when the regex does not match

`container_id` is only set inside the `if match:` block but is always referenced in `finally`. If `re.match` returns `None` (e.g., due to trailing whitespace or extra output), this will raise `UnboundLocalError`, and even if pre-initialized, cleanup would be skipped when there’s no match.

Consider initializing `container_id = None` before the `try`, and then either normalizing the output (e.g., strip / split to get the ID) or failing the test explicitly when `match` is `None` instead of silently skipping cleanup.
</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 +101 to +103
match = re.match(r'^[0-9a-f]+$', result.stdout)
if match:
container_id = match.group(0)

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 negative-path handling when the regex does not match

container_id is only set inside the if match: block but is always referenced in finally. If re.match returns None (e.g., due to trailing whitespace or extra output), this will raise UnboundLocalError, and even if pre-initialized, cleanup would be skipped when there’s no match.

Consider initializing container_id = None before the try, and then either normalizing the output (e.g., strip / split to get the ID) or failing the test explicitly when match is None instead of silently skipping cleanup.

@lpramuk

lpramuk commented Feb 25, 2026

Copy link
Copy Markdown
Contributor 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_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

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 14449
Build Status: SUCCESS
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 : ================ 106 passed, 911 warnings in 4831.75s (1:20:31) ================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 25, 2026
@lpramuk
lpramuk merged commit c86a535 into SatelliteQE:6.17.z Feb 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.17.z 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