Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add immutable binaries to update images workflow #4879

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/update-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
outputs:
kic-tag: ${{ steps.kic.outputs.tag }}
versions: ${{ steps.versions.outputs.matrix }}
go-md5: ${{ steps.md5.outputs.go_code_md5 }}
binary-cache-hit: ${{ steps.binary-cache.outputs.cache-hit }}
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand All @@ -53,6 +55,18 @@ jobs:
nginx_ubi=$(grep -m1 "FROM nginxcontrib/nginx:" < build/Dockerfile | awk -F" " '{print $2}')
echo "matrix=[{\"version\": \"${nginx}\", \"distro\": \"debian\"}, {\"version\": \"${nginx_alpine}\", \"distro\": \"alpine\"}, {\"version\": \"${nginx_ubi}\", \"distro\": \"ubi\"}]" >> $GITHUB_OUTPUT

- name: Set Go MD5sums
id: md5
run: echo go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }') >> $GITHUB_OUTPUT

- name: Fetch Cached Binary Artifacts
id: binary-cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ${{ github.workspace }}/dist
key: nginx-ingress-${{ steps.md5.outputs.go_code_md5 }}
lookup-only: true

check:
name: Check if updates are needed
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -112,12 +126,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: ${{ steps.go.outputs.go_path }}
if: ${{ needs.variables.outputs.binary-cache-hit != 'true' }}

- name: Store Artifacts in Cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ${{ github.workspace }}/dist
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}
key: nginx-ingress-${{ needs.variables.outputs.go-md5 }}
if: ${{ needs.variables.outputs.binary-cache-hit != 'true' }}

release-docker-debian:
name: Release Debian Image
Expand All @@ -127,6 +143,7 @@ jobs:
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
image: debian
tag: ${{ needs.variables.outputs.kic-tag }}
go-md5: ${{ needs.variables.outputs.go-md5 }}
permissions:
contents: read
actions: read
Expand All @@ -144,6 +161,7 @@ jobs:
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
image: alpine
tag: ${{ needs.variables.outputs.kic-tag }}
go-md5: ${{ needs.variables.outputs.go-md5 }}
permissions:
contents: read
actions: read
Expand All @@ -161,6 +179,7 @@ jobs:
platforms: linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
image: ubi
tag: ${{ needs.variables.outputs.kic-tag }}
go-md5: ${{ needs.variables.outputs.go-md5 }}
permissions:
contents: read
actions: read
Expand Down
Loading