13 lines
600 B
Bash
13 lines
600 B
Bash
#!/bin/bash
|
|
|
|
TOKEN="$(kubectl exec -ti gitea-0 -- su git -c 'gitea actions generate-runner-token 2> /dev/null | grep -E "^[a-zA-Z0-9_-]*$" | grep . | tail -1' | tr -dc a-zA-Z0-9_-)"
|
|
|
|
if [ x"$TOKEN" = x ];then
|
|
1>&2 echo "Token could not be extracted."
|
|
# if this happens, the CLI has probably changed. you'll need to run gitea actions generate-runner-token
|
|
# and see what's different or what's broken. recommended to do that in the gitea sts pod.
|
|
exit 1
|
|
fi
|
|
|
|
kubectl create secret generic -n gitea gitea-runner-token --from-literal=token="$TOKEN" --dry-run=client -o yaml | kubectl apply -f -
|