fix: unstable secret generation
Some checks failed
/ deploy (push) Failing after 6s

This commit is contained in:
ange 2024-12-22 05:43:37 +00:00
parent a0e8849beb
commit 5e83c6fa89
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D

View File

@ -46,13 +46,20 @@ export POSTGRES_DB; POSTGRES_DB="$(kgseckey postgres-app dbname)"
export POSTGRES_USER; POSTGRES_USER="$(kgseckey postgres-app user)"
export POSTGRES_PASSWORD; POSTGRES_PASSWORD="$(kgseckey postgres-app password)"
kubectl run --image "$IMAGEAPP" secrets sleep 600
sleep 5
kcreatesec gitea \
--from-literal=secret_key="$(kgseckey gitea secret_key || kubectl exec secrets -- gitea generate secret SECRET_KEY)" \
--from-literal=internal_token="$(kgseckey gitea internal_token || kubectl exec secrets -- gitea generate secret INTERNAL_TOKEN)" \
--from-literal=oauth2_jwt_secret="$(kgseckey gitea oauth2_jwt_secret || kubectl exec secrets -- gitea generate secret JWT_SECRET)"
kubectl delete pod secrets
# shellcheck disable=SC1090
. <(kubectl run -i --rm --image "$IMAGEAPP" secrets -- bash <<EOF
CAT <<FOF
SECRET_KEY="\$(gitea generate secret SECRET_KEY)"
INTERNAL_TOKEN="\$(gitea generate secret INTERNAL_TOKEN)"
JWT_SECRET="\$(gitea generate secret JWT_SECRET)"
FOF
EOF
)
kcreate gitea \
--from-literal=secret_key="$(kgseckey gitea secret_key || echo "$SECRET_KEY")" \
--from-literal=internal_token="$(kgseckey gitea internal_token || echo "$INTERNAL_TOKEN")" \
--from-literal=oauth2_jwt_secret="$(kgseckey gitea oauth2_jwt_secret || echo "$JWT_SECRET")"
kcreatecm gitea \
--from-file=app.ini=<(envsubst "$(env | xargs printf '$%s ')" < config/app.ini)