This commit is contained in:
2024-05-31 14:49:51 +02:00
parent 95627911b2
commit df6f8684b0

View File

@@ -33,10 +33,10 @@ resource "kubectl_manifest" "post_install_job_taiga" {
command: ["/bin/bash", "-xc"] command: ["/bin/bash", "-xc"]
args: args:
- >- - >-
API='http://taiga-taiga.${var.namespace}.svc/api/v1'; API='http://taiga-taiga.${var.domain}-ci.svc/api/v1';
TOKEN=$(curl -X POST -sH "Content-Type: application/json" -d '{ "type": "normal", "username": "admin", "password": "'"$DJANGO_SUPERUSER_PASSWORD"'" }' "$API/auth" | jq -r '.auth_token'); TOKEN=$(curl -X POST -sH "Content-Type: application/json" -d '{ "type": "normal", "username": "admin", "password": "'"$DJANGO_SUPERUSER_PASSWORD"'" }' "$API/auth" | jq -r '.auth_token');
if ! curl -sH "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "$API/projects"|jq -r '.[].name' |grep -E '^${trimprefix(var.instance,"org-")}$'; then if ! curl -sH "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "$API/projects"|jq -r '.[].name' |grep -E '^${trimprefix(var.instance,"org-")}$'; then
curl -X POST -sH "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "http://taiga-taiga.${var.namespace}.svc/api/v1/projects" -d '{ "creation_template": 1, "description": "Organisation ${trimprefix(var.instance,"org-")} project", "is_backlog_activated": true, "is_issues_activated": true, "is_kanban_activated": true, "is_private": true, "is_wiki_activated": true, "name": "${trimprefix(var.instance,"org-")}", }'; curl -X POST -sH "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "$API/projects" -d '{ "creation_template": 1, "description": "Organisation ${trimprefix(var.instance,"org-")} project", "is_backlog_activated": true, "is_issues_activated": true, "is_kanban_activated": true, "is_private": true, "is_wiki_activated": true, "name": "${trimprefix(var.instance,"org-")}", }';
fi fi
envFrom: envFrom:
- secretRef: - secretRef: