Skip to content

Commit c114d37

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into bq/refactor-status-indicator
2 parents 1d78533 + 6a67e2e commit c114d37

Some content is hidden

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

43 files changed

+1089
-389
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,7 @@ jobs:
940940
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
941941
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
942942
steps:
943-
- name: Harden Runner
944-
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
945-
with:
946-
egress-policy: audit
947-
943+
# Harden Runner doesn't work on macOS
948944
- name: Checkout
949945
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
950946
with:
@@ -957,6 +953,11 @@ jobs:
957953
echo "$(brew --prefix gnu-getopt)/bin" >> $GITHUB_PATH
958954
echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
959955
956+
- name: Switch XCode Version
957+
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
958+
with:
959+
xcode-version: "16.0.0"
960+
960961
- name: Setup Go
961962
uses: ./.github/actions/setup-go
962963

.github/workflows/release.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ jobs:
3636
build-dylib:
3737
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
3838
steps:
39-
- name: Harden Runner
40-
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
41-
with:
42-
egress-policy: audit
43-
39+
# Harden Runner doesn't work on macOS.
4440
- name: Checkout
4541
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4642
with:
@@ -61,6 +57,11 @@ jobs:
6157
echo "$(brew --prefix gnu-getopt)/bin" >> $GITHUB_PATH
6258
echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
6359
60+
- name: Switch XCode Version
61+
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
62+
with:
63+
xcode-version: "16.0.0"
64+
6465
- name: Setup Go
6566
uses: ./.github/actions/setup-go
6667

cli/ping.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (r *RootCmd) ping() *serpent.Command {
159159
LocalNetInfo: ni,
160160
Verbose: r.verbose,
161161
PingP2P: didP2p,
162-
TroubleshootingURL: appearanceConfig.DocsURL + "/networking/troubleshooting",
162+
TroubleshootingURL: appearanceConfig.DocsURL + "/admin/networking/troubleshooting",
163163
}
164164

165165
awsRanges, err := cliutil.FetchAWSIPRanges(diagCtx, cliutil.AWSIPRangesURL)

cli/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
694694
}
695695
}
696696

697-
if vals.OIDC.ClientKeyFile != "" || vals.OIDC.ClientSecret != "" {
697+
// As OIDC clients can be confidential or public,
698+
// we should only check for a client id being set.
699+
// The underlying library handles the case of no
700+
// client secrets correctly. For more details on
701+
// client types: https://oauth.net/2/client-types/
702+
if vals.OIDC.ClientID != "" {
698703
if vals.OIDC.IgnoreEmailVerified {
699704
logger.Warn(ctx, "coder will not check email_verified for OIDC logins")
700705
}

cli/testdata/coder_provisioner_jobs_list_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ OPTIONS:
1111
-O, --org string, $CODER_ORGANIZATION
1212
Select which organization (uuid or name) to use.
1313

14-
-c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|organization|queue] (default: created at,id,organization,status,type,queue,tags)
14+
-c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags)
1515
Columns to display in table output.
1616

1717
-l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50)

cli/testdata/coder_provisioner_jobs_list_--output_json.golden

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
"template_version_id": "============[version ID]============"
1919
},
2020
"type": "template_version_import",
21+
"metadata": {
22+
"template_version_name": "===========[version name]===========",
23+
"template_id": "===========[template ID]============",
24+
"template_name": "test-template",
25+
"template_display_name": ""
26+
},
2127
"organization_name": "Coder"
2228
},
2329
{
@@ -39,6 +45,14 @@
3945
"workspace_build_id": "========[workspace build ID]========"
4046
},
4147
"type": "workspace_build",
48+
"metadata": {
49+
"template_version_name": "===========[version name]===========",
50+
"template_id": "===========[template ID]============",
51+
"template_name": "test-template",
52+
"template_display_name": "",
53+
"workspace_id": "===========[workspace ID]===========",
54+
"workspace_name": "test-workspace"
55+
},
4256
"organization_name": "Coder"
4357
}
4458
]

coderd/apidoc/docs.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbmem/dbmem.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4117,6 +4117,45 @@ func (q *FakeQuerier) GetProvisionerJobsByOrganizationAndStatusWithQueuePosition
41174117
QueuePosition: rowQP.QueuePosition,
41184118
QueueSize: rowQP.QueueSize,
41194119
}
4120+
4121+
// Start add metadata.
4122+
var input codersdk.ProvisionerJobInput
4123+
err := json.Unmarshal([]byte(job.Input), &input)
4124+
if err != nil {
4125+
return nil, err
4126+
}
4127+
templateVersionID := input.TemplateVersionID
4128+
if input.WorkspaceBuildID != nil {
4129+
workspaceBuild, err := q.getWorkspaceBuildByIDNoLock(ctx, *input.WorkspaceBuildID)
4130+
if err != nil {
4131+
return nil, err
4132+
}
4133+
workspace, err := q.getWorkspaceByIDNoLock(ctx, workspaceBuild.WorkspaceID)
4134+
if err != nil {
4135+
return nil, err
4136+
}
4137+
row.WorkspaceID = uuid.NullUUID{UUID: workspace.ID, Valid: true}
4138+
row.WorkspaceName = workspace.Name
4139+
if templateVersionID == nil {
4140+
templateVersionID = &workspaceBuild.TemplateVersionID
4141+
}
4142+
}
4143+
if templateVersionID != nil {
4144+
templateVersion, err := q.getTemplateVersionByIDNoLock(ctx, *templateVersionID)
4145+
if err != nil {
4146+
return nil, err
4147+
}
4148+
row.TemplateVersionName = templateVersion.Name
4149+
template, err := q.getTemplateByIDNoLock(ctx, templateVersion.TemplateID.UUID)
4150+
if err != nil {
4151+
return nil, err
4152+
}
4153+
row.TemplateID = uuid.NullUUID{UUID: template.ID, Valid: true}
4154+
row.TemplateName = template.Name
4155+
row.TemplateDisplayName = template.DisplayName
4156+
}
4157+
// End add metadata.
4158+
41204159
if row.QueuePosition > 0 {
41214160
var availableWorkers []database.ProvisionerDaemon
41224161
for _, daemon := range q.provisionerDaemons {

coderd/database/queries.sql.go

Lines changed: 40 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/provisionerjobs.sql

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,43 @@ SELECT
130130
AND pj.organization_id = pd.organization_id
131131
AND pj.provisioner = ANY(pd.provisioners)
132132
AND provisioner_tagset_contains(pd.tags, pj.tags)
133-
) AS available_workers
133+
) AS available_workers,
134+
-- Include template and workspace information.
135+
COALESCE(tv.name, '') AS template_version_name,
136+
t.id AS template_id,
137+
COALESCE(t.name, '') AS template_name,
138+
COALESCE(t.display_name, '') AS template_display_name,
139+
w.id AS workspace_id,
140+
COALESCE(w.name, '') AS workspace_name
134141
FROM
135142
provisioner_jobs pj
136143
LEFT JOIN
137144
queue_position qp ON qp.id = pj.id
138145
LEFT JOIN
139146
queue_size qs ON TRUE
147+
LEFT JOIN
148+
workspace_builds wb ON wb.id = CASE WHEN pj.input ? 'workspace_build_id' THEN (pj.input->>'workspace_build_id')::uuid END
149+
LEFT JOIN
150+
workspaces w ON wb.workspace_id = w.id
151+
LEFT JOIN
152+
-- We should always have a template version, either explicitly or implicitly via workspace build.
153+
template_versions tv ON tv.id = CASE WHEN pj.input ? 'template_version_id' THEN (pj.input->>'template_version_id')::uuid ELSE wb.template_version_id END
154+
LEFT JOIN
155+
templates t ON tv.template_id = t.id
140156
WHERE
141157
(sqlc.narg('organization_id')::uuid IS NULL OR pj.organization_id = @organization_id)
142158
AND (COALESCE(array_length(@ids::uuid[], 1), 0) = 0 OR pj.id = ANY(@ids::uuid[]))
143159
AND (COALESCE(array_length(@status::provisioner_job_status[], 1), 0) = 0 OR pj.job_status = ANY(@status::provisioner_job_status[]))
144160
GROUP BY
145161
pj.id,
146162
qp.queue_position,
147-
qs.count
163+
qs.count,
164+
tv.name,
165+
t.id,
166+
t.name,
167+
t.display_name,
168+
w.id,
169+
w.name
148170
ORDER BY
149171
pj.created_at DESC
150172
LIMIT

coderd/provisionerjobs.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ func convertProvisionerJobWithQueuePosition(pj database.GetProvisionerJobsByOrga
388388
QueueSize: pj.QueueSize,
389389
})
390390
job.AvailableWorkers = pj.AvailableWorkers
391+
job.Metadata = &codersdk.ProvisionerJobMetadata{
392+
TemplateVersionName: pj.TemplateVersionName,
393+
TemplateID: pj.TemplateID.UUID,
394+
TemplateName: pj.TemplateName,
395+
TemplateDisplayName: pj.TemplateDisplayName,
396+
WorkspaceName: pj.WorkspaceName,
397+
}
398+
if pj.WorkspaceID.Valid {
399+
job.Metadata.WorkspaceID = &pj.WorkspaceID.UUID
400+
}
391401
return job
392402
}
393403

0 commit comments

Comments
 (0)