Skip to content

Commit

Permalink
add automation to update ko.yaml for csp updates (#1448)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway authored Feb 4, 2025
1 parent e68e90b commit 3fbd8df
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ updates:
- "/config/**/*"
schedule:
interval: weekly
ignore:
- dependency-name: "cloud-sql-connectors/cloud-sql-proxy"
- package-ecosystem: docker
directories:
- "/"
schedule:
interval: weekly
allow:
- dependency-name: "cloud-sql-connectors/cloud-sql-proxy"
labels:
- "dependencies"
- "docker"
- "cloud-sql-proxy"

- package-ecosystem: gomod
directory: "/"
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cloud-sql-proxy-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cloud-SQL-Proxy update

on:
pull_request:
types: [labeled]

permissions: {}

jobs:
my_job:
runs-on: ubuntu-latest
if: github.event.label.name == 'cloud-sql-proxy'
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: true

- name: Update .ko.yaml with latest release version
run: |
export CLOUD_SQL_PROXY_VERSION="$(awk -F'[:@]' '/FROM gcr.io\/cloud-sql-connectors\/cloud-sql-proxy/{print $2; exit}' Dockerfile.deps)"
echo "Detected cloud-sql-proxy ${CLOUD_SQL_PROXY_VERSION}..."
sed -i 's/\(cloud-sql-proxy:\).*/\1'${CLOUD_SQL_PROXY_VERSION}'/' .ko.yaml
- name: Amend Dependabot PR
env:
PULL_REQUEST_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -sam "Bumping cloud-sql-proxy version in .ko.yaml"
git push origin HEAD:${PULL_REQUEST_HEAD_REF}
2 changes: 1 addition & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
defaultBaseImage: gcr.io/distroless/static-debian12:nonroot
baseImageOverrides:
github.com/sigstore/scaffolding/cmd/cloudsqlproxy: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.3-alpine
github.com/sigstore/scaffolding/cmd/cloudsqlproxy: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.15.0-alpine

builds:
- id: ctlog-createctconfig
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.deps
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This Dockerfile simply serves as a trigger for dependabot to notify when a new upstream release of a component is available
#
# !!! READ AND ACT ON THIS !!! If dependabot proposes an update to the container listed below, you should also update the value listed in '.ko.yaml' and cut a new release of scaffolding
FROM gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.15.0-alpine as cloud-sql-proxy
# This will trigger a Dependabot update, which should trigger a workflow to update .ko.yaml accordingly
FROM gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.15.0-alpine@sha256:7815b33cc48745133a065d32b5f420d6b2572565424d90cd8f4261d9529060f2
ENV FOO=BAR

0 comments on commit 3fbd8df

Please sign in to comment.