Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8b061c314 | ||
|
|
c5158edb6c | ||
|
|
9ad270b9a4 | ||
|
|
51328c9585 | ||
|
|
aa1ca9e653 | ||
|
|
cb29967e7b |
No files matched your search
@@ -408,7 +408,8 @@ jobs:
|
||||
# already guarantees it describes this version.
|
||||
- name: Publish GitHub Release with the distribution zip
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# GITHUB_TOKEN cannot write to another repository.
|
||||
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
tag="v${{ steps.version.outputs.version }}"
|
||||
@@ -434,12 +435,12 @@ jobs:
|
||||
# Idempotent: --clobber replaces the asset and leaves the notes
|
||||
# alone, so a re-run of this job (a retried or superseded deploy)
|
||||
# cannot fail on an existing Release or duplicate the zip.
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
gh release upload "$tag" "${{ steps.zip.outputs.name }}.zip" SHA256SUMS --clobber
|
||||
if gh release view "$tag" -R samcharles93/archie-releases >/dev/null 2>&1; then
|
||||
gh release upload "$tag" -R samcharles93/archie-releases "${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh --clobber
|
||||
else
|
||||
gh release create "$tag" \
|
||||
gh release create "$tag" -R samcharles93/archie-releases \
|
||||
--title "archied v$version" \
|
||||
--notes-file "$notes" \
|
||||
"${{ steps.zip.outputs.name }}.zip" SHA256SUMS
|
||||
"${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh
|
||||
fi
|
||||
echo "published $tag with ${{ steps.zip.outputs.name }}.zip"
|
||||
@@ -5,6 +5,28 @@ release's per-component sections are labelled beneath its heading.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.54.3] - 2026-10-16
|
||||
|
||||
### archied
|
||||
|
||||
- Chat can help write a workflow: it reads your workflows and the step catalog, writes a definition, and checks it the same way saving does, fixing what the check reports. It does not save; paste the YAML it gives you into the editor's YAML view and save there.
|
||||
|
||||
## [1.54.2] - 2026-10-16
|
||||
|
||||
### archied
|
||||
|
||||
- Tool calls from Gemini models (Interactions API) receive their arguments intact. Any tool that takes arguments, such as `dashboard_navigate` in chat, failed with "invalid character '{' after top-level value".
|
||||
|
||||
### archie-agent
|
||||
|
||||
- Agent steps on Gemini models (Interactions API) pass tools their arguments intact instead of failing to decode them.
|
||||
|
||||
## [1.54.1] - 2026-10-16
|
||||
|
||||
### archied
|
||||
|
||||
- Update checks, `archied update install` and `install.sh` find releases at `github.com/samcharles93/archie-releases`, so a host can update again. A host on 1.54.0 or earlier still looks in the old place and has to be upgraded to 1.54.1 by hand once.
|
||||
|
||||
## [1.54.0] - 2026-10-16
|
||||
|
||||
**Upgrade note:** services now authenticate each other with TLS certificates from your own CA instead of shared tokens. Before upgrading a host whose services listen on anything but loopback (any host running agent containers), issue a certificate per service (`archied`, `archie-gateway`, `archie-messaging`, `archie-state-store`, `archie-ui`, each with its name as the DNS SAN and both server and client auth), add `[tls] ca_file` and `cert_dir` to `config.toml`, and remove every `target_token`, the `*_TOKEN` service variables and the `--token`/`--*-token` flags, including archie-ui's `-token` and `-token-file`. A unit that still passes a removed flag fails to start. See `config.example.toml`.
|
||||
|
||||
@@ -58,8 +58,15 @@ task release:prepare VERSION=1.3.0 # write the section into CHANGELOG.md, un
|
||||
# edit CHANGELOG.md -- generated notes are a starting point, not the release
|
||||
task release VERSION=1.3.0 # commit + annotated tag
|
||||
git push --atomic origin main v1.3.0 # both refs or neither
|
||||
task release:publish VERSION=1.3.0 # images to GHCR, zip to archie-releases
|
||||
```
|
||||
|
||||
The source repository is private, so releases are published to the public
|
||||
`samcharles93/archie-releases` repository, where `install.sh` and the
|
||||
updater find them. `release:publish` builds from a clean worktree of the tag
|
||||
and needs `gh` and `docker` logged in with write access to that repository
|
||||
and to GHCR.
|
||||
|
||||
`release:prepare` emits bare commit subjects; they are a starting point. Rewrite
|
||||
them to say what a reader gets, per "What the notes are for" above.
|
||||
|
||||
|
||||
@@ -360,6 +360,13 @@ tasks:
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:publish:
|
||||
desc: Push the images and publish the pushed tag to the public releases repository (VERSION=1.2.0)
|
||||
cmds:
|
||||
- tools/publish.sh {{.VERSION}}
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
clean:
|
||||
desc: Remove build artifacts
|
||||
cmds:
|
||||
|
||||
@@ -80,6 +80,9 @@
|
||||
"/news/archie/1.52.0/": "/news/1.52.0/",
|
||||
"/news/archie/1.53.0/": "/news/1.53.0/",
|
||||
"/news/archie/1.54.0/": "/news/1.54.0/",
|
||||
"/news/archie/1.54.1/": "/news/1.54.1/",
|
||||
"/news/archie/1.54.2/": "/news/1.54.2/",
|
||||
"/news/archie/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archie/1.6.0/": "/news/1.6.0/",
|
||||
"/news/archie/1.7.0/": "/news/1.7.0/",
|
||||
"/news/archie/1.8.0/": "/news/1.8.0/",
|
||||
@@ -176,6 +179,9 @@
|
||||
"/news/archied/1.52.0/": "/news/1.52.0/",
|
||||
"/news/archied/1.53.0/": "/news/1.53.0/",
|
||||
"/news/archied/1.54.0/": "/news/1.54.0/",
|
||||
"/news/archied/1.54.1/": "/news/1.54.1/",
|
||||
"/news/archied/1.54.2/": "/news/1.54.2/",
|
||||
"/news/archied/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archied/1.6.0/": "/news/1.6.0/",
|
||||
"/news/archied/1.7.0/": "/news/1.7.0/",
|
||||
"/news/archied/1.8.0/": "/news/1.8.0/",
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
[
|
||||
{
|
||||
"version": "1.54.3",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Chat can help write a workflow: it reads your workflows and the step catalog, writes a definition, and checks it the same way saving does, fixing what the check reports. It does not save; paste the YAML it gives you into the editor's YAML view and save there."
|
||||
},
|
||||
{
|
||||
"version": "1.54.2",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Tool calls from Gemini models (Interactions API) receive their arguments intact. Any tool that takes arguments, such as `dashboard_navigate` in chat, failed with \"invalid character '{' after top-level value\".\n\n### archie-agent\n\n- Agent steps on Gemini models (Interactions API) pass tools their arguments intact instead of failing to decode them."
|
||||
},
|
||||
{
|
||||
"version": "1.54.1",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Update checks, `archied update install` and `install.sh` find releases at `github.com/samcharles93/archie-releases`, so a host can update again. A host on 1.54.0 or earlier still looks in the old place and has to be upgraded to 1.54.1 by hand once."
|
||||
},
|
||||
{
|
||||
"version": "1.54.0",
|
||||
"date": "2026-10-16",
|
||||
|
||||
@@ -96,7 +96,7 @@ require (
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.1
|
||||
github.com/pressly/goose/v3 v3.29.0
|
||||
github.com/samcharles93/ai-sdk v0.3.0
|
||||
github.com/samcharles93/ai-sdk v0.3.1
|
||||
go.lsp.dev/jsonrpc2 v1.0.1
|
||||
go.lsp.dev/protocol v1.0.1
|
||||
go.lsp.dev/uri v1.0.1
|
||||
|
||||
@@ -174,8 +174,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/samcharles93/ai-sdk v0.3.0 h1:ZZX38sT00oJkbry/cgjIaFnx5IHGHorfStPrVcGCjVU=
|
||||
github.com/samcharles93/ai-sdk v0.3.0/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
|
||||
github.com/samcharles93/ai-sdk v0.3.1 h1:fD/Byx1Vo6NeZZBsSurxTO9e2/tAdAlEUIW+J7Hc/DM=
|
||||
github.com/samcharles93/ai-sdk v0.3.1/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
|
||||
github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
|
||||
github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
|
||||
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO="samcharles93/archie-core"
|
||||
REPO="samcharles93/archie-releases"
|
||||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}"
|
||||
|
||||
@@ -51,6 +51,7 @@ type chatSetup struct {
|
||||
ChatTaskLogs gateway.ChatTaskLogReader
|
||||
ChatTaskActor gateway.ChatTaskActor
|
||||
DefaultChatIdentity string
|
||||
Workflows gateway.WorkflowSource
|
||||
// Bus carries primary-input events: a completed
|
||||
// chat turn is published here so input-driven curators can wake. Nil
|
||||
// disables turn events (tests, minimal setups).
|
||||
@@ -138,6 +139,7 @@ func newChatTurnRunner(
|
||||
TaskLogs: s.ChatTaskLogs,
|
||||
TaskActor: s.ChatTaskActor,
|
||||
TaskIdentity: s.DefaultChatIdentity,
|
||||
Workflows: s.Workflows,
|
||||
Bus: s.Bus,
|
||||
BotUser: cfg.BotUser,
|
||||
Channel: channel,
|
||||
|
||||
@@ -252,6 +252,7 @@ func (b *server) setupGatewayChat(ctx context.Context, actor gateway.ChatTaskAct
|
||||
ChatTaskLogs: chatTaskLogReaderAdapter{tasks: b.stateStore.TaskByID, taskLogs: b.stateStore},
|
||||
ChatTaskActor: actor,
|
||||
DefaultChatIdentity: b.defaultChatIdentity,
|
||||
Workflows: controlplanerpc.NewWorkflows(b.stateStore.ControlPlane()),
|
||||
Bus: b.bus, Log: b.log,
|
||||
MemoryEngine: b.memoryStore(),
|
||||
MemoryWriter: b.memoryWriter(),
|
||||
|
||||
@@ -7,7 +7,7 @@ Accounts and organization:
|
||||
Creating a workflow:
|
||||
1. Open /workflows and choose New workflow. The new definition is an unsaved draft with an id and empty steps.
|
||||
2. Use YAML to edit its id, or the canvas to add and select steps. Select Starts when on the canvas to open Workflow settings. Set Runs as to an existing active agent identity. Works on selects Repository, If given, or None.
|
||||
3. Read an existing workflow and the served step/settings catalog before constructing YAML. A repository planning workflow normally prepares the repository, then uses agent.run with read_only: true and a mission asking it to inspect the code and return a plan. Keep forge writes, commits, implementation steps and automatic implementation handoffs out of a planning-only workflow. The shipped feasibility workflow also closes issues or hands off after approval: it is not a planning-only template unchanged.
|
||||
3. Before writing YAML, read a similar workflow (workflow_list, workflow_get) and the step catalog (workflow_step_types). Run workflow_validate on the YAML and fix every problem it reports until it is valid, then give the operator the YAML to paste into the editor's YAML view and save. A repository planning workflow normally prepares the repository, then uses agent.run with read_only: true and a mission asking it to inspect the code and return a plan. Keep forge writes, commits, implementation steps and automatic implementation handoffs out of a planning-only workflow. The shipped feasibility workflow also closes issues or hands off after approval: it is not a planning-only template unchanged.
|
||||
4. Save the definition. Test runs the draft once with forge writes/pushes skipped; commands and tools still run, so a test is not a side-effect-free simulation. Run starts the saved version. History, Performance and Runs show revisions and execution evidence.
|
||||
5. Manual workflows need no automatic trigger. Bind an event creates an event binding from a captured example and maps payload fields to declared inputs. Existing bindings can be paused or removed. Playbooks are edited at /settings/playbooks; workflow calls/handoffs are edited in the workflow that invokes them. Built-in issue-label routes are marked Built-in; they cannot be removed in the event-binding editor. Disable the workflow to prevent automatic execution.
|
||||
|
||||
|
||||
@@ -102,10 +102,12 @@ type TurnRunnerConfig struct {
|
||||
TaskLogs ChatTaskLogReader
|
||||
TaskActor ChatTaskActor
|
||||
TaskIdentity string
|
||||
Bus TurnEventPublisher
|
||||
BotUser string
|
||||
Channel string
|
||||
Operator string
|
||||
// Workflows backs the workflow read and validate tools. Nil omits them.
|
||||
Workflows WorkflowSource
|
||||
Bus TurnEventPublisher
|
||||
BotUser string
|
||||
Channel string
|
||||
Operator string
|
||||
// Workspace is the directory the chat agent's file and shell tools are
|
||||
// rooted at (chat.workspace). Passed into the prompt's <env> block.
|
||||
Workspace string
|
||||
@@ -306,6 +308,7 @@ func (r *TurnRunner) prepareTurn(ctx context.Context, sessionID string, in Inbou
|
||||
// UI only: a non-web channel has no dashboard to point at.
|
||||
extraTools = append(extraTools, PageIndexTools(r.Channel)...)
|
||||
extraTools = append(extraTools, MemoryTools(r.MemoryWriter, subject)...)
|
||||
extraTools = append(extraTools, WorkflowTools(r.Workflows)...)
|
||||
// The question tool is per-turn: it exists only when this turn's channel
|
||||
// adapter can carry a clarify/picker interaction (see WithInteractive).
|
||||
extraTools = append(extraTools, InteractiveTools(ctx)...)
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/tools"
|
||||
)
|
||||
|
||||
// WorkflowSource is the control-plane surface the workflow tools use, acting
|
||||
// in the caller's org. Validate returns the reason a collection is refused,
|
||||
// or "" when it would be accepted; err is reserved for an unavailable store.
|
||||
type WorkflowSource interface {
|
||||
Workflows(ctx context.Context) (task.WorkflowDefinitionCollection, error)
|
||||
StepTypes(ctx context.Context) (json.RawMessage, error)
|
||||
Validate(ctx context.Context, collection task.WorkflowDefinitionCollection) (problem string, err error)
|
||||
}
|
||||
|
||||
// WorkflowSummary is one workflow as workflow_list shows it.
|
||||
type WorkflowSummary struct {
|
||||
ID string `json:"id"`
|
||||
Steps []string `json:"steps"`
|
||||
}
|
||||
|
||||
// WorkflowValidation is what workflow_validate returns.
|
||||
type WorkflowValidation struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Valid bool `json:"valid"`
|
||||
Replace bool `json:"replaces_existing,omitempty"`
|
||||
Problem string `json:"problem,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowTools returns the read and validate tools over source. Saving is
|
||||
// left to the operator in the workflow editor. Nil source registers none.
|
||||
func WorkflowTools(source WorkflowSource) []tools.ToolEntry {
|
||||
if source == nil {
|
||||
return nil
|
||||
}
|
||||
return []tools.ToolEntry{
|
||||
workflowListTool(source),
|
||||
workflowGetTool(source),
|
||||
workflowStepTypesTool(source),
|
||||
workflowValidateTool(source),
|
||||
}
|
||||
}
|
||||
|
||||
func workflowListTool(source WorkflowSource) tools.ToolEntry {
|
||||
return tools.ToolEntry{
|
||||
Name: "workflow_list",
|
||||
Toolset: "workflows",
|
||||
Description: "List the workflows defined in this org with the step types each runs, in order.",
|
||||
Classification: tools.ClassIdempotent,
|
||||
Schema: tools.JSONSchema{"type": "object", "properties": map[string]any{}},
|
||||
Handler: func(ctx context.Context, _ map[string]any) (any, error) {
|
||||
collection, err := source.Workflows(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("workflow_list: %w", err)
|
||||
}
|
||||
out := make([]WorkflowSummary, 0, len(collection.Definitions))
|
||||
for _, entry := range collection.Definitions {
|
||||
out = append(out, WorkflowSummary{ID: entry.ID, Steps: stepTypesOf(entry.YAML)})
|
||||
}
|
||||
return out, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func workflowGetTool(source WorkflowSource) tools.ToolEntry {
|
||||
return tools.ToolEntry{
|
||||
Name: "workflow_get",
|
||||
Toolset: "workflows",
|
||||
Description: "Return one workflow's YAML definition. Read a similar workflow before writing a new one.",
|
||||
Classification: tools.ClassIdempotent,
|
||||
Schema: tools.JSONSchema{
|
||||
"type": "object",
|
||||
"properties": map[string]any{"id": map[string]any{"type": "string", "description": "The workflow id from workflow_list."}},
|
||||
"required": []any{"id"},
|
||||
},
|
||||
Handler: func(ctx context.Context, input map[string]any) (any, error) {
|
||||
id := strings.TrimSpace(asString(input["id"]))
|
||||
collection, err := source.Workflows(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("workflow_get: %w", err)
|
||||
}
|
||||
entry, ok := collection.DefinitionByID(id)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("workflow_get: no workflow %q", id)
|
||||
}
|
||||
return map[string]string{"id": entry.ID, "yaml": entry.YAML}, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func workflowStepTypesTool(source WorkflowSource) tools.ToolEntry {
|
||||
return tools.ToolEntry{
|
||||
Name: "workflow_step_types",
|
||||
Toolset: "workflows",
|
||||
Description: "Return the step types a workflow may use, with each type's settings schema.",
|
||||
Classification: tools.ClassIdempotent,
|
||||
Schema: tools.JSONSchema{"type": "object", "properties": map[string]any{}},
|
||||
Handler: func(ctx context.Context, _ map[string]any) (any, error) {
|
||||
types, err := source.StepTypes(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("workflow_step_types: %w", err)
|
||||
}
|
||||
return types, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func workflowValidateTool(source WorkflowSource) tools.ToolEntry {
|
||||
return tools.ToolEntry{
|
||||
Name: "workflow_validate",
|
||||
Toolset: "workflows",
|
||||
Description: "Check a workflow YAML definition exactly as saving it would, without saving. " +
|
||||
"Fix every problem it reports and validate again before giving the operator the YAML, " +
|
||||
"who saves it from the workflow editor.",
|
||||
Classification: tools.ClassIdempotent,
|
||||
Schema: tools.JSONSchema{
|
||||
"type": "object",
|
||||
"properties": map[string]any{"yaml": map[string]any{"type": "string", "description": "The complete workflow definition."}},
|
||||
"required": []any{"yaml"},
|
||||
},
|
||||
Handler: func(ctx context.Context, input map[string]any) (any, error) {
|
||||
src := asString(input["yaml"])
|
||||
id, problem := definitionID(src)
|
||||
if problem != "" {
|
||||
return WorkflowValidation{Problem: problem}, nil
|
||||
}
|
||||
collection, err := source.Workflows(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("workflow_validate: %w", err)
|
||||
}
|
||||
proposed, replaced := withDefinition(collection, id, src)
|
||||
problem, err = source.Validate(ctx, proposed)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("workflow_validate: %w", err)
|
||||
}
|
||||
return WorkflowValidation{ID: id, Valid: problem == "", Replace: replaced, Problem: problem}, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// withDefinition returns collection with src as workflow id, replacing an
|
||||
// existing definition of that id or appending a new one.
|
||||
func withDefinition(collection task.WorkflowDefinitionCollection, id, src string) (task.WorkflowDefinitionCollection, bool) {
|
||||
out := task.WorkflowDefinitionCollection{Definitions: make([]task.WorkflowDefinitionEntry, 0, len(collection.Definitions)+1)}
|
||||
replaced := false
|
||||
for _, entry := range collection.Definitions {
|
||||
if entry.ID == id {
|
||||
entry.YAML, replaced = src, true
|
||||
}
|
||||
out.Definitions = append(out.Definitions, entry)
|
||||
}
|
||||
if !replaced {
|
||||
out.Definitions = append(out.Definitions, task.WorkflowDefinitionEntry{ID: id, YAML: src})
|
||||
}
|
||||
return out, replaced
|
||||
}
|
||||
|
||||
// definitionID returns the id src declares, or why it declares none.
|
||||
func definitionID(src string) (id, problem string) {
|
||||
var declared struct {
|
||||
ID string `yaml:"id"`
|
||||
}
|
||||
if err := yaml.Unmarshal([]byte(src), &declared); err != nil {
|
||||
return "", "the YAML does not parse: " + err.Error()
|
||||
}
|
||||
if strings.TrimSpace(declared.ID) == "" {
|
||||
return "", "the definition needs an id"
|
||||
}
|
||||
return declared.ID, ""
|
||||
}
|
||||
|
||||
// stepTypesOf lists a definition's top-level step types; a definition that
|
||||
// does not parse lists none.
|
||||
func stepTypesOf(src string) []string {
|
||||
var def struct {
|
||||
Steps []struct {
|
||||
Type string `yaml:"type"`
|
||||
} `yaml:"steps"`
|
||||
}
|
||||
_ = yaml.Unmarshal([]byte(src), &def)
|
||||
out := make([]string, 0, len(def.Steps))
|
||||
for _, step := range def.Steps {
|
||||
if step.Type != "" {
|
||||
out = append(out, step.Type)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package controlplanerpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
pb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
)
|
||||
|
||||
const workflowDefinitionsKind = "workflow-definitions"
|
||||
|
||||
// Workflows reads and validates workflow definitions in the caller's org,
|
||||
// through the same control-plane calls the workflow editor makes.
|
||||
type Workflows struct{ rpc pb.ControlPlaneServiceClient }
|
||||
|
||||
func NewWorkflows(rpc pb.ControlPlaneServiceClient) Workflows { return Workflows{rpc: rpc} }
|
||||
|
||||
func (w Workflows) Workflows(ctx context.Context) (task.WorkflowDefinitionCollection, error) {
|
||||
var collection task.WorkflowDefinitionCollection
|
||||
response, err := w.rpc.Query(ctx, &pb.QueryRequest{Kind: workflowDefinitionsKind})
|
||||
if err != nil {
|
||||
return collection, fmt.Errorf("%w: %w", ErrUnavailable, err)
|
||||
}
|
||||
if response.GetResource() == nil || len(response.GetResource().GetValueJson()) == 0 {
|
||||
return collection, nil
|
||||
}
|
||||
if err := json.Unmarshal(response.GetResource().GetValueJson(), &collection); err != nil {
|
||||
return collection, fmt.Errorf("decode workflow definitions: %w", err)
|
||||
}
|
||||
return collection, nil
|
||||
}
|
||||
|
||||
func (w Workflows) StepTypes(ctx context.Context) (json.RawMessage, error) {
|
||||
catalog, err := w.rpc.Catalog(ctx, &pb.CatalogRequest{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrUnavailable, err)
|
||||
}
|
||||
for _, resource := range catalog.GetResources() {
|
||||
if resource.GetKind() != workflowDefinitionsKind {
|
||||
continue
|
||||
}
|
||||
var schema struct {
|
||||
StepTypes json.RawMessage `json:"x-step-types"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(resource.GetSchemaJson()), &schema); err != nil {
|
||||
return nil, fmt.Errorf("decode workflow schema: %w", err)
|
||||
}
|
||||
return schema.StepTypes, nil
|
||||
}
|
||||
return nil, errors.New("the control plane serves no workflow definitions")
|
||||
}
|
||||
|
||||
func (w Workflows) Validate(ctx context.Context, collection task.WorkflowDefinitionCollection) (string, error) {
|
||||
value, err := json.Marshal(collection)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
_, err = w.rpc.Command(ctx, &pb.CommandRequest{Kind: workflowDefinitionsKind, Command: "validate", ValueJson: value})
|
||||
if status.Code(err) == codes.InvalidArgument {
|
||||
return status.Convert(err).Message(), nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%w: %w", ErrUnavailable, err)
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
@@ -18,10 +18,12 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
)
|
||||
|
||||
// ReleaseSlug is the repository releases are published to.
|
||||
const ReleaseSlug = "samcharles93/archie-core"
|
||||
// ReleaseSlug is the public repository releases are published to. The source
|
||||
// repository is private, so its releases are unreachable without credentials.
|
||||
const ReleaseSlug = "samcharles93/archie-releases"
|
||||
|
||||
const changelogURL = "https://github.com/" + ReleaseSlug + "/blob/main/CHANGELOG.md"
|
||||
// changelogURL lists every release with its changelog section as notes.
|
||||
const changelogURL = "https://github.com/" + ReleaseSlug + "/releases"
|
||||
|
||||
// buildSuffix is the git-describe tail of an untagged build (1.7.0-4-g0736708).
|
||||
var buildSuffix = regexp.MustCompile(`-[0-9]+-g[0-9a-f]+$`)
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# Publishes a tagged release by hand: the agent and archied images to GHCR,
|
||||
# then the linux-amd64 zip, SHA256SUMS and install.sh to the public releases
|
||||
# repository, whose release notes are the version's changelog section.
|
||||
# Builds from a clean worktree of the tag, so local edits never ship.
|
||||
set -euo pipefail
|
||||
|
||||
version="${1:?usage: tools/publish.sh X.Y.Z}"
|
||||
tag="v$version"
|
||||
releases="samcharles93/archie-releases"
|
||||
registry="ghcr.io/samcharles93"
|
||||
root="$(git rev-parse --show-toplevel)"
|
||||
work="$(mktemp -d)"
|
||||
trap 'git -C "$root" worktree remove --force "$work/src" >/dev/null 2>&1 || true; rm -rf "$work"' EXIT
|
||||
|
||||
git -C "$root" worktree add -q --detach "$work/src" "$tag"
|
||||
cd "$work/src"
|
||||
sha="$(git rev-parse "$tag^{commit}")"
|
||||
|
||||
docker build -q -f Dockerfile --build-arg RUNTIME_VERSION="$version" \
|
||||
-t "$registry/archie-agent:latest" -t "$registry/archie-agent:sha-$sha" . >/dev/null
|
||||
docker push -q "$registry/archie-agent:latest"
|
||||
docker push -q "$registry/archie-agent:sha-$sha"
|
||||
digest="$(docker inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "$registry/archie-agent:latest" |
|
||||
grep "^$registry/archie-agent@" | head -1 | cut -d@ -f2)"
|
||||
test -n "$digest"
|
||||
|
||||
docker build -q -f Dockerfile.archied --build-arg GATEWAY_VERSION="$version" --build-arg RUNTIME_VERSION="$version" \
|
||||
-t "$registry/archied:latest" -t "$registry/archied:edge" -t "$registry/archied:sha-$sha" . >/dev/null
|
||||
for t in latest edge "sha-$sha"; do docker push -q "$registry/archied:$t"; done
|
||||
|
||||
ldflags="-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=$version -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=$version"
|
||||
name="archie-core-archied-$tag-linux-amd64"
|
||||
mkdir -p "$name"
|
||||
for cmd in $(jq -r '.required_topology.units[]' release.json); do
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$ldflags" -o "$name/$cmd" "./cmd/$cmd"
|
||||
done
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/"
|
||||
jq --arg image "$registry/archie-agent@$digest" '. + {agent_image: $image}' release.json >"$name/release.json"
|
||||
if [ -f README.md ]; then cp README.md "$name/"; fi
|
||||
zip -qr "$name.zip" "$name"
|
||||
sha256sum "$name.zip" >SHA256SUMS
|
||||
|
||||
awk -v hdr="## [$version]" 'index($0,hdr)==1{p=1} p&&/^## \[/&&index($0,hdr)!=1{exit} p{print}' CHANGELOG.md >notes.md
|
||||
test -s notes.md
|
||||
gh release create "$tag" -R "$releases" --title "archie $tag" --notes-file notes.md "$name.zip" SHA256SUMS install.sh
|
||||
echo "published $tag to $releases (agent $digest)"
|
||||
Reference in new issue
Block a user