diff --git a/.github/workflows/mirror-dockerhub-ghcr.yaml b/.github/workflows/mirror-dockerhub-ghcr.yaml index 013e8be..718939a 100644 --- a/.github/workflows/mirror-dockerhub-ghcr.yaml +++ b/.github/workflows/mirror-dockerhub-ghcr.yaml @@ -3,7 +3,7 @@ name: Docker Image Sync with Skopeo on: push: branches: - - feat/CTO-844_basic_image_mirror # or any other trigger you prefer + - feat/CTO-844_basic_image_mirror jobs: sync_images: @@ -24,29 +24,30 @@ jobs: - name: Pull and Push Images run: | # File containing list of images - IMAGE_LIST="infra-images.yaml" + IMAGE_LIST="./infra-images.yaml" # Loop through each registry and image in the YAML file - for registry in $(yq eval '. | keys | .[]' $IMAGE_LIST); do + for registry in $(yq '. | keys | .[]' "${IMAGE_LIST}"); do - # Loop through each image tag for this registry - for image in $(yq eval ".${registry}[]" $IMAGE_LIST); do + # Loop through each image tag for this registry + for image in $(yq ".${registry}[]" "${IMAGE_LIST}"); do - # Extract the image tag (e.g., nginx:latest) - tag=$(echo $image | cut -d':' -f2) - image_name=$(echo $image | cut -d':' -f1) + # Extract the image tag (e.g., nginx:1.0.0) + # and strip quotes + registry=$(echo "${registry}" | tr -d '"') + tag=$(echo "${image}" | cut -d':' -f2 | tr -d '"') + image_name=$(echo "${image}" | cut -d':' -f1 | tr -d '"') - # Construct the full source image path - SOURCE_IMAGE="docker://$registry/$image_name:$tag" + # Construct the full source image path + SOURCE_IMAGE="docker://${registry}/${image_name}:${tag}" - # Define destination image on GHCR - GHCR_IMAGE="docker://ghcr.io/${{ github.repository_owner }}/infra/$image_name:$tag" - - # Copy the image from the source registry to GitHub Packages (GHCR) - skopeo copy $SOURCE_IMAGE $GHCR_IMAGE - - done + # Define destination image on GHCR + GHCR_IMAGE="docker://ghcr.io/${{ github.repository_owner }}/${image_name}:${tag}" + # Copy the image from the source registry to GitHub Packages (GHCR) + echo "${SOURCE_IMAGE}" "${GHCR_IMAGE}" + done done + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/infra-images.yaml b/infra-images.yaml index f97fa9a..fec493d 100644 --- a/infra-images.yaml +++ b/infra-images.yaml @@ -27,8 +27,8 @@ docker.io: # - sonatype/nexus3:3.75.1 # - velero/velero-plugin-for-aws:v1.10.1 # - velero/velero:v1.14.1 -# xpkg.upbound.io: -# - crossplane-contrib/function-go-templating:v0.8.0 +xpkg.upbound.io: +- crossplane-contrib/function-go-templating:v0.8.0 # - crossplane-contrib/function-patch-and-transform:v0.2.1 # - crossplane-contrib/provider-ansible:v0.6.0 # - crossplane-contrib/provider-aws:v0.49.2