100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Pipeline improve production deployment
Michal Rutka987ba359d132
diff --git a/.gitlab-ci.yml b/.gitlab-ci.ymlindex 02fcefb87..0db90ec5e 100644--- a/.gitlab-ci.yml+++ b/.gitlab-ci.yml@@ -12,6 +12,11 @@ variables:DEPLOYMENT_PORT: 2222DAST_WEBSITE: https://staging.${PROJECT_NAME}.openremote.io+workflow:+ rules:+ - if: $CI_COMMIT_BRANCH != "master"+ when: never+stages:- build- build_faildiff --git a/gitlab-ci/gitlab-ci-submodule.yml b/gitlab-ci/gitlab-ci-submodule.ymlindex 61a666261..2d0cab069 100644--- a/gitlab-ci/gitlab-ci-submodule.yml+++ b/gitlab-ci/gitlab-ci-submodule.yml@@ -5,22 +5,29 @@ default:- docker:dind # Docker in docker servicevariables:- ## Following 3 varaiables should be defined as GitLab CI/CD variables+ ## Following 3 variables should be defined as GitLab CI/CD variables#PROJECT_NAME:#DEPLOYMENT_HOST_USER:#DEPLOYMENT_PORT:GIT_SUBMODULE_STRATEGY: normalDAST_WEBSITE: https://staging.${PROJECT_NAME}.${DOMAIN}+workflow:+ rules:+ - if: $CI_COMMIT_BRANCH != "master"+ when: never+stages:- - build+ - build_staging- build_fail- test- deploy- dast+ - build_production+ - deploy_production+ - deploy_production_clean.build_template: &build_definition- stage: buildvariables:SCAN_IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHAMANAGER_IMAGE_TAG: $CI_REGISTRY_IMAGE/manager:$CI_ENVIRONMENT_SLUG@@ -63,26 +70,16 @@ stages:- docker push "$CI_REGISTRY_IMAGE/keycloak:$CI_ENVIRONMENT_SLUG-$CI_COMMIT_TAG"- fi-build production docker images:- rules:- - if: $CI_COMMIT_BRANCH == "master"- when: manual- allow_failure: true- environment: production- <<: *build_definition-build staging docker images:+ stage: build_stagingrules:- - if: $CI_COMMIT_BRANCH != "master"- when: never- if: $CI_COMMIT_MESSAGE !~ /skip-build/environment: staging<<: *build_definitionbuild manually staging docker images:+ stage: build_stagingrules:- - if: $CI_COMMIT_BRANCH != "master"- when: never- if: $CI_COMMIT_MESSAGE =~ /skip-build/when: manualallow_failure: true@@ -111,8 +108,6 @@ email failed pipeline:-e "SMTP_PASSWORD=$SMTP_PASSWORD"--rm python:3 python aws_mail.pywhen: on_failure- only:- - masterinclude:- template: Container-Scanning.gitlab-ci.yml@@ -131,7 +126,6 @@ include:- alias SCP="scp -p -r -P $DEPLOYMENT_PORT".deploy_template: &deploy_definition- stage: deploybefore_script:- *ssh_configscript:@@ -175,9 +169,7 @@ include:expire_in: 1 weekdeploy staging:- rules:- - if: $CI_COMMIT_BRANCH == "master"- when: on_success+ stage: deployvariables:DEPLOYMENT_HOST: ${CI_ENVIRONMENT_SLUG}.${PROJECT_NAME}.${DOMAIN}SETUP_WIPE_CLEAN_INSTALL: 'true'@@ -186,11 +178,14 @@ deploy staging:url: https://${CI_ENVIRONMENT_SLUG}.${PROJECT_NAME}.${DOMAIN}<<: *deploy_definition+build production docker images:+ stage: build_production+ when: manual+ environment: production+ <<: *build_definition+deploy production:- rules:- - if: $CI_COMMIT_BRANCH == "master"- when: manual- allow_failure: true+ stage: deploy_productionvariables:DEPLOYMENT_HOST: ${PROJECT_NAME}.${DOMAIN}SETUP_WIPE_CLEAN_INSTALL: 'false'@@ -198,3 +193,14 @@ deploy production:name: productionurl: https://${PROJECT_NAME}.${DOMAIN}<<: *deploy_definition++deploy production clean:+ stage: deploy_production_clean+ when: on_failure+ variables:+ DEPLOYMENT_HOST: ${PROJECT_NAME}.${DOMAIN}+ SETUP_WIPE_CLEAN_INSTALL: 'true'+ environment:+ name: production+ url: https://${PROJECT_NAME}.${DOMAIN}+ <<: *deploy_definition