Skip to content

Commit

Permalink
Use the right sha in metadata for Update Docker Images action (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Oct 14, 2021
1 parent d6f890f commit a486967
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/update-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
outputs:
kic-tag: ${{ steps.kic.outputs.tag }}
versions: ${{ steps.versions.outputs.matrix }}
sha_short: ${{ steps.vars.outputs.sha }}
sha_short: ${{ steps.vars.outputs.sha_short }}
sha_long: ${{ steps.vars.outputs.sha_long }}
go_version: ${{ steps.vars.outputs.go_version }}
k8s_version: ${{ steps.vars.outputs.k8s_version }}
steps:
Expand All @@ -37,7 +38,7 @@ jobs:
- name: Checkout Repository at ${{ steps.kic.outputs.tag }}
uses: actions/checkout@v2
with:
ref: v${{ steps.kic.outputs.tag }}
ref: refs/tags/v${{ steps.kic.outputs.tag }}
- name: Set NGINX versions
id: versions
run: |
Expand All @@ -48,7 +49,8 @@ jobs:
- name: Set other variables
id: vars
run: |
echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=sha_long::$(git rev-parse HEAD)"
echo "::set-output name=go_version::$(grep "go 1." go.mod | cut -d " " -f 2)"
echo "::set-output name=k8s_version::$(grep "K8S_VERSION:" .github/workflows/ci.yml | awk -F" " '{print $2}')"
Expand Down Expand Up @@ -89,7 +91,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: v${{ needs.variables.outputs.kic-tag }}
ref: refs/tags/v${{ needs.variables.outputs.kic-tag }}
- name: Setup Golang Environment
uses: actions/setup-go@v2
with:
Expand Down Expand Up @@ -138,7 +140,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: v${{ needs.variables.outputs.kic-tag }}
ref: refs/tags/v${{ needs.variables.outputs.kic-tag }}
if: ${{ matrix.needs-updating == 'true' }}
- name: Fetch Cached Artifacts
uses: actions/cache@v2
Expand Down Expand Up @@ -202,6 +204,7 @@ jobs:
org.opencontainers.image.description=NGINX Ingress Controller for Kubernetes
org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
org.opencontainers.image.vendor=NGINX Inc <[email protected]>
org.opencontainers.image.revision=${{ needs.variables.outputs.sha_long }}
if: ${{ matrix.needs-updating == 'true' }}
- name: Push to Dockerhub
id: push
Expand Down Expand Up @@ -278,7 +281,7 @@ jobs:
},
{
title: "Commit Hash",
value: "${{ needs.variables.outputs.sha_short }}",
value: `<https://github.com/${{ github.repository }}/commit/${{ needs.variables.outputs.sha_long }}|${{ needs.variables.outputs.sha_short }}>`,
short: true
}],
footer: "Update DockerHub Image",
Expand Down

0 comments on commit a486967

Please sign in to comment.