ci(gitlab): Deploy networkpolcies before all services to avoid race conditions

This commit is contained in:
Dominik Kaminski
2024-04-10 11:09:13 +02:00
committed by Thorsten Roßner
parent 3be3564ec7
commit a943ca9a3c

View File

@@ -28,12 +28,13 @@ stages:
- ".pre" - ".pre"
- "scan" - "scan"
- "automr" - "automr"
- "lint"
- "env-cleanup" - "env-cleanup"
- "env" - "env"
- "pre-services-deploy"
- "basic-services-deploy" - "basic-services-deploy"
- "component-deploy-stage-1" - "component-deploy-stage-1"
- "component-deploy-stage-2" - "component-deploy-stage-2"
- "lint"
- "tests" - "tests"
- "env-stop" - "env-stop"
- ".post" - ".post"
@@ -161,7 +162,7 @@ variables:
fi; fi;
- > - >
echo "Installing ${COMPONENT} into ${NAMESPACE} namespace as ${HELMFILE_ENVIRONMENT} environment on ${CLUSTER}" echo "Installing ${COMPONENT} into ${NAMESPACE} namespace as ${HELMFILE_ENVIRONMENT} environment on ${CLUSTER}"
- "helmfile --namespace ${NAMESPACE} apply --suppress-diff" - "helmfile --namespace ${NAMESPACE} apply --suppress-diff ${ADDITIONAL_ARGS}"
tags: tags:
- "docker" - "docker"
- "kubernetes" - "kubernetes"
@@ -218,6 +219,19 @@ env-start:
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
stage: "env" stage: "env"
policies-deploy:
stage: "pre-services-deploy"
extends: ".deploy-common"
rules:
- if: >
$CI_PIPELINE_SOURCE =~ "web|schedules|triggers" &&
$NAMESPACE =~ /.+/ &&
($DEPLOY_ALL_COMPONENTS != "no" || $DEPLOY_SERVICES != "no")
when: "on_success"
variables:
COMPONENT: "services"
ADDITIONAL_ARGS: "-l name=opendesk-otterize"
services-deploy: services-deploy:
stage: "basic-services-deploy" stage: "basic-services-deploy"
extends: ".deploy-common" extends: ".deploy-common"