Skip to content

Commit a0b3ab3

Browse files
rowansmithauclaude
andcommitted
Merge main into coder_build_logs branch
Resolved conflicts in: - docs/manifest.json - Added builds list and logs CLI commands entries - docs/reference/api/schemas.md - Updated PresetParameter schema - docs/reference/api/templates.md - Updated template version presets response schema - coderd/apidoc/swagger.json - Used latest version from main 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 3c69bf4 + 4bced62 commit a0b3ab3

File tree

139 files changed

+26536
-23198
lines changed

Some content is hidden

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

139 files changed

+26536
-23198
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ provisionersdk/proto/*.go linguist-generated=true
1515
*.tfstate.json linguist-generated=true
1616
*.tfstate.dot linguist-generated=true
1717
*.tfplan.dot linguist-generated=true
18+
site/e2e/google/protobuf/timestampGenerated.ts
1819
site/e2e/provisionerGenerated.ts linguist-generated=true
20+
site/src/api/countriesGenerated.tsx linguist-generated=true
21+
site/src/api/rbacresourcesGenerated.tsx linguist-generated=true
1922
site/src/api/typesGenerated.ts linguist-generated=true
20-
site/src/pages/SetupPage/countries.tsx linguist-generated=true

.github/workflows/ci.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,27 @@ jobs:
10601060
- name: Setup Go
10611061
uses: ./.github/actions/setup-go
10621062

1063+
- name: Install rcodesign
1064+
run: |
1065+
set -euo pipefail
1066+
wget -O /tmp/rcodesign.tar.gz https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-x86_64-unknown-linux-musl.tar.gz
1067+
sudo tar -xzf /tmp/rcodesign.tar.gz \
1068+
-C /usr/bin \
1069+
--strip-components=1 \
1070+
apple-codesign-0.22.0-x86_64-unknown-linux-musl/rcodesign
1071+
rm /tmp/rcodesign.tar.gz
1072+
1073+
- name: Setup Apple Developer certificate
1074+
run: |
1075+
set -euo pipefail
1076+
touch /tmp/{apple_cert.p12,apple_cert_password.txt}
1077+
chmod 600 /tmp/{apple_cert.p12,apple_cert_password.txt}
1078+
echo "$AC_CERTIFICATE_P12_BASE64" | base64 -d > /tmp/apple_cert.p12
1079+
echo "$AC_CERTIFICATE_PASSWORD" > /tmp/apple_cert_password.txt
1080+
env:
1081+
AC_CERTIFICATE_P12_BASE64: ${{ secrets.AC_CERTIFICATE_P12_BASE64 }}
1082+
AC_CERTIFICATE_PASSWORD: ${{ secrets.AC_CERTIFICATE_PASSWORD }}
1083+
10631084
# Necessary for signing Windows binaries.
10641085
- name: Setup Java
10651086
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
@@ -1138,6 +1159,9 @@ jobs:
11381159
CODER_WINDOWS_RESOURCES: "1"
11391160
CODER_SIGN_GPG: "1"
11401161
CODER_GPG_RELEASE_KEY_BASE64: ${{ secrets.GPG_RELEASE_KEY_BASE64 }}
1162+
CODER_SIGN_DARWIN: "1"
1163+
AC_CERTIFICATE_FILE: /tmp/apple_cert.p12
1164+
AC_CERTIFICATE_PASSWORD_FILE: /tmp/apple_cert_password.txt
11411165
EV_KEY: ${{ secrets.EV_KEY }}
11421166
EV_KEYSTORE: ${{ secrets.EV_KEYSTORE }}
11431167
EV_TSA_URL: ${{ secrets.EV_TSA_URL }}

CODEOWNERS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ coderd/rbac/ @Emyrk
1717

1818
# Mainly dependent on coder/guts, which is maintained by @Emyrk
1919
scripts/apitypings/ @Emyrk
20+
scripts/gensite/ @aslilac
21+
22+
site/ @aslilac
23+
site/src/hooks/ @Parkreiner
24+
# These rules intentionally do not specify any owners. More specific rules
25+
# override less specific rules, so these files are "ignored" by the site/ rule.
26+
site/e2e/google/protobuf/timestampGenerated.ts
27+
site/e2e/provisionerGenerated.ts
28+
site/src/api/countriesGenerated.ts
29+
site/src/api/rbacresourcesGenerated.ts
30+
site/src/api/typesGenerated.ts
31+
site/CLAUDE.md

agent/agentcontainers/api.go

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import (
2121

2222
"github.com/fsnotify/fsnotify"
2323
"github.com/go-chi/chi/v5"
24+
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
2425
"github.com/google/uuid"
2526
"github.com/spf13/afero"
2627
"golang.org/x/xerrors"
2728

2829
"cdr.dev/slog"
30+
"github.com/coder/coder/v2/agent/agentcontainers/ignore"
2931
"github.com/coder/coder/v2/agent/agentcontainers/watcher"
3032
"github.com/coder/coder/v2/agent/agentexec"
3133
"github.com/coder/coder/v2/agent/usershell"
@@ -141,7 +143,8 @@ func WithCommandEnv(ce CommandEnv) Option {
141143
strings.HasPrefix(s, "CODER_WORKSPACE_AGENT_URL=") ||
142144
strings.HasPrefix(s, "CODER_AGENT_TOKEN=") ||
143145
strings.HasPrefix(s, "CODER_AGENT_AUTH=") ||
144-
strings.HasPrefix(s, "CODER_AGENT_DEVCONTAINERS_ENABLE=")
146+
strings.HasPrefix(s, "CODER_AGENT_DEVCONTAINERS_ENABLE=") ||
147+
strings.HasPrefix(s, "CODER_AGENT_DEVCONTAINERS_PROJECT_DISCOVERY_ENABLE=")
145148
})
146149
return shell, dir, env, nil
147150
}
@@ -469,13 +472,49 @@ func (api *API) discoverDevcontainerProjects() error {
469472
}
470473

471474
func (api *API) discoverDevcontainersInProject(projectPath string) error {
475+
logger := api.logger.
476+
Named("project-discovery").
477+
With(slog.F("project_path", projectPath))
478+
479+
globalPatterns, err := ignore.LoadGlobalPatterns(api.fs)
480+
if err != nil {
481+
return xerrors.Errorf("read global git ignore patterns: %w", err)
482+
}
483+
484+
patterns, err := ignore.ReadPatterns(api.ctx, logger, api.fs, projectPath)
485+
if err != nil {
486+
return xerrors.Errorf("read git ignore patterns: %w", err)
487+
}
488+
489+
matcher := gitignore.NewMatcher(append(globalPatterns, patterns...))
490+
472491
devcontainerConfigPaths := []string{
473492
"/.devcontainer/devcontainer.json",
474493
"/.devcontainer.json",
475494
}
476495

477-
return afero.Walk(api.fs, projectPath, func(path string, info fs.FileInfo, _ error) error {
496+
return afero.Walk(api.fs, projectPath, func(path string, info fs.FileInfo, err error) error {
497+
if err != nil {
498+
logger.Error(api.ctx, "encountered error while walking for dev container projects",
499+
slog.F("path", path),
500+
slog.Error(err))
501+
return nil
502+
}
503+
504+
pathParts := ignore.FilePathToParts(path)
505+
506+
// We know that a directory entry cannot be a `devcontainer.json` file, so we
507+
// always skip processing directories. If the directory happens to be ignored
508+
// by git then we'll make sure to ignore all of the children of that directory.
478509
if info.IsDir() {
510+
if matcher.Match(pathParts, true) {
511+
return fs.SkipDir
512+
}
513+
514+
return nil
515+
}
516+
517+
if matcher.Match(pathParts, false) {
479518
return nil
480519
}
481520

@@ -486,23 +525,41 @@ func (api *API) discoverDevcontainersInProject(projectPath string) error {
486525

487526
workspaceFolder := strings.TrimSuffix(path, relativeConfigPath)
488527

489-
api.logger.Debug(api.ctx, "discovered dev container project", slog.F("workspace_folder", workspaceFolder))
528+
logger := logger.With(slog.F("workspace_folder", workspaceFolder))
529+
logger.Debug(api.ctx, "discovered dev container project")
490530

491531
api.mu.Lock()
492532
if _, found := api.knownDevcontainers[workspaceFolder]; !found {
493-
api.logger.Debug(api.ctx, "adding dev container project", slog.F("workspace_folder", workspaceFolder))
533+
logger.Debug(api.ctx, "adding dev container project")
494534

495535
dc := codersdk.WorkspaceAgentDevcontainer{
496536
ID: uuid.New(),
497537
Name: "", // Updated later based on container state.
498538
WorkspaceFolder: workspaceFolder,
499539
ConfigPath: path,
500-
Status: "", // Updated later based on container state.
540+
Status: codersdk.WorkspaceAgentDevcontainerStatusStopped,
501541
Dirty: false, // Updated later based on config file changes.
502542
Container: nil,
503543
}
504544

545+
config, err := api.dccli.ReadConfig(api.ctx, workspaceFolder, path, []string{})
546+
if err != nil {
547+
logger.Error(api.ctx, "read project configuration", slog.Error(err))
548+
} else if config.Configuration.Customizations.Coder.AutoStart {
549+
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusStarting
550+
}
551+
505552
api.knownDevcontainers[workspaceFolder] = dc
553+
api.broadcastUpdatesLocked()
554+
555+
if dc.Status == codersdk.WorkspaceAgentDevcontainerStatusStarting {
556+
api.asyncWg.Add(1)
557+
go func() {
558+
defer api.asyncWg.Done()
559+
560+
_ = api.CreateDevcontainer(dc.WorkspaceFolder, dc.ConfigPath)
561+
}()
562+
}
506563
}
507564
api.mu.Unlock()
508565
}

0 commit comments

Comments
 (0)