Skip to content

Commit

Permalink
add scripts for mirroring images
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyankasaggu11929 committed Mar 31, 2022
1 parent aa56886 commit a5fa295
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ periodics:
testgrid-tab-name: periodics
labels:
preset-dind-enabled: "true"
preset-aws-credential: "true"
spec:
containers:
- image: public.ecr.aws/t0q8k6g2/vagator/test-image:v20222903-be6db42
Expand Down
26 changes: 26 additions & 0 deletions scripts/mirror-images/source-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
gcr.io:
images:
k8s-prow/hook: []
k8s-prow/sinker: []
k8s-prow/deck: []
k8s-prow/horologium: []
k8s-prow/status-reconciler: []
k8s-prow/ghproxy: []
k8s-prow/prow-controller-manager: []
k8s-prow/crier: []
k8s-prow/checkconfig: []
k8s-prow/clonerefs: []
k8s-prow/initupload: []
k8s-prow/entrypoint: []
k8s-prow/sidecar: []
k8s-staging-boskos/boskos: []
k8s-staging-boskos/aws-janitor-boskos: []
k8s-staging-boskos/cleaner: []
k8s-staging-boskos/reaper: []
k8s-testgrid/summarizer: []
k8s-testgrid/updater: []

ghcr.io:
images:
external-secrets/kubernetes-external-secrets: []

51 changes: 51 additions & 0 deletions scripts/mirror-images/sync-upstream-images-with-ecr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh

AWS_REGION="us-east-2"
ECR_REGISTRY_TOKEN="t0q8k6g2"

ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
mkdir -p "$ARTIFACTS/logs/"

# list of image repositories to sync in internal ecr
declare -a images=(
"another-test"
"hook"
"sinker"
"deck"
"horologium"
"status-reconciler"
"ghproxy"
"prow-controller-manager"
"crier"
"checkconfig"
"clonerefs"
"initupload"
"entrypoint"
"sidecar"
"kubernetes-external-secrets"
"boskos"
"aws-janitor-boskos"
"cleaner"
"reaper"
"summarizer"
"updater"
)

# Logging to the ECR registry
echo "[INFO] Logging to ECR registry ..."
printf '~%.0s' {1..80}; echo
aws ecr-public get-login-password --region ${AWS_REGION} | skopeo login --username AWS --password-stdin public.ecr.aws

# Create ecr-public repostories
echo "[INFO] Checking ECR Repository ..."
printf '~%.0s' {1..80}; echo
for repository_name in "${images[@]}"
do
aws ecr-public describe-repositories --repository-names ${repository_name} --region ${AWS_REGION} >> $ARTIFACTS/logs/aws-ecr-public.log || aws ecr-public create-repository --repository-name ${repository_name} --region ${AWS_REGION} >> $ARTIFACTS/logs/aws-ecr-public.log
done

# Sync the upstream/third-party image tags with internal ecr images

echo "[INFO] Starting syncing images to ECR..."
printf '~%.0s' {1..80}; echo
skopeo sync --src yaml source-images.yaml --dest docker public.ecr.aws/${ECR_REGISTRY_TOKEN}/ --keep-going

0 comments on commit a5fa295

Please sign in to comment.