From 48a50c01a0f8c711bb45613d9b7685de307dd3ed Mon Sep 17 00:00:00 2001 From: michelia Date: Wed, 30 Aug 2023 10:44:16 +0800 Subject: [PATCH] chore: add mirror github action --- .github/workflows/mirror_images.yml | 50 +++++++++++++++++++++++++++++ hack/mirror/mirror_image_list.txt | 6 ++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/mirror_images.yml create mode 100644 hack/mirror/mirror_image_list.txt diff --git a/.github/workflows/mirror_images.yml b/.github/workflows/mirror_images.yml new file mode 100644 index 000000000..885bb1309 --- /dev/null +++ b/.github/workflows/mirror_images.yml @@ -0,0 +1,50 @@ +name: Mirror images + +permissions: + contents: write + pull-requests: read + actions: write + +defaults: + run: + shell: bash + +on: + push: + paths: + - "hack/mirror/mirror_image_list.txt" + workflow_dispatch: {} + +jobs: + mirror-images: + timeout-minutes: 10 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + persist-credentials: false + - uses: imjasonh/setup-crane@v0.1 + with: + version: v0.16.1 + - name: Mirror images + shell: bash + run: | + set -euo pipefail + + # login to dockerhub + crane auth login docker.io -u ${{ secrets.CI_DOCKERHUB_USERNAME }} -p ${{ secrets.CI_DOCKERHUB_PASSWORD }} + + # mirror images + while IFS= read -r line; do + if [[ "$line" == \#* ]]; then + continue + fi + + source_image=$(echo "$line" | awk '{print $1}') + target_image=$(echo "$line" | awk '{print $2}') + + echo "Mirror image $source_image to $target_image" + crane copy $source_image $target_image + done < ${{ github.workspace }}/hack/mirror/mirror_image_list.txt diff --git a/hack/mirror/mirror_image_list.txt b/hack/mirror/mirror_image_list.txt new file mode 100644 index 000000000..ea5224410 --- /dev/null +++ b/hack/mirror/mirror_image_list.txt @@ -0,0 +1,6 @@ +# Mirrored images format /sealio/mirrored-: +quay.io/prometheus/node-exporter:v1.6.0 docker.io/sealio/mirrored-node-exporter:v1.6.0 +quay.io/prometheus-operator/prometheus-config-reloader:v0.67.0 docker.io/sealio/mirrored-prometheus-config-reloader:v0.67.0 +quay.io/prometheus/prometheus:v2.46.0 docker.io/sealio/mirrored-prometheus:v2.46.0 +registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.9.2 docker.io/sealio/mirrored-kube-state-metrics:v2.9.2 +quay.io/kubecost1/kubecost-cost-model:1.105.2 docker.io/sealio/mirrored-kubecost-cost-model:v1.105.2