Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
chore: add mirror github action
Browse files Browse the repository at this point in the history
  • Loading branch information
aiwantaozi authored and gitlawr committed Aug 30, 2023
1 parent 399da97 commit 48a50c0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/mirror_images.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
6 changes: 6 additions & 0 deletions hack/mirror/mirror_image_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Mirrored images format <registry>/sealio/mirrored-<original-repo>:<tag-with-prefix-v>
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

0 comments on commit 48a50c0

Please sign in to comment.