Skip to content

Mirror cdxgen Container Images #32

Mirror cdxgen Container Images

Mirror cdxgen Container Images #32

Workflow file for this run

name: Mirror cdxgen Container Images
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
mirror-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Log in to the Container registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Discover and Mirror Images
env:
SOURCE_ORG: cdxgen
SOURCE_REPO: cdxgen
DEST_ORG: cyclonedx
run: |
#!/bin/bash
set -e
IMAGE_NAMES=(
"cdxgen"
"cdxgen-java"
"cdxgen-java-slim"
"cdxgen-java11"
"cdxgen-java11-slim"
"cdxgen-python39"
"cdxgen-deno"
"cdxgen-bun"
"cdxgen-secure"
"cdxgen-ppc64"
"cdxgen-java17"
"cdxgen-java17-slim"
"cdxgen-python313"
"cdxgen-python311"
"cdxgen-python312"
"cdxgen-python310"
"cdxgen-python"
"cdxgen-python36"
"cdxgen-dotnet6"
"cdxgen-dotnet7"
"cdxgen-dotnet8"
"cdxgen-dotnet9"
"cdxgen-golang"
"cdxgen-node"
"cdxgen-node20"
"cdxgen-ruby25"
"cdxgen-ubuntu-dotnet10"
"cdxgen-debian-dotnet8"
"cdxgen-opensuse-python39"
"cdxgen-debian-ruby26"
"cdxgen-debian-ruby33"
"cdxgen-debian-ruby34"
"cdxgen-debian-rust"
"cdxgen-debian-rust1"
"cdxgen-debian-swift"
"cdxgen-debian-swift6"
"cdxgen-temurin-java21"
"cdxgen-temurin-java24"
"cdxgen-temurin-java8"
"cdxgen-alpine-php84"
"cdxgen-alpine-python313"
"cdxgen-alpine-rust1"
"cdxgen-alpine-dotnet9"
"cdxgen-alpine-golang124"
"cdxgen-alpine-node20"
"cdxgen-debian-php83"
"cdxgen-debian-php84"
"cdxgen-alpine-golang123"
"cdxgen-alpine-golang"
"cdxgen-alpine-ruby34"
"cdxgen-alpine-ruby344"
"cdxgen-alpine-ruby345"
"cdxgen-alpine-node24"
"cdxgen-alpine-java24"
"cdxgen-debian-golang124"
"cdxgen-alpine-java21"
"cdxgen-debian-golang123"
"cdxgen-debian-golang"
"cdxgen-debian-dotnet6"
"cdxgen-debian-dotnet9"
"cdxgen-debian-dotnet10"
"cdxgen-opensuse-python310"
"cdxgen-opensuse-rolling"
)
for IMAGE_NAME in "${IMAGE_NAMES[@]}"; do
echo "----------------------------------------"
echo "Processing: ${IMAGE_NAME}"
SOURCE_IMAGE="ghcr.io/${SOURCE_ORG}/${IMAGE_NAME}"
DEST_IMAGE="ghcr.io/${DEST_ORG}/${IMAGE_NAME}"
if ! TAGS=$(skopeo list-tags docker://${SOURCE_IMAGE} 2>/dev/null); then
echo "Image not found or not accessible: ${SOURCE_IMAGE}"
continue
fi
TAGS_ARRAY=$(echo "$TAGS" | jq -r '.Tags[]' 2>/dev/null || echo "")
if [ -z "$TAGS_ARRAY" ]; then
echo "No tags found for: ${SOURCE_IMAGE}"
continue
fi
for TAG in $TAGS_ARRAY; do
echo " Copying: ${TAG}..."
if skopeo copy \
--multi-arch all \
docker://${SOURCE_IMAGE}:${TAG} \
docker://${DEST_IMAGE}:${TAG} 2>&1; then
echo "Success: ${DEST_IMAGE}:${TAG}"
else
echo "Failed: ${DEST_IMAGE}:${TAG}"
fi
done
echo "----------------------------------------"
done
shell: bash