diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57a8301f3792e5e3317b3dbd1af1bd5e592f8020..b73d4cfb0742c11e4ca18856b69952b51b00130b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ workflow: rules: - - if: >- - $CI_COMMIT_BRANCH == "staging" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: '$CI_COMMIT_BRANCH == "staging" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: always - when: never @@ -130,7 +129,7 @@ deploy-image: variables: ENVIRONMENT_NAME: 'staging' STATIC_IP: 'staging-todoapp-ip' - - if: $CI_COMMIT_REF_NAME !~ /main/ + - if: $CI_COMMIT_REF_NAME =~ /main/ when: 'always' variables: ENVIRONMENT_NAME: 'production' @@ -150,6 +149,3 @@ deploy-image: - kubectl apply -f service.yaml --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}" - INGRESS_MANIFEST=$(sed -e "s,{{static-ip-name}},${STATIC_IP},g" ./ingress.yaml.tmpl) - echo "${INGRESS_MANIFEST}" | kubectl apply --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}" --filename - - - -