Skip to content

Commit

Permalink
push tags
Browse files Browse the repository at this point in the history
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
  • Loading branch information
sarathchandra24 committed Mar 9, 2024
1 parent 24ee683 commit 384ce47
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clone-docker-image-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
needs: check-image-exists
strategy:
matrix:
image_tags: ${{ fromJson(inputs.image_tags) }}
image_tags: ${{inputs.image_tags}}
runs-on: ubuntu-latest
steps:
- name: Promote container images from ${{ inputs.source_registry }} to ${{ inputs.target_registry }}
Expand Down
60 changes: 25 additions & 35 deletions .github/workflows/clone-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,39 +81,29 @@ jobs:
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}

# - name: Copy images
# run: |
# # Get the list of tags from metadata action output
# TAGS=$(echo "${{ steps.release-metadata.outputs.tags }}")
- name: Copy images
run: |
# Get the list of tags from metadata action output
TAGS=$(echo "${{ steps.release-metadata.outputs.tags }}")
# # Loop through each tag and copy the image
# echo "Total tags: $TAGS"
# echo "$TAGS"
# echo "$TAGS" | while IFS= read -r tag; do
# echo "Copying $tag"
# skopeo copy --src-creds=$SOURCE_CREDS --dest-creds=$RELEASE_CREDS \
# "docker://$SOURCE_IMAGE:$tag" \
# "docker://$RELEASE_IMAGE:$tag"
# done
# env:
# SOURCE_IMAGE: "ghcr.io/${{env.GITHUB_IMAGE}}"
# RELEASE_IMAGE: "docker.io/${{env.DOCKER_REPO}}/${{ env.DOCKER_IMAGE }}"
# RELEASE_CREDS: "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASSWORD}}"
# SOURCE_CREDS: "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"

clone-docker-image:
uses: ./.github/workflows/clone-docker-image-action.yaml
needs: copy_images_metadata
with:
source_image: "${{needs.copy_images_metadata.outputs.github_image}}"
source_registry: ghcr.io
target_image: "]${{needs.copy_images_metadata.outputs.docker_image_repo}}/${{ needs.copy_images_metadata.outputs.docker_image_name }}"
target_registry: docker.io
platforms: "['linux/arm64', 'linux/amd64']"
image_tags: ${{ needs.copy_images_metadata.outputs.image_tags }}
secrets:
source_registry_token: ${{ secrets.GITHUB_TOKEN }}
target_registry_token: ${{ secrets.REGISTRY_PASSWORD }}
source_registry_username: ${{ github.actor }}
target_registry_username: ${{ secrets.REGISTRY_USER }}

# Loop through each tag and copy the image
echo "Total tags: $TAGS"
echo "$TAGS"
echo "$TAGS" | while IFS= read -r tag; do
echo "Copying $tag"
docker run --rm \
quay.io/skopeo/stable:latest \
copy \
--all \
--retry-times 10 \
--dest-creds "$RELEASE_CREDS" \
--src-creds "$SOURCE_CREDS" \
"docker://$SOURCE_IMAGE:$tag" \
"docker://$RELEASE_IMAGE:$tag"
done
env:
SOURCE_IMAGE: "ghcr.io/${{env.GITHUB_IMAGE}}"
RELEASE_IMAGE: "docker.io/${{env.DOCKER_REPO}}/${{ env.DOCKER_IMAGE }}"
RELEASE_CREDS: "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASSWORD}}"
SOURCE_CREDS: "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"

0 comments on commit 384ce47

Please sign in to comment.