Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 66 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ permissions:
id-token: write

# Every job here runs on GitHub-hosted runners: this repository is public and
# its workflows must never reach a self-hosted fleet (NR-G). The plan and run
# lanes for infra/* arrive with NR1.
# its workflows must never reach a self-hosted fleet (NR-G).
jobs:
# THE WORK TREE, BEFORE THE MERGE: a malformed epic.yaml, a listed task with
# no contract or a stray contract in the NR prefix fails the pull request.
Expand All @@ -32,6 +31,71 @@ jobs:
version: v2.69.0
- run: orun work check --base "origin/${{ github.base_ref }}"

plan:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
job-matrix: ${{ steps.matrix.outputs.job-matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.69.0
- run: |
set -euo pipefail
orun plan \
--from-ci github \
--event-file "$GITHUB_EVENT_PATH" \
--intent intent.yaml \
--output plan.json \
--changed
- id: matrix
run: |
echo "job-matrix=$(jq -c '[.jobs[] | {"job-id": .id, "job-name": .checkName}]' plan.json)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
name: orun-plan
path: plan.json

# One lane per plan job. Remote state is on for pull requests too: the
# terraform-aws composition keeps Terraform state on the platform (the runner
# exports TF_HTTP_* only under --remote-state), and the plan-only profile
# never applies. AWS credentials come from the aws-admin-owned role over OIDC.
run:
needs: plan
if: ${{ needs.plan.outputs.job-matrix != '[]' && needs.plan.outputs.job-matrix != '' }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.plan.outputs.job-matrix) }}
name: ${{ matrix.job-name }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: orun-plan
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.69.0
- run: |
set -euo pipefail
retry_flag=""
if [ "${GITHUB_RUN_ATTEMPT:-1}" -gt 1 ]; then retry_flag="--retry"; fi
orun run \
--plan plan.json \
--runner github-actions \
--remote-state \
--job "${{ matrix.job-id }}" \
--exec-id "${{ github.run_id }}" \
$retry_flag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# THE WORK TREE, AFTER THE MERGE: Orunbase is reconciled from work/ under CI's
# OIDC identity. Idempotent by repo, path and commit; never deletes.
work-sync:
Expand Down
Empty file added infra/.gitkeep
Empty file.
19 changes: 17 additions & 2 deletions intent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ work:
tasks: work/tasks
sync: on-merge

# Compositions arrive with NR1 (stack-granite terraform-aws, pinned by OCI
# digest). Until then the repo carries only its work tree.
# The compositions are stack-granite's, consumed as a published OCI artifact
# and pinned by version: a bare reference resolves to :latest, which would let
# a catalog release change this repo's execution contracts without a commit
# here. terraform-aws brings OIDC-assumed AWS credentials and Orun-held state.
compositions:
sources:
- name: stack-granite
kind: oci
ref: oci://ghcr.io/sourceplane/stack-granite:0.1.0
resolution:
precedence:
- stack-granite
bindings:
terraform-aws: stack-granite

discovery:
roots:
- infra/
Expand Down Expand Up @@ -61,5 +74,7 @@ environments:
namespacePrefix: nimbus-
owner: sourceplane
repo: nimbus-runners
# Owned by sourceplane/aws-admin (github-repo-sourceplane-nimbus-runners).
awsRoleArn: arn:aws:iam::306024784101:role/github-sourceplane-nimbus-runners
env:
AWS_REGION: us-east-1
13 changes: 10 additions & 3 deletions work/epics/nimbus-runners-baseline/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ As-built ≠ intent. This file records what actually shipped, and every place th

| Milestone | State | PR |
|---|---|---|
| NR0 — the spec | in review | |
| NR1 — foundations | | |
| NR0 — the spec | ✅ merged, synced | [#1](https://github.com/sourceplane/nimbus-runners/pull/1), [#2](https://github.com/sourceplane/nimbus-runners/pull/2) |
| NR1 — foundations | in progress | NR-2; [stack-granite#1](https://github.com/sourceplane/stack-granite/pull/1) + tag v0.1.0; [aws-admin#35](https://github.com/sourceplane/aws-admin/pull/35) |
| NR2 — the fleet | | |
| NR3 — the image | | |
| NR4 — orun-cloud on the fleet | | |
Expand All @@ -22,4 +22,11 @@ As-built ≠ intent. This file records what actually shipped, and every place th

## Departures from the design

None yet.
### One role, not a plan/deploy pair (NR1)

The design named a plan role for pull requests and main, and a deploy role for `prod`. stack-granite's `terraform-aws` takes one `awsRoleArn` per environment, and orun has no per-trigger parameter override. So the PR plan lane and the main apply lane assume one role, `github-sourceplane-nimbus-runners`, trusted for `pull_request` and `ref:refs/heads/main`.

What limits it:
- Fork pull requests never receive an OIDC token.
- Every role the fleet creates must carry `nimbus-runners-boundary`, which the role cannot loosen.
- IAM, Lambda, SQS, SSM, S3, logs, events and budgets are scoped to `nimbus-runners*`.
4 changes: 2 additions & 2 deletions work/epics/nimbus-runners-baseline/epic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ spec:
- name: "NR1 — foundations"
exitCriteria:
- "stack-granite 0.1.0 resolves from ghcr.io and orun plan loads its terraform-aws composition here"
- "a PR lane assumes the aws-admin-owned nimbus-runners plan role over GitHub OIDC"
tasks: []
- "a PR lane assumes the aws-admin-owned nimbus-runners role over GitHub OIDC"
tasks: [NR-2]
- name: "NR2 — the fleet"
exitCriteria:
- "a workflow on runs-on [self-hosted, linux, x64, nimbus] boots a spot instance, passes, and the instance is terminated"
Expand Down
18 changes: 18 additions & 0 deletions work/tasks/NR-2.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: NR-2
title: "Foundations: stack-granite pinned, plan and run lanes"
spec:
goal: "This repository plans through stack-granite 0.1.0's terraform-aws composition with the aws-admin-owned OIDC role, and CI runs one lane per plan job."
affects:
- "intent.yaml"
- ".github/workflows/**"
- "work/**"
- "infra/.gitkeep"
doneWhen:
- "stack-granite 0.1.0 is published to ghcr.io and anonymously pullable (sourceplane/stack-granite#1, tag v0.1.0)"
- "the github-sourceplane-nimbus-runners role and nimbus-runners-boundary exist (sourceplane/aws-admin#35)"
- "orun plan --env prod resolves the OCI stack and binds terraform-aws"
- "CI carries plan and run jobs with remote state and GitHub-hosted runners only"
gates: []
Loading