Files
orca/scripts/trigger_coreci.sh
T
Jon Chery aa3cccead5 feat(P01): CLI skeleton with Cobra, subcommand stubs, pre-push hook
Implements Phase 1 of v0.1 Foundation:
- go.mod with Go 1.25
- cmd/orca/main.go entry point
- internal/cli/root.go with global --json flag
- internal/cli/version.go (orca version)
- internal/cli/init.go (orca init - creates ~/.orca/)
- internal/cli/status.go (orca status - shows daemon info)
- internal/cli/node.go (orca node {join,leave,list} - stubs)
- internal/cli/job.go (orca job {run,list,stop,logs} - stubs)
- Makefile (build, test, lint, fmt, release)
- LICENSE (MIT)
- README.md with quickstart
- .gitignore
- .githooks/pre-push + scripts/trigger_coreci.sh (CoreCI trigger)
- Smoke tests in internal/cli/root_test.go

Verified: go build, go test, go vet, gofmt all pass.

---ci---
project: orca
phase: 1
milestone: v0.1
status: execute
req_covered:
  - REQ-001
  - REQ-002
  - REQ-013
  - REQ-015
  - REQ-016
  - REQ-019
  - REQ-024
---/ci---
2026-06-03 12:23:37 +00:00

32 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# trigger_coreci.sh - Trigger CoreCI pipeline for the pushed branch
# Invoked by .githooks/pre-push
# Gracefully degrades if CoreCI API is unreachable (Gitea webhook is secondary path).
set -uo pipefail
CORECI_URL="${CORECI_URL:-https://git.cloudinit.dev/coreci/coreci}"
GITEA_TOKEN="${GITEA_TOKEN:-}"
if [ -z "$GITEA_TOKEN" ]; then
echo " (skip: GITEA_TOKEN not set)"
exit 0
fi
while read local_ref local_sha remote_ref remote_sha; do
branch="${remote_ref#refs/heads/}"
if [ -z "$branch" ] || [ "$branch" = "HEAD" ]; then
continue
fi
echo "→ Triggering CoreCI for branch: $branch (${local_sha:0:7})"
payload=$(printf '{"repo":"coreci/orca","branch":"%s","ref":"%s"}' "$branch" "$local_sha")
if command -v curl >/dev/null 2>&1; then
curl -fsS -X POST "${CORECI_URL}/api/pipeline/run" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$payload" >/dev/null 2>&1 \
&& echo " ✓ CoreCI triggered" \
|| echo " (CoreCI trigger failed; pipeline may run via webhook)"
fi
done