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