Skip to content

Commit 328854d

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into bq/notifications-widget
2 parents a696bd7 + 13d0dac commit 328854d

File tree

92 files changed

+5566
-485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+5566
-485
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated files
22
agent/agentcontainers/acmock/acmock.go linguist-generated=true
3+
agent/agentcontainers/dcspec/dcspec_gen.go linguist-generated=true
34
coderd/apidoc/docs.go linguist-generated=true
45
docs/reference/api/*.md linguist-generated=true
56
docs/reference/cli/*.md linguist-generated=true

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ jobs:
10451045
fetch-depth: 0
10461046

10471047
- name: GHCR Login
1048-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
1048+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
10491049
with:
10501050
registry: ghcr.io
10511051
username: ${{ github.actor }}

.github/workflows/docker-base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4747

4848
- name: Docker login
49-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
49+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
5050
with:
5151
registry: ghcr.io
5252
username: ${{ github.actor }}

.github/workflows/docs-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Node
2929
uses: ./.github/actions/setup-node
3030

31-
- uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
31+
- uses: tj-actions/changed-files@531f5f7d163941f0c1c04e0ff4d8bb243ac4366f # v45.0.7
3232
id: changed-files
3333
with:
3434
files: |

.github/workflows/dogfood.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Setup Nix
3838
uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
3939

40-
- uses: nix-community/cache-nix-action@aee88ae5efbbeb38ac5d9862ecbebdb404a19e69 # v6.1.1
40+
- uses: nix-community/cache-nix-action@c448f065ba14308da81de769632ca67a3ce67cf5 # v6.1.2
4141
with:
4242
# restore and save a cache using this key
4343
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
@@ -76,7 +76,7 @@ jobs:
7676

7777
- name: Login to DockerHub
7878
if: github.ref == 'refs/heads/main'
79-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
79+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
8080
with:
8181
username: ${{ secrets.DOCKERHUB_USERNAME }}
8282
password: ${{ secrets.DOCKERHUB_PASSWORD }}

.github/workflows/pr-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ jobs:
237237
uses: ./.github/actions/setup-sqlc
238238

239239
- name: GHCR Login
240-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
240+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
241241
with:
242242
registry: ghcr.io
243243
username: ${{ github.actor }}

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ jobs:
208208
cat "$CODER_RELEASE_NOTES_FILE"
209209
210210
- name: Docker Login
211-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
211+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
212212
with:
213213
registry: ghcr.io
214214
username: ${{ github.actor }}

.github/workflows/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
137137
138138
- name: Run Trivy vulnerability scanner
139-
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0
139+
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5
140140
with:
141141
image-ref: ${{ steps.build.outputs.image }}
142142
format: sarif

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ GEN_FILES := \
564564
examples/examples.gen.json \
565565
$(TAILNETTEST_MOCKS) \
566566
coderd/database/pubsub/psmock/psmock.go \
567-
agent/agentcontainers/acmock/acmock.go
568-
567+
agent/agentcontainers/acmock/acmock.go \
568+
agent/agentcontainers/dcspec/dcspec_gen.go
569569

570570
# all gen targets should be added here and to gen/mark-fresh
571571
gen: gen/db $(GEN_FILES)
@@ -600,6 +600,7 @@ gen/mark-fresh:
600600
$(TAILNETTEST_MOCKS) \
601601
coderd/database/pubsub/psmock/psmock.go \
602602
agent/agentcontainers/acmock/acmock.go \
603+
agent/agentcontainers/dcspec/dcspec_gen.go \
603604
"
604605

605606
for file in $$files; do
@@ -634,6 +635,9 @@ coderd/database/pubsub/psmock/psmock.go: coderd/database/pubsub/pubsub.go
634635
agent/agentcontainers/acmock/acmock.go: agent/agentcontainers/containers.go
635636
go generate ./agent/agentcontainers/acmock/
636637

638+
agent/agentcontainers/dcspec/dcspec_gen.go: agent/agentcontainers/dcspec/devContainer.base.schema.json
639+
go generate ./agent/agentcontainers/dcspec/
640+
637641
$(TAILNETTEST_MOCKS): tailnet/coordinator.go tailnet/service.go
638642
go generate ./tailnet/tailnettest/
639643

agent/agentcontainers/containers_dockercli.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import (
1313
"strings"
1414
"time"
1515

16+
"github.com/coder/coder/v2/agent/agentcontainers/dcspec"
1617
"github.com/coder/coder/v2/agent/agentexec"
1718
"github.com/coder/coder/v2/agent/usershell"
19+
"github.com/coder/coder/v2/coderd/util/ptr"
1820
"github.com/coder/coder/v2/codersdk"
1921

2022
"golang.org/x/exp/maps"
@@ -183,7 +185,7 @@ func devcontainerEnv(ctx context.Context, execer agentexec.Execer, container str
183185
return nil, nil
184186
}
185187

186-
meta := make([]DevContainerMeta, 0)
188+
meta := make([]dcspec.DevContainer, 0)
187189
if err := json.Unmarshal([]byte(rawMeta), &meta); err != nil {
188190
return nil, xerrors.Errorf("unmarshal devcontainer.metadata: %w", err)
189191
}
@@ -192,7 +194,13 @@ func devcontainerEnv(ctx context.Context, execer agentexec.Execer, container str
192194
env := make([]string, 0)
193195
for _, m := range meta {
194196
for k, v := range m.RemoteEnv {
195-
env = append(env, fmt.Sprintf("%s=%s", k, v))
197+
if v == nil { // *string per spec
198+
// devcontainer-cli will set this to the string "null" if the value is
199+
// not set. Explicitly setting to an empty string here as this would be
200+
// more expected here.
201+
v = ptr.Ref("")
202+
}
203+
env = append(env, fmt.Sprintf("%s=%s", k, *v))
196204
}
197205
}
198206
slices.Sort(env)
@@ -276,7 +284,7 @@ func (dcl *DockerCLILister) List(ctx context.Context) (codersdk.WorkspaceAgentLi
276284
// log this error, but I'm not sure it's worth it.
277285
ins, dockerInspectStderr, err := runDockerInspect(ctx, dcl.execer, ids...)
278286
if err != nil {
279-
return codersdk.WorkspaceAgentListContainersResponse{}, xerrors.Errorf("run docker inspect: %w", err)
287+
return codersdk.WorkspaceAgentListContainersResponse{}, xerrors.Errorf("run docker inspect: %w: %s", err, dockerInspectStderr)
280288
}
281289

282290
for _, in := range ins {

agent/agentcontainers/containers_internal_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ import (
3434
// It can be run manually as follows:
3535
//
3636
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerCLIContainerLister
37+
//
38+
//nolint:paralleltest // This test tends to flake when lots of containers start and stop in parallel.
3739
func TestIntegrationDocker(t *testing.T) {
38-
t.Parallel()
3940
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
4041
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
4142
}
@@ -418,8 +419,9 @@ func TestConvertDockerVolume(t *testing.T) {
418419
// It can be run manually as follows:
419420
//
420421
// CODER_TEST_USE_DOCKER=1 go test ./agent/agentcontainers -run TestDockerEnvInfoer
422+
//
423+
//nolint:paralleltest // This test tends to flake when lots of containers start and stop in parallel.
421424
func TestDockerEnvInfoer(t *testing.T) {
422-
t.Parallel()
423425
if ctud, ok := os.LookupEnv("CODER_TEST_USE_DOCKER"); !ok || ctud != "1" {
424426
t.Skip("Set CODER_TEST_USE_DOCKER=1 to run this test")
425427
}
@@ -483,9 +485,8 @@ func TestDockerEnvInfoer(t *testing.T) {
483485
expectedUserShell: "/bin/bash",
484486
},
485487
} {
488+
//nolint:paralleltest // variable recapture no longer required
486489
t.Run(fmt.Sprintf("#%d", idx), func(t *testing.T) {
487-
t.Parallel()
488-
489490
// Start a container with the given image
490491
// and environment variables
491492
image := strings.Split(tt.image, ":")[0]

0 commit comments

Comments
 (0)