Commit 21a5703
Eric Bower
·
2026-06-12 20:55:19 -0400 EDT
parent 8ad04da
refactor: simplify names
M
main.go
+12,
-10
1@@ -258,17 +258,18 @@ EXAMPLE
2
3 ENV VARS IN pico.sh
4 The runner exports these environment variables for your pico.sh script:
5- PICO_CI_JOB_ID Unique job identifier (e.g. "a3f2b8c1")
6- PICO_CI_REPO Repository name (from event "name" field)
7- PICO_CI_EVENT_TYPE Event type (e.g. "git.push", "git.tag")
8- PICO_CI_TAG_NAME Tag name (set only for git.tag events)
9+ PICI_JOB Unique job identifier (e.g. "a3f2b8c1")
10+ PICI_REPO Repository name (from event "name" field)
11+ PICI_EVENT Event type (e.g. "git.push", "git.tag")
12+ PICI_TAG Git tag name (set only for git.tag events)
13+ PICI_BRANCH Git branch name (set only for git.push events)
14
15 Note: pico.sh runs with the workspace as its working directory, so
16 $(pwd) gives you the workspace path directly.
17
18 Use them with defaults so pico.sh works standalone:
19- JOB_ID="${PICO_CI_JOB_ID:-local}"
20- REPO="${PICO_CI_REPO:-unknown}"
21+ JOB="${PICI_JOB:-local}"
22+ REPO="${PICI_REPO:-unknown}"
23
24 FLAGS
25 -pk <path> SSH private key for authenticating with pico services
26@@ -540,12 +541,13 @@ func (eng *JobEngine) Run(manifest string) error {
27 }
28 }
29 cmdEnv = append(cmdEnv,
30- fmt.Sprintf("PICO_CI_JOB_ID=%s", eng.JobID),
31- fmt.Sprintf("PICO_CI_REPO=%s", eng.Ev.Name),
32- fmt.Sprintf("PICO_CI_EVENT_TYPE=%s", eng.Ev.Type),
33+ fmt.Sprintf("PICI_JOB=%s", eng.JobID),
34+ fmt.Sprintf("PICI_REPO=%s", eng.Ev.Name),
35+ fmt.Sprintf("PICI_EVENT=%s", eng.Ev.Type),
36+ fmt.Sprintf("PICI_BRANCH=%s", eng.Ev.Branch),
37 )
38 if eng.Ev.Tag != "" {
39- cmdEnv = append(cmdEnv, fmt.Sprintf("PICO_CI_TAG_NAME=%s", eng.Ev.Tag))
40+ cmdEnv = append(cmdEnv, fmt.Sprintf("PICI_TAG=%s", eng.Ev.Tag))
41 }
42
43 zmxPrefixStr := fmt.Sprintf("ZMX_SESSION_PREFIX=%s", childPrefix)
D
run.fish
+0,
-16
1@@ -1,16 +0,0 @@
2-#!/usr/bin/env fish
3-
4-# Continuously subscribe to build events and feed them to pici runner.
5-# Reconnects immediately after each event, delays only on connection errors.
6-# Usage: ./run.fish
7-
8-while true
9- echo "waiting for build.event ..."
10- set event (ssh pipe sub build.event 2>/dev/null)
11- if test -n "$event"
12- echo "$event" | pici runner --wait
13- else
14- echo "could not connect to pipe, waiting 5s..."
15- sleep 5
16- end
17-end
A
run.sh
+16,
-0
1@@ -0,0 +1,16 @@
2+#!/usr/bin/env bash
3+
4+# Continuously subscribe to build events and feed them to pici runner.
5+# Reconnects immediately after each event, delays only on connection errors.
6+# Usage: ./run.sh
7+
8+while true; do
9+ echo "waiting for build.event ..."
10+ event=$(ssh pipe sub build.event 2>/dev/null)
11+ if [ -n "$event" ]; then
12+ echo "$event" | pici runner --wait
13+ else
14+ echo "could not connect to pipe, waiting 5s..."
15+ sleep 5
16+ fi
17+done