flake-update-diff/utils/attic-token.bash
ahuston-0 407c5f07a7
Some checks failed
Check flake.lock / Check health of `flake.lock` (pull_request) Successful in 8s
Check Nix flake / Build nix outputs (ubuntu-latest) (pull_request) Failing after 1m19s
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Failing after 1m20s
Check Nix formatting / Perform Nix format checks (pull_request) Failing after 1m19s
remove wheel preference, add CI
2025-03-18 15:31:05 -04:00

37 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
if (($# != 3)); then
echo "usage: $0 <cache/cache group> <cache pattern> <token type>"
exit 1
fi
cache="$1"
cache_pattern="$2"
token_type="$3"
case $token_type in
"cache-creator")
atticd-atticadm make-token --sub "$cache-cache-creator" --validity "1y" \
--pull "$cache_pattern" --push "$cache_pattern" --delete "$cache_pattern" \
--create-cache "$cache_pattern" --configure-cache "$cache_pattern" \
--configure-cache-retention "$cache_pattern" --destroy-cache "$cache_pattern"
;;
"admin")
atticd-atticadm make-token --sub "$cache-admin" --validity "1y" --pull "$cache_pattern" \
--push "$cache_pattern" --configure-cache "$cache_pattern" \
--configure-cache-retention "$cache_pattern"
;;
"writer")
atticd-atticadm make-token --sub "$cache-writer" --validity "1y" --pull "$cache_pattern" \
--push "$cache_pattern"
;;
"reader")
atticd-atticadm make-token --sub "$cache-reader" --validity "1y" --pull "$cache_pattern"
;;
*)
echo "invalid token type: $token_type"
echo "available options: cache-creator, admin, writer, reader"
exit 1
;;
esac