feat(workflows): firewall workflow package; pack.sh builds files-only packages

This commit is contained in:
sam committed 2026-10-04 03:10:06 +11:00
1 parent 7b34ada564
commit 6db3299f15
5 files changed
+86 -9

No files matched your search

+5 -3
View File
@@ -5,6 +5,7 @@ directory holds one subdirectory per extension.
``` ```
secret-engines/<name>/ package.yaml + Go source, served over secretengine.v1 secret-engines/<name>/ package.yaml + Go source, served over secretengine.v1
workflows/<name>/ package.yaml + workflow YAML, projected into workflow-definitions
sdk/ generated surface stubs and the Serve helper sdk/ generated surface stubs and the Serve helper
scripts/pack.sh build one package and push it to a registry scripts/pack.sh build one package and push it to a registry
``` ```
@@ -20,8 +21,9 @@ the Go SDK is a convenience.
scripts/pack.sh secret-engines/bws localhost:5001/bws:1.0.0 # prints the digest scripts/pack.sh secret-engines/bws localhost:5001/bws:1.0.0 # prints the digest
``` ```
Install the printed digest through archie-core's package store, accept the Install the printed digest from the Extensions page, accept the authority the
authority the package declares, then enable it in `extension-settings`. An package declares, then enable it. An extension runs only while all three hold.
extension runs only while all three hold. A data package (no `main.go`) needs only the install: its files are projected
into the matching resource and withdrawn when the package is removed.
Platform: linux/amd64. Platform: linux/amd64.
+16 -6
View File
@@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build one package and push it to a registry as an archie-core store package. # Build one package and push it to a registry as an archie-core store package.
# scripts/pack.sh secret-engines/bws localhost:5001/bws:1.0.0 # scripts/pack.sh secret-engines/bws localhost:5001/bws:1.0.0
# Prints the manifest digest, the pin archie-core installs by. # scripts/pack.sh workflows/firewall localhost:5001/firewall:1.0.0
# A directory with a main.go is an extension: it is built to bin/<name>. Every
# other file beside package.yaml is carried as written, at the path package.yaml
# declares. Prints the manifest digest, the pin archie-core installs by.
set -euo pipefail set -euo pipefail
dir=${1:?package directory, e.g. secret-engines/bws} dir=${1:?package directory, e.g. secret-engines/bws}
@@ -10,12 +13,19 @@ root=$(cd "$(dirname "$0")/.." && pwd)
work=$(mktemp -d) work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT trap 'rm -rf "$work"' EXIT
mkdir -p "$work/stage/bin" "$work/oci/blobs/sha256" mkdir -p "$work/stage" "$work/oci/blobs/sha256"
(cd "$root" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags='-s -w' \ if [ -f "$root/$dir/main.go" ]; then
-o "$work/stage/bin/$(basename "$dir")" "./$dir") mkdir -p "$work/stage/bin"
chmod 0755 "$work/stage/bin/$(basename "$dir")" (cd "$root" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags='-s -w' \
-o "$work/stage/bin/$(basename "$dir")" "./$dir")
chmod 0755 "$work/stage/bin/$(basename "$dir")"
fi
(cd "$root/$dir" && find . -type f ! -name package.yaml ! -name '*.go' ! -name go.mod ! -name go.sum -print0 \
| while IFS= read -r -d '' f; do install -D -m 0644 "$f" "$work/stage/${f#./}"; done)
tar --owner=0 --group=0 --numeric-owner --sort=name -C "$work/stage" -czf "$work/layer.tgz" "bin/$(basename "$dir")" # Regular files only: the store refuses directory entries in a layer.
(cd "$work/stage" && find . -type f -printf '%P\n' | LC_ALL=C sort >"$work/files.txt" \
&& tar --owner=0 --group=0 --numeric-owner --no-recursion -czf "$work/layer.tgz" -T "$work/files.txt")
blob() { local d; d=$(sha256sum "$1" | cut -d' ' -f1); cp "$1" "$work/oci/blobs/sha256/$d"; echo "sha256:$d"; } blob() { local d; d=$(sha256sum "$1" | cut -d' ' -f1); cp "$1" "$work/oci/blobs/sha256/$d"; echo "sha256:$d"; }
printf '{}' >"$work/config.json" printf '{}' >"$work/config.json"
+13
View File
@@ -0,0 +1,13 @@
apiVersion: dev.archie.package.v1
displayName: Firewall investigate and contain
description: Investigate a source address from firewall logs, then decide and record containment. Needs a network-investigator agent profile.
version: 1.0.0
contributes:
workflows:
- workflows/firewall-investigate.yaml
- workflows/firewall-contain.yaml
files:
- path: workflows/firewall-investigate.yaml
mode: 420
- path: workflows/firewall-contain.yaml
mode: 420
@@ -0,0 +1,27 @@
# The containment workflow a firewall-investigate run calls:
# firewall-investigate (workflow.call, wait: true) hands its findings upward
# from its declared summary, and this workflow's own agent stage decides and
# records the containment as its own declared outputs. Paste it into the
# dashboard's workflow definitions alongside firewall-investigate.
id: firewall-contain
repository: none
profile: network-investigator
inputs:
src_ip: { type: string, required: true }
outputs:
contained: { type: bool, required: true }
summary: { type: string }
steps:
- type: workflow.call
settings:
workflow: firewall-investigate
wait: true
inputs: { src_ip: "inputs.src_ip" }
outputs: { summary: "outputs.summary" }
- type: agent.run
settings:
mission: >-
Using the investigation summary the called workflow returned, decide
whether the source address in the inputs should be contained. Write
your decision with the contained tool, and a one-line rationale with
the summary tool.
@@ -0,0 +1,25 @@
# A workflow with no repository: a binding on a firewall event type assigns
# src_ip from a mapped parameter and runs one agent mission in a scratch
# workspace under the network-investigator profile. Paste it into the
# dashboard's workflow definitions.
#
# Its declared output (summary) is offered to the agent stages as a capture
# tool named after it; a wait:true caller publishes it as one of its own
# outputs.
id: firewall-investigate
repository: none
profile: network-investigator
inputs:
src_ip: { type: string, required: true }
severity: { type: string }
outputs:
summary: { type: string }
steps:
- type: agent.run
settings:
mission: >-
Investigate the source address in the inputs: who owns it, what it
resolves to, and whether it is reachable. Report what you found and
how serious it looks given the severity, and write your one-line
conclusion with the summary tool.
read_only: true