taskfiles/cfa-taskfiles/spacelift.yml
2024-12-31 20:31:25 -05:00

38 lines
1.1 KiB
YAML

version: '3'
tasks:
login:
desc: login to spacelift
cmd: |
spacectl profile login
stacks:
desc: list stacks
cmd: |
spacectl stack list -o json | jq -r '.[] | .id'
unconfirmed:
desc: list stacks with unconfirmed runs
cmd: |
spacectl stack list -o json | jq '.[] | select(.state == "UNCONFIRMED") | {id,Blocker,trackedCommit}'
spacectl stack list -o json | jq -r '.[] | select(.state == "UNCONFIRMED") | "spacectl stack confirm --id \(.id) --run \(.Blocker.id)"'
runs:
desc: show recent runs for a stack (must supply stack id)
cmd: |
spacectl stack run list --id {{.STACK}}
requires:
vars: [STACK]
confirm:
desc: confirm a run (must supply stack id and run id as cli args)
cmd: |
spacectl stack confirm --id {{ .STACK }} --run {{ .RUN }}
requires:
vars: [STACK,RUN]
help:
desc: display some spacelift env help
silent: true
cmd: |
printf 'To run TF that uses the spacelift provider, do:\n'
printf '\tspacectl profile login\n'
printf '\texport SPACELIFT_API_TOKEN=$(spacectl profile export-token)\n'