Modifies ADO script to include new variable
Ensure KUBE_INGRESS_BASE_DOMAIN existence by setting his value to AUTO_DEVOPS_DOMAIN if the first one doesnt exists. Also made corresponding changes throughout the whole script Related to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24580
This commit is contained in:
parent
8ff73614a1
commit
6fe15fdc52
1 changed files with 25 additions and 12 deletions
|
@ -21,8 +21,8 @@
|
|||
#
|
||||
# In order to deploy, you must have a Kubernetes cluster configured either
|
||||
# via a project integration, or via group/project variables.
|
||||
# AUTO_DEVOPS_DOMAIN must also be set as a variable at the group or project
|
||||
# level, or manually added below.
|
||||
# KUBE_INGRESS_BASE_DOMAIN must also be set on the cluster settings,
|
||||
# as a variable at the group or project level, or manually added below.
|
||||
#
|
||||
# Continuous deployment to production is enabled by default.
|
||||
# If you want to deploy to staging first, set STAGING_ENABLED environment variable.
|
||||
|
@ -41,8 +41,8 @@
|
|||
image: alpine:latest
|
||||
|
||||
variables:
|
||||
# AUTO_DEVOPS_DOMAIN is the application deployment domain and should be set as a variable at the group or project level.
|
||||
# AUTO_DEVOPS_DOMAIN: domain.example.com
|
||||
# KUBE_INGRESS_BASE_DOMAIN is the application deployment domain and should be set as a variable at the group or project level.
|
||||
# KUBE_INGRESS_BASE_DOMAIN: domain.example.com
|
||||
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: testing-password
|
||||
|
@ -251,7 +251,7 @@ review:
|
|||
- persist_environment_url
|
||||
environment:
|
||||
name: review/$CI_COMMIT_REF_NAME
|
||||
url: http://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.$AUTO_DEVOPS_DOMAIN
|
||||
url: http://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.$KUBE_INGRESS_BASE_DOMAIN
|
||||
on_stop: stop_review
|
||||
artifacts:
|
||||
paths: [environment_url.txt]
|
||||
|
@ -306,7 +306,7 @@ staging:
|
|||
- deploy
|
||||
environment:
|
||||
name: staging
|
||||
url: http://$CI_PROJECT_PATH_SLUG-staging.$AUTO_DEVOPS_DOMAIN
|
||||
url: http://$CI_PROJECT_PATH_SLUG-staging.$KUBE_INGRESS_BASE_DOMAIN
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
|
@ -330,7 +330,7 @@ canary:
|
|||
- deploy canary
|
||||
environment:
|
||||
name: production
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
|
||||
when: manual
|
||||
only:
|
||||
refs:
|
||||
|
@ -354,7 +354,7 @@ canary:
|
|||
- persist_environment_url
|
||||
environment:
|
||||
name: production
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
|
||||
artifacts:
|
||||
paths: [environment_url.txt]
|
||||
|
||||
|
@ -403,7 +403,7 @@ production_manual:
|
|||
- persist_environment_url
|
||||
environment:
|
||||
name: production
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
|
||||
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
|
||||
artifacts:
|
||||
paths: [environment_url.txt]
|
||||
|
||||
|
@ -823,11 +823,24 @@ rollout 100%:
|
|||
kubectl describe namespace "$KUBE_NAMESPACE" || kubectl create namespace "$KUBE_NAMESPACE"
|
||||
}
|
||||
|
||||
|
||||
# Function to ensure backwards compatibility with AUTO_DEVOPS_DOMAIN
|
||||
function ensure_kube_ingress_base_domain() {
|
||||
if [ -z ${KUBE_INGRESS_BASE_DOMAIN+x} ]; then
|
||||
export KUBE_INGRESS_BASE_DOMAIN=$AUTO_DEVOPS_DOMAIN
|
||||
fi
|
||||
}
|
||||
|
||||
function check_kube_domain() {
|
||||
if [ -z ${AUTO_DEVOPS_DOMAIN+x} ]; then
|
||||
echo "In order to deploy or use Review Apps, AUTO_DEVOPS_DOMAIN variable must be set"
|
||||
echo "You can do it in Auto DevOps project settings or defining a variable at group or project level"
|
||||
ensure_kube_ingress_base_domain
|
||||
|
||||
if [ -z ${KUBE_INGRESS_BASE_DOMAIN+x} ]; then
|
||||
echo "In order to deploy or use Review Apps,"
|
||||
echo "AUTO_DEVOPS_DOMAIN or KUBE_INGRESS_BASE_DOMAIN variables must be set"
|
||||
echo "From 11.8, you can set KUBE_INGRESS_BASE_DOMAIN in cluster settings"
|
||||
echo "or by defining a variable at group or project level."
|
||||
echo "You can also manually add it in .gitlab-ci.yml"
|
||||
echo "AUTO_DEVOPS_DOMAIN support will be dropped on 12.0"
|
||||
false
|
||||
else
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue