Skip to content

Commit 74073cf

Browse files
committed
Merge remote-tracking branch 'origin/main' into stevenmasley/4mb
2 parents bb3d4ef + ae3882a commit 74073cf

File tree

22 files changed

+168
-108
lines changed

22 files changed

+168
-108
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ jobs:
582582
# NOTE: this could instead be defined as a matrix strategy, but we want to
583583
# only block merging if tests on postgres 13 fail. Using a matrix strategy
584584
# here makes the check in the above `required` job rather complicated.
585-
test-go-pg-16:
585+
test-go-pg-17:
586586
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
587587
needs:
588588
- changes
@@ -613,11 +613,11 @@ jobs:
613613
id: download-cache
614614
uses: ./.github/actions/test-cache/download
615615
with:
616-
key-prefix: test-go-pg-16-${{ runner.os }}-${{ runner.arch }}
616+
key-prefix: test-go-pg-17-${{ runner.os }}-${{ runner.arch }}
617617

618618
- name: Test with PostgreSQL Database
619619
env:
620-
POSTGRES_VERSION: "16"
620+
POSTGRES_VERSION: "17"
621621
TS_DEBUG_DISCO: "true"
622622
TEST_RETRIES: 2
623623
run: |
@@ -719,7 +719,7 @@ jobs:
719719
# c.f. discussion on https://github.com/coder/coder/pull/15106
720720
- name: Run Tests
721721
env:
722-
POSTGRES_VERSION: "16"
722+
POSTGRES_VERSION: "17"
723723
run: |
724724
make test-postgres-docker
725725
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ GOOS := $(shell go env GOOS)
3636
GOARCH := $(shell go env GOARCH)
3737
GOOS_BIN_EXT := $(if $(filter windows, $(GOOS)),.exe,)
3838
VERSION := $(shell ./scripts/version.sh)
39-
POSTGRES_VERSION ?= 16
39+
40+
POSTGRES_VERSION ?= 17
41+
POSTGRES_IMAGE ?= us-docker.pkg.dev/coder-v2-images-public/public/postgres:$(POSTGRES_VERSION)
4042

4143
# Use the highest ZSTD compression level in CI.
4244
ifdef CI
@@ -949,12 +951,12 @@ test-postgres-docker:
949951
docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
950952

951953
# Try pulling up to three times to avoid CI flakes.
952-
docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || {
954+
docker pull ${POSTGRES_IMAGE} || {
953955
retries=2
954956
for try in $(seq 1 ${retries}); do
955957
echo "Failed to pull image, retrying (${try}/${retries})..."
956958
sleep 1
957-
if docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}; then
959+
if docker pull ${POSTGRES_IMAGE}; then
958960
break
959961
fi
960962
done
@@ -982,7 +984,7 @@ test-postgres-docker:
982984
--restart no \
983985
--detach \
984986
--memory 16GB \
985-
gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \
987+
${POSTGRES_IMAGE} \
986988
-c shared_buffers=2GB \
987989
-c effective_cache_size=1GB \
988990
-c work_mem=8MB \

coderd/agentapi/audit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestAuditReport(t *testing.T) {
135135
},
136136
})
137137

138-
mAudit.Contains(t, database.AuditLog{
138+
require.True(t, mAudit.Contains(t, database.AuditLog{
139139
Time: dbtime.Time(tt.time).In(time.UTC),
140140
Action: agentProtoConnectionActionToAudit(t, *tt.action),
141141
OrganizationID: workspace.OrganizationID,
@@ -146,7 +146,7 @@ func TestAuditReport(t *testing.T) {
146146
ResourceTarget: agent.Name,
147147
Ip: pqtype.Inet{Valid: true, IPNet: net.IPNet{IP: net.ParseIP(tt.ip), Mask: net.CIDRMask(32, 32)}},
148148
StatusCode: tt.status,
149-
})
149+
}))
150150

151151
// Check some additional fields.
152152
var m map[string]any

coderd/database/db2sdk/db2sdk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ func WorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordinator,
378378

379379
workspaceAgent := codersdk.WorkspaceAgent{
380380
ID: dbAgent.ID,
381+
ParentID: dbAgent.ParentID,
381382
CreatedAt: dbAgent.CreatedAt,
382383
UpdatedAt: dbAgent.UpdatedAt,
383384
ResourceID: dbAgent.ResourceID,

coderd/database/dbtestutil/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func PGDumpSchemaOnly(dbURL string) ([]byte, error) {
298298
"run",
299299
"--rm",
300300
"--network=host",
301-
fmt.Sprintf("gcr.io/coder-dev-1/postgres:%d", minimumPostgreSQLVersion),
301+
fmt.Sprintf("%s:%d", postgresImage, minimumPostgreSQLVersion),
302302
}, cmdArgs...)
303303
}
304304
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) //#nosec

coderd/database/dbtestutil/postgres.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"github.com/coder/retry"
2727
)
2828

29+
const postgresImage = "us-docker.pkg.dev/coder-v2-images-public/public/postgres"
30+
2931
type ConnectionParams struct {
3032
Username string
3133
Password string
@@ -379,8 +381,8 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
379381
return container{}, nil, xerrors.Errorf("create tempdir: %w", err)
380382
}
381383
runOptions := dockertest.RunOptions{
382-
Repository: "gcr.io/coder-dev-1/postgres",
383-
Tag: "13",
384+
Repository: postgresImage,
385+
Tag: strconv.Itoa(minimumPostgreSQLVersion),
384386
Env: []string{
385387
"POSTGRES_PASSWORD=postgres",
386388
"POSTGRES_USER=postgres",

coderd/files/cache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ type fetcher func(context.Context, uuid.UUID) (cacheEntryValue, error)
134134
// calls for the same fileID will only result in one fetch, and that parallel
135135
// calls for distinct fileIDs will fetch in parallel.
136136
//
137-
// Every call to Acquire must have a matching call to Release.
137+
// Safety: Every call to Acquire that does not return an error must have a
138+
// matching call to Release.
138139
func (c *Cache) Acquire(ctx context.Context, fileID uuid.UUID) (fs.FS, error) {
139140
// It's important that this `Load` call occurs outside of `prepare`, after the
140141
// mutex has been released, or we would continue to hold the lock until the

coderd/parameters_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func TestDynamicParametersWithTerraformValues(t *testing.T) {
276276
EnableDynamicParameters: ptr.Ref(true),
277277
})
278278
require.NoError(t, err)
279-
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, wrk.LatestBuild.ID)
279+
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, bld.ID)
280280

281281
latestParams, err := setup.client.WorkspaceBuildParameters(ctx, bld.ID)
282282
require.NoError(t, err)

coderd/userauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,10 +1577,10 @@ func TestUserOIDC(t *testing.T) {
15771577
})
15781578
require.Equal(t, http.StatusOK, resp.StatusCode)
15791579

1580-
auditor.Contains(t, database.AuditLog{
1580+
require.True(t, auditor.Contains(t, database.AuditLog{
15811581
ResourceType: database.ResourceTypeUser,
15821582
AdditionalFields: json.RawMessage(`{"automatic_actor":"coder","automatic_subsystem":"dormancy"}`),
1583-
})
1583+
}))
15841584
me, err := client.User(ctx, "me")
15851585
require.NoError(t, err)
15861586

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
database:
3232
# Minimum supported version is 13.
3333
# More versions here: https://hub.docker.com/_/postgres
34-
image: "postgres:16"
34+
image: "postgres:17"
3535
ports:
3636
- "5432:5432"
3737
environment:

0 commit comments

Comments
 (0)