Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions admin/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,13 +1065,18 @@ workflows:
config:
status: 200
body_from: "steps.get-versions.rows"
# Deploy: update workflow status to 'active'
# Deploy: update status to 'active', return the updated workflow record
- method: POST
path: "/api/v1/admin/workflows/{id}/deploy"
handler: admin-commands
Comment on lines +1068 to 1071
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says this change set only modifies admin/config.yaml, but this PR also includes a code change in cmd/server/main.go. Please update the PR description (and test plan, if applicable) to reflect the additional change, or split the server change into a separate PR.

Copilot uses AI. Check for mistakes.
middlewares: [admin-cors, admin-auth-middleware]
pipeline:
steps:
- name: set-target-status
type: step.set
config:
values:
target_status: "active"
- name: parse-request
type: step.request_parse
config:
Expand All @@ -1095,15 +1100,16 @@ workflows:
config:
values:
now: "{{ now }}"
- name: activate
- name: update-status
type: step.db_exec
config:
database: admin-db
query: "UPDATE workflows SET status='active', updated_at=? WHERE id=?"
query: "UPDATE workflows SET status = ?, updated_at = ? WHERE id = ?"
params:
- "{{index .steps \"set-target-status\" \"target_status\"}}"
- "{{index .steps \"set-now\" \"now\"}}"
- "{{index .steps \"parse-request\" \"path_params\" \"id\"}}"
- name: get-workflow
- name: get-updated
type: step.db_query
config:
database: admin-db
Expand All @@ -1114,20 +1120,25 @@ workflows:
type: step.json_response
config:
status: 200
body_from: "steps.get-workflow.row"
body_from: "steps.get-updated.row"
- name: not-found
type: step.json_response
config:
status: 404
body:
error: "workflow not found"
# Stop: update workflow status to 'stopped'
# Stop: update status to 'stopped', return the updated workflow record
- method: POST
path: "/api/v1/admin/workflows/{id}/stop"
handler: admin-commands
middlewares: [admin-cors, admin-auth-middleware]
pipeline:
steps:
- name: set-target-status
type: step.set
config:
values:
target_status: "stopped"
- name: parse-request
type: step.request_parse
config:
Expand All @@ -1151,15 +1162,16 @@ workflows:
config:
values:
now: "{{ now }}"
- name: deactivate
- name: update-status
type: step.db_exec
config:
database: admin-db
query: "UPDATE workflows SET status='stopped', updated_at=? WHERE id=?"
query: "UPDATE workflows SET status = ?, updated_at = ? WHERE id = ?"
params:
- "{{index .steps \"set-target-status\" \"target_status\"}}"
- "{{index .steps \"set-now\" \"now\"}}"
- "{{index .steps \"parse-request\" \"path_params\" \"id\"}}"
- name: get-workflow
- name: get-updated
type: step.db_query
config:
database: admin-db
Expand All @@ -1170,7 +1182,7 @@ workflows:
type: step.json_response
config:
status: 200
body_from: "steps.get-workflow.row"
body_from: "steps.get-updated.row"
- name: not-found
type: step.json_response
config:
Expand Down
8 changes: 4 additions & 4 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@
}))

srv := &http.Server{
Addr: *addr,
Addr: *multiWorkflowAddr,

Check failure on line 1564 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: multiWorkflowAddr

Check failure on line 1564 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Build

undefined: multiWorkflowAddr

Check failure on line 1564 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Test (Go 1.26)

undefined: multiWorkflowAddr
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiWorkflowAddr is referenced here (and later in the logger/display address code) but is not declared anywhere in cmd/server, which will cause a compile error. Either revert to using the existing addr flag (as before), or introduce a dedicated multi-workflow-addr flag (and add it to applyEnvOverrides() if it should be env-configurable).

Suggested change
Addr: *multiWorkflowAddr,
Addr: *addr,

Copilot uses AI. Check for mistakes.
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
}
Expand All @@ -1581,16 +1581,16 @@
// Start API server; propagate failures back so we can initiate shutdown.
srvErrCh := make(chan error, 1)
go func() {
logger.Info("Multi-workflow API listening", "addr", *addr)
logger.Info("Multi-workflow API listening", "addr", *multiWorkflowAddr)

Check failure on line 1584 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: multiWorkflowAddr

Check failure on line 1584 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Build

undefined: multiWorkflowAddr

Check failure on line 1584 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Test (Go 1.26)

undefined: multiWorkflowAddr
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Error("API server error", "error", err)
srvErrCh <- err
}
}()

// Build display address: if the host part is empty or 0.0.0.0/::/[::], use "localhost".
displayAddr := *addr
if host, port, splitErr := net.SplitHostPort(*addr); splitErr == nil &&
displayAddr := *multiWorkflowAddr

Check failure on line 1592 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: multiWorkflowAddr

Check failure on line 1592 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Build

undefined: multiWorkflowAddr

Check failure on line 1592 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Test (Go 1.26)

undefined: multiWorkflowAddr
if host, port, splitErr := net.SplitHostPort(*multiWorkflowAddr); splitErr == nil &&

Check failure on line 1593 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: multiWorkflowAddr (typecheck)

Check failure on line 1593 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Build

undefined: multiWorkflowAddr

Check failure on line 1593 in cmd/server/main.go

View workflow job for this annotation

GitHub Actions / Test (Go 1.26)

undefined: multiWorkflowAddr
(host == "" || host == "0.0.0.0" || host == "::" || host == "[::]") {
displayAddr = ":" + port
}
Expand Down
Loading