Skip to content

[patch] add support for creating required repositories in aws ecr #1625

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

terenceq
Copy link
Contributor

@terenceq terenceq commented Jun 3, 2025

AWS Elastic Container Registry mirroring support

Provide support for mirroring images to AWS Elastic Container Registry (ECR) instances.

Description

This PR directly depends on the ansible-devops PR:

Modifications have been made to the cli commands mirror_images and mirror_redhat to support mirroring to ECR.

Two new options have been added to each of the mirroring commands:

      # AWS Elastic Container Registry
      -e|--target-is-ecr)
        REGISTRY_IS_ECR=true
        ;;
      -r|--aws-ecr-region)
        REGISTRY_ECR_AWS_REGION=$1 && shift
        ;;

which are used to indicate that ECR is the target registry and the region where the AWS ECR instance is located.

A pre-requisite is the configure the AWS CLI command line with the applicable credentials. This is required so that the AWS CLI can be used to create the required repositories in the ECR instance. An ECR token must also be obtained - and then the mirroring commands can be invoked similar to:

#!/bin/bash

# Destination registry
export REGISTRY_PRIVATE_HOST=<ecr host>
export REGISTRY_PREFIX=250501
export REGISTRY_PRIVATE_PORT=443
export REGISTRY_USERNAME=AWS
export REGISTRY_PASSWORD=<ecr login token>

MIRROR_TARGET_IS_ECR=true
AWS_ECR_REGION=us-east-1

# Source registry
export IBM_ENTITLEMENT_KEY=<your IBM entitlement key>


mas mirror-images \
  --mode to-filesystem \
  --dir /tmp/mirror \
  -H $REGISTRY_PRIVATE_HOST -P $REGISTRY_PRIVATE_PORT \
  -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD \
  -c v9-250501-amd64 \
  -C 9.0.x \
  --no-confirm \
  -e \
  -r $AWS_ECR_REGION \
  -x $REGISTRY_PREFIX \
  --mirror-db2

Test Results

Successfully mirrored several catalogs/channels to various AWS ECR instances.


⚠️ Notes for Reviewers

  • Ensure you have understood the PR guidelines in the Playbook before proceeding with a review.
  • Ensure all sections in the PR template are appropriately completed.

@terenceq terenceq marked this pull request as ready for review July 10, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant