From 30b0882872111c2d67730dbad95abba3bc932ce4 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Wed, 11 Jun 2025 12:27:19 +0000 Subject: [PATCH 1/4] chore: move all images to new GCP project --- Makefile | 10 ++++++---- coderd/database/dbtestutil/db.go | 2 +- coderd/database/dbtestutil/postgres.go | 6 ++++-- dogfood/coder/Dockerfile | 2 +- scaletest/templates/scaletest-runner/Dockerfile | 2 +- scaletest/templates/scaletest-runner/main.tf | 2 +- site/src/pages/ChatPage/ChatToolInvocation.stories.tsx | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 0b8cefbab0663..b6e69ac28f223 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,9 @@ GOOS := $(shell go env GOOS) GOARCH := $(shell go env GOARCH) GOOS_BIN_EXT := $(if $(filter windows, $(GOOS)),.exe,) VERSION := $(shell ./scripts/version.sh) -POSTGRES_VERSION ?= 16 + +POSTGRES_VERSION ?= 17 +POSTGRES_IMAGE ?= us-docker.pkg.dev/coder-v2-images-public/public/postgres:$(POSTGRES_VERSION) # Use the highest ZSTD compression level in CI. ifdef CI @@ -949,12 +951,12 @@ test-postgres-docker: docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true # Try pulling up to three times to avoid CI flakes. - docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || { + docker pull ${POSTGRES_IMAGE} || { retries=2 for try in $(seq 1 ${retries}); do echo "Failed to pull image, retrying (${try}/${retries})..." sleep 1 - if docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}; then + if docker pull ${POSTGRES_IMAGE}; then break fi done @@ -982,7 +984,7 @@ test-postgres-docker: --restart no \ --detach \ --memory 16GB \ - gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \ + ${POSTGRES_IMAGE} \ -c shared_buffers=2GB \ -c effective_cache_size=1GB \ -c work_mem=8MB \ diff --git a/coderd/database/dbtestutil/db.go b/coderd/database/dbtestutil/db.go index c76be1ed52a9d..36c2b43372c01 100644 --- a/coderd/database/dbtestutil/db.go +++ b/coderd/database/dbtestutil/db.go @@ -298,7 +298,7 @@ func PGDumpSchemaOnly(dbURL string) ([]byte, error) { "run", "--rm", "--network=host", - fmt.Sprintf("gcr.io/coder-dev-1/postgres:%d", minimumPostgreSQLVersion), + fmt.Sprintf("%s:%d", containerImage, minimumPostgreSQLVersion), }, cmdArgs...) } cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) //#nosec diff --git a/coderd/database/dbtestutil/postgres.go b/coderd/database/dbtestutil/postgres.go index c0b35a03529ca..ee2dcf13e3f02 100644 --- a/coderd/database/dbtestutil/postgres.go +++ b/coderd/database/dbtestutil/postgres.go @@ -26,6 +26,8 @@ import ( "github.com/coder/retry" ) +const containerImage = "us-docker.pkg.dev/coder-v2-images-public/public/postgres" + type ConnectionParams struct { Username string Password string @@ -379,8 +381,8 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro return container{}, nil, xerrors.Errorf("create tempdir: %w", err) } runOptions := dockertest.RunOptions{ - Repository: "gcr.io/coder-dev-1/postgres", - Tag: "13", + Repository: containerImage, + Tag: strconv.Itoa(minimumPostgreSQLVersion), Env: []string{ "POSTGRES_PASSWORD=postgres", "POSTGRES_USER=postgres", diff --git a/dogfood/coder/Dockerfile b/dogfood/coder/Dockerfile index b02775af02fc8..1909722459a18 100644 --- a/dogfood/coder/Dockerfile +++ b/dogfood/coder/Dockerfile @@ -87,7 +87,7 @@ RUN apt-get update && \ rm -rf /tmp/go/src # alpine:3.18 -FROM gcr.io/coder-dev-1/alpine@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 AS proto +FROM us-docker.pkg.dev/coder-v2-images-public/public/alpine@sha256:fd032399cd767f310a1d1274e81cab9f0fd8a49b3589eba2c3420228cd45b6a7 AS proto WORKDIR /tmp RUN apk add curl unzip RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip && \ diff --git a/scaletest/templates/scaletest-runner/Dockerfile b/scaletest/templates/scaletest-runner/Dockerfile index 61409c1018654..37b5ddd3b3ca7 100644 --- a/scaletest/templates/scaletest-runner/Dockerfile +++ b/scaletest/templates/scaletest-runner/Dockerfile @@ -1,6 +1,6 @@ # This image is used to run scaletest jobs and, although it is inside # the template directory, it is built separately and pushed to -# gcr.io/coder-dev-1/scaletest-runner:latest. +# us-docker.pkg.dev/coder-v2-images-public/public/scaletest-runner:latest. # # Future improvements will include versioning and including the version # in the template push. diff --git a/scaletest/templates/scaletest-runner/main.tf b/scaletest/templates/scaletest-runner/main.tf index 450fab44dce6c..26d2d490f0a6b 100644 --- a/scaletest/templates/scaletest-runner/main.tf +++ b/scaletest/templates/scaletest-runner/main.tf @@ -822,7 +822,7 @@ resource "kubernetes_pod" "main" { container { name = "dev" - image = "gcr.io/coder-dev-1/scaletest-runner:latest" + image = "us-docker.pkg.dev/coder-v2-images-public/public/scaletest-runner:latest" image_pull_policy = "Always" command = ["sh", "-c", coder_agent.main.init_script] security_context { diff --git a/site/src/pages/ChatPage/ChatToolInvocation.stories.tsx b/site/src/pages/ChatPage/ChatToolInvocation.stories.tsx index db5d37e2b1007..a05cdd1843354 100644 --- a/site/src/pages/ChatPage/ChatToolInvocation.stories.tsx +++ b/site/src/pages/ChatPage/ChatToolInvocation.stories.tsx @@ -408,7 +408,7 @@ RUN apt-get update && \ rm -rf /tmp/go/src # alpine:3.18 -FROM gcr.io/coder-dev-1/alpine@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 AS proto +FROM us-docker.pkg.dev/coder-v2-images-public/public/alpine@sha256:fd032399cd767f310a1d1274e81cab9f0fd8a49b3589eba2c3420228cd45b6a7 AS proto WORKDIR /tmp RUN apk add curl unzip RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip && \ From b04a6ff59c68d2ffd3885e8ff2991516ea1c35ed Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Wed, 11 Jun 2025 12:37:08 +0000 Subject: [PATCH 2/4] nit --- coderd/database/dbtestutil/db.go | 2 +- coderd/database/dbtestutil/postgres.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coderd/database/dbtestutil/db.go b/coderd/database/dbtestutil/db.go index 36c2b43372c01..fa3567c490826 100644 --- a/coderd/database/dbtestutil/db.go +++ b/coderd/database/dbtestutil/db.go @@ -298,7 +298,7 @@ func PGDumpSchemaOnly(dbURL string) ([]byte, error) { "run", "--rm", "--network=host", - fmt.Sprintf("%s:%d", containerImage, minimumPostgreSQLVersion), + fmt.Sprintf("%s:%d", postgresImage, minimumPostgreSQLVersion), }, cmdArgs...) } cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) //#nosec diff --git a/coderd/database/dbtestutil/postgres.go b/coderd/database/dbtestutil/postgres.go index ee2dcf13e3f02..e282da583a43b 100644 --- a/coderd/database/dbtestutil/postgres.go +++ b/coderd/database/dbtestutil/postgres.go @@ -26,7 +26,7 @@ import ( "github.com/coder/retry" ) -const containerImage = "us-docker.pkg.dev/coder-v2-images-public/public/postgres" +const postgresImage = "us-docker.pkg.dev/coder-v2-images-public/public/postgres" type ConnectionParams struct { Username string @@ -381,7 +381,7 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro return container{}, nil, xerrors.Errorf("create tempdir: %w", err) } runOptions := dockertest.RunOptions{ - Repository: containerImage, + Repository: postgresImage, Tag: strconv.Itoa(minimumPostgreSQLVersion), Env: []string{ "POSTGRES_PASSWORD=postgres", From 18ef355605a823633eff9c579ab9ec0593a8c690 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Wed, 11 Jun 2025 12:44:03 +0000 Subject: [PATCH 3/4] fix --- .github/workflows/ci.yaml | 6 +++--- docker-compose.yaml | 2 +- docs/tutorials/reverse-proxy-caddy.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cd1b262066dc4..db83f84e073c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -582,7 +582,7 @@ jobs: # NOTE: this could instead be defined as a matrix strategy, but we want to # only block merging if tests on postgres 13 fail. Using a matrix strategy # here makes the check in the above `required` job rather complicated. - test-go-pg-16: + test-go-pg-17: runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }} needs: - changes @@ -613,11 +613,11 @@ jobs: id: download-cache uses: ./.github/actions/test-cache/download with: - key-prefix: test-go-pg-16-${{ runner.os }}-${{ runner.arch }} + key-prefix: test-go-pg-17-${{ runner.os }}-${{ runner.arch }} - name: Test with PostgreSQL Database env: - POSTGRES_VERSION: "16" + POSTGRES_VERSION: "17" TS_DEBUG_DISCO: "true" TEST_RETRIES: 2 run: | diff --git a/docker-compose.yaml b/docker-compose.yaml index d7d5c3ad6fbb1..5f1a1c8b4779e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,7 +31,7 @@ services: database: # Minimum supported version is 13. # More versions here: https://hub.docker.com/_/postgres - image: "postgres:16" + image: "postgres:17" ports: - "5432:5432" environment: diff --git a/docs/tutorials/reverse-proxy-caddy.md b/docs/tutorials/reverse-proxy-caddy.md index 5f14745f4868c..d915687cad428 100644 --- a/docs/tutorials/reverse-proxy-caddy.md +++ b/docs/tutorials/reverse-proxy-caddy.md @@ -39,7 +39,7 @@ certificates, you'll need a domain name that resolves to your Caddy server. condition: service_healthy database: - image: "postgres:16" + image: "postgres:17" ports: - "5432:5432" environment: From 7a31049422e7498bc0020e469d8481a0a4996828 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Wed, 11 Jun 2025 12:54:23 +0000 Subject: [PATCH 4/4] fix 2 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index db83f84e073c7..b0c73ff5b2097 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -719,7 +719,7 @@ jobs: # c.f. discussion on https://github.com/coder/coder/pull/15106 - name: Run Tests env: - POSTGRES_VERSION: "16" + POSTGRES_VERSION: "17" run: | make test-postgres-docker DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4