Skip to content

Commit

Permalink
fix: Pushing of image and getting its sha256 swapped! (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniotarricone authored May 29, 2024
1 parent 93487d5 commit a19268b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-n-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ jobs:
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push -a ghcr.io/${{ github.repository }}
#
# Get sha256 of Docker image.
#
- name: Get sha256 of Docker image
run: echo "image_sha256=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:$BRANCH_NAME | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"

#
# Login to Azure.
#
Expand All @@ -131,5 +137,4 @@ jobs:
with:
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
az containerapp update -n ${{ secrets.AZURE_CONTAINER_APP_NAME }} -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} -image ghcr.io/${{ github.repository }}:$BRANCH_NAME
az containerapp update -n ${{ secrets.AZURE_CONTAINER_APP_NAME }} -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} -i ${{ env.image_sha256 }}
32 changes: 16 additions & 16 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ jobs:
#
- name: RELEASE CANDIDATE - Build Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC -t ghcr.io/${{ github.repository }}:${{ github.sha }}-RC .

#
# RELEASE CANDICATE - Get sha256 of Docker image.
#
- name: RELEASE CANDIDATE - Get sha256 of Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "image_sha256_rc=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC .

#
# RELEASE CANDIDATE - Push Docker image.
Expand All @@ -160,6 +153,13 @@ jobs:
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push -a ghcr.io/${{ github.repository }}
#
# RELEASE CANDICATE - Get sha256 of Docker image.
#
- name: RELEASE CANDIDATE - Get sha256 of Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "image_sha256_rc=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"

#
# Login to Azure.
#
Expand Down Expand Up @@ -258,14 +258,7 @@ jobs:
#
- name: STABLE - Build Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:latest -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} -t ghcr.io/${{ github.repository }}:${{ github.sha }} .

#
# STABLE - Get sha256 of Docker image.
#
- name: STABLE - Get sha256 of Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "image_sha256=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
run: docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/${{ github.repository }}:latest -t ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} .

#
# STABLE - Push Docker image.
Expand All @@ -276,6 +269,13 @@ jobs:
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push -a ghcr.io/${{ github.repository }}
#
# STABLE - Get sha256 of Docker image.
#
- name: STABLE - Get sha256 of Docker image
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "image_sha256=$(docker image inspect -f '{{index .RepoDigests 0}}' ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"

#
# STABLE - Update Container App.
#
Expand Down

0 comments on commit a19268b

Please sign in to comment.