Skip to content

Commit

Permalink
Improve skopeo execution (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored Jul 12, 2023
1 parent 507b24f commit 40a3487
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/dockerhub-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ jobs:
sudo apt-get install python3-pip
sudo pip3 install yq
- name: πŸ”† Install skopeo
- name: πŸ”† Setup skopeo
run: |
. /etc/os-release
# Update ca-certificates to avoid issues with letsencrypt SSL certificates
sudo apt update && sudo apt --only-upgrade install ca-certificates -y
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
sudo apt update && sudo apt install -y skopeo
# Generate a temporal file to store skopeo auth
echo "SKOPEO_AUTH_FILE=$(mktemp)" >> $GITHUB_ENV
# Build a fake skopeo script to run a container
cat <<'EOF' > /usr/local/bin/skopeo
#/bin/bash
docker run --rm -v $SKOPEO_AUTH_FILE:/skopeo.auth -e REGISTRY_AUTH_FILE=/skopeo.auth quay.io/skopeo/stable:v1.12.0 "$@"
EOF
chmod +x /usr/local/bin/skopeo
- name: ☁️ Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1.1.1
Expand All @@ -58,21 +62,21 @@ jobs:

- name: ✍🏽 Login to GAR using skopeo
run: |
sudo skopeo login -u oauth2accesstoken --password=${{ steps.auth.outputs.access_token }} ${{env.GAR_IMAGE_REGISTRY}}
sudo -E skopeo login -u oauth2accesstoken --password=${{ steps.auth.outputs.access_token }} ${{env.GAR_IMAGE_REGISTRY}}
- name: ✍🏽 Login to Docker Hub using skopeo
env:
docker_user: ${{ secrets.DOCKERHUB_USER_NAME }}
docker_password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
run: |
sudo skopeo login -u ${{ env.docker_user }} --password=${{ env.docker_password }} ${{ env.DH_IMAGE_REGISTRY }}
sudo -E skopeo login -u ${{ env.docker_user }} --password=${{ env.docker_password }} ${{ env.DH_IMAGE_REGISTRY }}
- name: 🐳 Sync latest tag of images to Docker Hub
run: |
IMAGES=$(cat .github/promote-images.yml | yq '."europe-docker.pkg.dev/gitpod-artifacts/docker-dev"."images-by-tag-regex"|keys[]' -r)
for IMAGE in $IMAGES;
do
sudo skopeo copy --format=oci --dest-oci-accept-uncompressed-layers \
sudo -E skopeo copy --format=oci --dest-oci-accept-uncompressed-layers \
docker://${{ env.GAR_IMAGE_REGISTRY }}/gitpod-artifacts/docker-dev/$IMAGE:latest \
docker://${{ env.DH_IMAGE_REGISTRY }}/gitpod/$IMAGE:latest
done

0 comments on commit 40a3487

Please sign in to comment.