From 3c280817ab7a3821ee4596f3a6b2653f20f83e7e Mon Sep 17 00:00:00 2001 From: John Collier Date: Tue, 31 May 2022 14:59:45 -0400 Subject: [PATCH] Add image mirror utility and workflow Signed-off-by: John Collier --- .github/workflows/workflow.yml | 35 ++++++++++++++++++++++++++++++++++ image-mirror.sh | 11 +++++++++++ mirror_list.txt | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/workflow.yml create mode 100755 image-mirror.sh create mode 100644 mirror_list.txt diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..d849301 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,35 @@ + +# Copyright (c) 2022 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +name: Mirror Container Images + +on: + push: + branches: [ main ] + schedule: + - cron: 0 5 * * * + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Update packages + run: sudo apt-get -y update + - name: Install Skopeo + run: sudo apt-get -y install skopeo + - name: Login to Quay + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_TOKEN }} + - name: Mirror Container Images + run: ./image-mirror.sh quay.io/devfile diff --git a/image-mirror.sh b/image-mirror.sh new file mode 100755 index 0000000..737dc89 --- /dev/null +++ b/image-mirror.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +DEST_ORG=$1 + +cat mirror_list.txt + +while read -r image_repo; +do + echo "Mirroring $image_repo to $DEST_ORG" + skopeo sync --src docker --dest docker $image_repo $DEST_ORG --override-os linux +done < "mirror_list.txt" diff --git a/mirror_list.txt b/mirror_list.txt new file mode 100644 index 0000000..f2e9a1d --- /dev/null +++ b/mirror_list.txt @@ -0,0 +1,4 @@ +golang:latest +node:lts-slim +node:lts +composer:2.1.11 \ No newline at end of file