Commit 0e97232a authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: support dynamic env url

parent 5a5b1845
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -283,7 +283,6 @@ data:
>     value: "${APP_MENU}"
> ```

<!--
### Environments URL management

The K8S template supports two ways of providing your environments url:
@@ -315,7 +314,6 @@ The **static way** can be implemented simply by setting the appropriate configur

To implement the **dynamic way**, your deployment script shall simply generate a `environment_url.txt` file in the working directory, containing only
the dynamically generated url. When detected by the template, it will use it as the newly deployed environment url.
-->

### Deployment output variables

@@ -351,6 +349,7 @@ The Kubernetes template uses some global configuration used throughout all jobs.
| --------------------- | -------------------------------------- | ----------------- |
| `K8S_KUBECTL_IMAGE`    | the Docker image used to run Kubernetes `kubectl` commands <br/>:warning: **set the version required by your Kubernetes server** | `bitnami/kubectl:latest` |
| `K8S_BASE_APP_NAME`    | default application name              | `$CI_PROJECT_NAME` ([see GitLab doc](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)) |
| `K8S_ENVIRONMENT_URL`    | Default environments url _(only define for static environment URLs declaration)_<br/>_supports late variable expansion (ex: `https://%{environment_name}.k8s.acme.com`)_ | _none_ |
| :lock: `K8S_DEFAULT_KUBE_CONFIG`| default kubeconfig content used by `kubectl`. | **required if not using exploded kubeconfig parameters** |
| `K8S_URL`              | the Kubernetes API url                | **required if using exploded kubeconfig parameters** |
| `K8S_CA_CERT`          | the default Kubernetes server certificate authority | **optional if using exploded kubeconfig parameters** |
@@ -373,12 +372,11 @@ Here are variables supported to configure review environments:
| ------------------------ | -------------------------------------- | ----------------- |
| `K8S_REVIEW_SPACE`       | k8s namespace for `review` env         | _none_ (disabled) |
| `K8S_REVIEW_APP_NAME`    | application name for `review` env      | `"${K8S_BASE_APP_NAME}-${CI_COMMIT_REF_SLUG}"` |
| `K8S_REVIEW_ENVIRONMENT_URL`| The review environments url _(only define for static environment URLs declaration and if different from default)_ | `$K8S_ENVIRONMENT_URL` |
| :lock: `K8S_REVIEW_KUBE_CONFIG` | kubeconfig content used by `kubectl` for `review` env _(only define if not using exploded kubeconfig parameters and if different from default)_ | `$K8S_DEFAULT_KUBE_CONFIG` |
| `K8S_REVIEW_URL`         | Kubernetes API url for `review` env  _(only define if using exploded kubeconfig parameters and if different from default)_    | `$K8S_URL` |
| `K8S_REVIEW_CA_CERT`     | the Kubernetes server certificate authority for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_REVIEW_TOKEN`| service account token for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `K8S_REVIEW_ENVIRONMENT_SCHEME` | The review environment protocol scheme | `https` |
| `K8S_REVIEW_ENVIRONMENT_DOMAIN` | The review environment domain | _none_ |

### Integration environment configuration

@@ -392,11 +390,11 @@ Here are variables supported to configure the integration environment:
| ------------------------ | -------------------------------------- | ----------------- |
| `K8S_INTEG_SPACE`        | k8s namespace for `integration` env    | _none_ (disabled) |
| `K8S_INTEG_APP_NAME`     | application name for `integration` env | `$K8S_BASE_APP_NAME-integration` |
| `K8S_INTEG_ENVIRONMENT_URL`| The integration environment url _(only define for static environment URLs declaration and if different from default)_ | `$K8S_ENVIRONMENT_URL` |
| :lock: `K8S_INTEG_KUBE_CONFIG` | kubeconfig content used by `kubectl` for `integration` env _(only define if not using exploded kubeconfig parameters and if different from default)_ | `$K8S_DEFAULT_KUBE_CONFIG` |
| `K8S_INTEG_URL`          | Kubernetes API url for `integration` env  _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_URL` |
| `K8S_INTEG_CA_CERT`      | the Kubernetes server certificate authority for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_INTEG_TOKEN` | service account token for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `K8S_INTEG_ENVIRONMENT_URL` | The integration environment url **including scheme** (ex: `https://my-application-integration.nonpublic.k8s.domain.com`). Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |

### Staging environment configuration

@@ -410,11 +408,11 @@ Here are variables supported to configure the staging environment:
| ------------------------ | -------------------------------------- | ----------------- |
| `K8S_STAGING_SPACE`      | k8s namespace for `staging` env        | _none_ (disabled) |
| `K8S_STAGING_APP_NAME`   | application name for `staging` env     | `$K8S_BASE_APP_NAME-staging` |
| `K8S_STAGING_ENVIRONMENT_URL`| The staging environment url _(only define for static environment URLs declaration and if different from default)_ | `$K8S_ENVIRONMENT_URL` |
| :lock: `K8S_STAGING_KUBE_CONFIG` | kubeconfig content used by `kubectl` for `staging` env _(only define if not using exploded kubeconfig parameters and if different from default)_ | `$K8S_DEFAULT_KUBE_CONFIG` |
| `K8S_STAGING_URL`        | Kubernetes API url for `staging` env  _(only define if using exploded kubeconfig parameters and if different from default)_   | `$K8S_URL` |
| `K8S_STAGING_CA_CERT`    | the Kubernetes server certificate authority for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_STAGING_TOKEN`| service account token for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `K8S_STAGING_ENVIRONMENT_URL` | The staging environment url **including scheme** (ex: `https://my-application-staging.nonpublic.k8s.domain.com`). Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |

### Production environment configuration

@@ -428,12 +426,12 @@ Here are variables supported to configure the production environment:
| ------------------------ | -------------------------------------- | ----------------- |
| `K8S_PROD_SPACE`         | k8s namespace for `production` env     | _none_ (disabled) |
| `K8S_PROD_APP_NAME`      | application name for `production` env  | `$K8S_BASE_APP_NAME` |
| `K8S_PROD_ENVIRONMENT_URL`| The production environment url _(only define for static environment URLs declaration and if different from default)_ | `$K8S_ENVIRONMENT_URL` |
| :lock: `K8S_PROD_KUBE_CONFIG` | kubeconfig content used by `kubectl` for `production` env _(only define if not using exploded kubeconfig parameters and if different from default)_ | `$K8S_DEFAULT_KUBE_CONFIG` |
| `K8S_PROD_URL`           | Kubernetes API url for `production` env  _(only define if using exploded kubeconfig parameters and if different from default)_| `$K8S_URL` |
| `K8S_PROD_CA_CERT`       | the Kubernetes server certificate authority for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_PROD_TOKEN`  | service account token for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `AUTODEPLOY_TO_PROD`     | Set this variable to auto-deploy to production. If not set deployment to production will be `manual` (default behaviour). | _none_ (disabled) |
| `K8S_PROD_ENVIRONMENT_URL` | The production environment url **including scheme** (ex: `https://my-application.public.k8s.domain.com`) Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |

### kube-score job

+15 −15
Original line number Diff line number Diff line
@@ -35,6 +35,11 @@
      "default": "$CI_PROJECT_NAME",
      "advanced": true
    },
    {
      "name": "K8S_ENVIRONMENT_URL",
      "type": "url",
      "description": "The default environments url _(only define for static environment URLs declaration)_\n\n_supports late variable expansion (ex: `https://%{environment_name}.k8s.acme.com`)_"
    },
    {
      "name": "K8S_SCRIPTS_DIR",
      "description": "directory where Kubernetes scripts (templates, hook scripts) are located",
@@ -83,15 +88,10 @@
          "advanced": true
        },
        {
          "name": "K8S_REVIEW_ENVIRONMENT_SCHEME",
          "description": "The review environment protocol scheme",
          "default": "https",
          "mandatory": true
        },
        {
          "name": "K8S_REVIEW_ENVIRONMENT_DOMAIN",
          "description": "The review environment domain (ex: `noprod-kubernetes.domain.com`).\n\nBy default review `environment.url` will be built as `${K8S_REVIEW_ENVIRONMENT_SCHEME}://${$CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${K8S_REVIEW_ENVIRONMENT_DOMAIN}`",
          "mandatory": true
          "name": "K8S_REVIEW_ENVIRONMENT_URL",
          "type": "url",
          "description": "The review environments url _(only define for static environment URLs declaration and if different from default)_",
          "advanced": true
        },
        {
          "name": "K8S_REVIEW_KUBE_CONFIG",
@@ -134,8 +134,8 @@
        {
          "name": "K8S_INTEG_ENVIRONMENT_URL",
          "type": "url",
          "description": "The integration environment url including scheme (ex: `https://my-application-integration.noprod-kubernetes.domain.com`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",
          "mandatory": true
          "description": "The integration environment url _(only define for static environment URLs declaration and if different from default)_",
          "advanced": true
        },
        {
          "name": "K8S_INTEG_KUBE_CONFIG",
@@ -178,8 +178,8 @@
        {
          "name": "K8S_STAGING_ENVIRONMENT_URL",
          "type": "url",
          "description": "The staging environment url including scheme (ex: `https://my-application-staging.noprod-kubernetes.domain.com`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",
          "mandatory": true
          "description": "The staging environment url _(only define for static environment URLs declaration and if different from default)_",
          "advanced": true
        },
        {
          "name": "K8S_STAGING_KUBE_CONFIG",
@@ -222,8 +222,8 @@
        {
          "name": "K8S_PROD_ENVIRONMENT_URL",
          "type": "url",
          "description": "The production environment url including scheme (ex: `https://my-application.kubernetes.domain.com`).\n\nDo not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that.",
          "mandatory": true
          "description": "The production environment url _(only define for static environment URLs declaration and if different from default)_",
          "advanced": true
        },
        {
          "name": "AUTODEPLOY_TO_PROD",
+39 −33
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ stages:
  }

  function awkenvsubst() {
    awk '!/# *nosubst/{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);val=ENVIRON[var];gsub(/["\\]/,"\\\\&", val);gsub("\n", "\\n", val);gsub("\r", "\\r", val);gsub("[$]{"var"}",val)}}1'
    awk '!/# *nosubst/{while(match($0,"[$%]{[^}]*}")) {g0=substr($0,RSTART,RLENGTH); val=ENVIRON[substr(g0,3,RLENGTH-3)]; gsub(/["\\]/,"\\\\&",val); gsub("\n","\\n",val);gsub("\r","\\r",val); gsub(g0,val)}}1'
  }

  function exec_hook() {
@@ -366,6 +366,7 @@ stages:
  function deploy() {
    export environment_type=$1
    export environment_name=$2
    environment_url=$3
    # also export environment_name in SCREAMING_SNAKE_CASE format (may be useful with Kubernetes env variables)
    environment_name_ssc=$(to_ssc "$2")
    export environment_name_ssc
@@ -376,8 +377,11 @@ stages:
    export appname=$environment_name
    export appname_ssc=$environment_name_ssc

    # extract hostname from $CI_ENVIRONMENT_URL
    hostname=$(echo "$CI_ENVIRONMENT_URL" | awk -F[/:] '{print $4}')
    # variables expansion in $environment_url
    environment_url=$(echo "$environment_url" | awkenvsubst)
    export environment_url
    # extract hostname from $environment_url
    hostname=$(echo "$environment_url" | awk -F[/:] '{print $4}')
    export hostname

    log_info "--- \\e[32mdeploy\\e[0m"
@@ -421,8 +425,15 @@ stages:
    fi

    # persist environment url
    echo "$CI_ENVIRONMENT_URL" > environment_url.txt
    echo -e "environment_type=$environment_type\\nenvironment_name=$environment_name\\nenvironment_url=$CI_ENVIRONMENT_URL" > kubernetes.env
    if [[ -f environment_url.txt ]]
    then
      environment_url=$(cat environment_url.txt)
      export environment_url
      log_info "--- dynamic environment url found: (\\e[33;1m$environment_url\\e[0m)"
    else
      echo "$environment_url" > environment_url.txt
    fi
    echo -e "environment_type=$environment_type\\nenvironment_name=$environment_name\\nenvironment_url=$environment_url" > kubernetes.env

    # maybe execute readiness check script
    readycheck="$K8S_SCRIPTS_DIR/k8s-readiness-check.sh"
@@ -437,6 +448,7 @@ stages:
  function rollback() {
    export environment_type=$1
    export environment_name=$2
    environment_url=$3
    # also export environment_name in SCREAMING_SNAKE_CASE format (may be useful with Kubernetes env variables)
    environment_name_ssc=$(to_ssc "$2")
    export environment_name_ssc
@@ -447,8 +459,11 @@ stages:
    export appname=$environment_name
    export appname_ssc=$environment_name_ssc

    # extract hostname from $CI_ENVIRONMENT_URL
    hostname=$(echo "$CI_ENVIRONMENT_URL" | awk -F[/:] '{print $4}')
    # variables expansion in $environment_url
    environment_url=$(echo "$environment_url" | awkenvsubst)
    export environment_url
    # extract hostname from $environment_url
    hostname=$(echo "$environment_url" | awk -F[/:] '{print $4}')
    export hostname

    log_info "--- \\e[32mrollback\\e[0m"
@@ -599,7 +614,7 @@ stages:
# @arg ENV_TYPE       : environment type
# @arg ENV_APP_NAME   : env-specific application name
# @arg ENV_APP_SUFFIX : env-specific application suffix
# @arg ENV_URL        : env-specific Kubernetes API url
# @arg ENV_API_URL        : env-specific Kubernetes API url
# @arg ENV_SPACE      : env-specific Kubernetes namespace
# @arg ENV_TOKEN      : env-specific Kubernetes API token
# @arg ENV_CA_CERT    : env-specific Kubernetes CA certificate
@@ -613,9 +628,9 @@ stages:
    - *k8s-scripts
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
    - assert_defined "${ENV_SPACE:-$K8S_SPACE}" 'Missing required env $ENV_SPACE or $K8S_SPACE'
    - login "$ENV_TYPE" "${ENV_URL:-$K8S_URL}" "${ENV_CA_CERT:-$K8S_CA_CERT}" "${ENV_TOKEN:-$K8S_TOKEN}" "${ENV_SPACE:-$K8S_SPACE}" "${ENV_KUBE_CONFIG:-${K8S_DEFAULT_KUBE_CONFIG}}"
    - login "$ENV_TYPE" "${ENV_API_URL:-$K8S_URL}" "${ENV_CA_CERT:-$K8S_CA_CERT}" "${ENV_TOKEN:-$K8S_TOKEN}" "${ENV_SPACE:-$K8S_SPACE}" "${ENV_KUBE_CONFIG:-${K8S_DEFAULT_KUBE_CONFIG}}"
  script:
    - deploy "$ENV_TYPE" ${ENV_APP_NAME:-${K8S_BASE_APP_NAME}${ENV_APP_SUFFIX}}
    - deploy "$ENV_TYPE" "${ENV_APP_NAME:-${K8S_BASE_APP_NAME}${ENV_APP_SUFFIX}}" "${ENV_URL:-${K8S_ENVIRONMENT_URL:-$ENV_URL_LEGACY}}"
  artifacts:
    name: "$ENV_TYPE env url for $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    when: always
@@ -624,6 +639,8 @@ stages:
      - environment_url.txt
    reports:
      dotenv: kubernetes.env
  environment:
    url: "$environment_url" # can be either static or dynamic

# Cleanup job prototype
# Can be extended for each deletable environment
@@ -631,7 +648,7 @@ stages:
# @arg ENV_TYPE       : environment type
# @arg ENV_APP_NAME   : env-specific application name
# @arg ENV_APP_SUFFIX : env-specific application suffix
# @arg ENV_URL        : env-specific Kubernetes API url
# @arg ENV_API_URL        : env-specific Kubernetes API url
# @arg ENV_SPACE      : env-specific Kubernetes namespace
# @arg ENV_TOKEN      : env-specific Kubernetes API token
# @arg ENV_CA_CERT    : env-specific Kubernetes CA certificate
@@ -647,7 +664,7 @@ stages:
    - *k8s-scripts
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
    - assert_defined "${ENV_SPACE:-$K8S_SPACE}" 'Missing required env $ENV_SPACE or $K8S_SPACE'
    - login "$ENV_TYPE" "${ENV_URL:-$K8S_URL}" "${ENV_CA_CERT:-$K8S_CA_CERT}" "${ENV_TOKEN:-$K8S_TOKEN}" "${ENV_SPACE:-$K8S_SPACE}" "${ENV_KUBE_CONFIG:-${K8S_DEFAULT_KUBE_CONFIG}}"
    - login "$ENV_TYPE" "${ENV_API_URL:-$K8S_URL}" "${ENV_CA_CERT:-$K8S_CA_CERT}" "${ENV_TOKEN:-$K8S_TOKEN}" "${ENV_SPACE:-$K8S_SPACE}" "${ENV_KUBE_CONFIG:-${K8S_DEFAULT_KUBE_CONFIG}}"
  script:
    - cleanup "$ENV_TYPE" ${ENV_APP_NAME:-${K8S_BASE_APP_NAME}${ENV_APP_SUFFIX}}
  environment:
@@ -657,9 +674,6 @@ k8s-score-review:
  extends: .k8s-score
  variables:
    ENV_TYPE: review
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: "${K8S_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${K8S_REVIEW_ENVIRONMENT_DOMAIN}"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
@@ -680,14 +694,15 @@ k8s-review:
  variables:
    ENV_TYPE: review
    ENV_APP_NAME: "$K8S_REVIEW_APP_NAME"
    ENV_URL: "$K8S_REVIEW_URL"
    ENV_API_URL: "$K8S_REVIEW_URL"
    ENV_SPACE: "$K8S_REVIEW_SPACE"
    ENV_TOKEN: "$K8S_REVIEW_TOKEN"
    ENV_CA_CERT: "$K8S_REVIEW_CA_CERT"
    ENV_KUBE_CONFIG: "$K8S_REVIEW_KUBE_CONFIG"
    ENV_URL: "${K8S_REVIEW_ENVIRONMENT_URL}"
    ENV_URL_LEGACY: "${K8S_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${K8S_REVIEW_ENVIRONMENT_DOMAIN}"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: "${K8S_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${K8S_REVIEW_ENVIRONMENT_DOMAIN}"
    on_stop: k8s-cleanup-review
  resource_group: review/$CI_COMMIT_REF_NAME
  rules:
@@ -703,7 +718,7 @@ k8s-cleanup-review:
  variables:
    ENV_TYPE: review
    ENV_APP_NAME: "$K8S_REVIEW_APP_NAME"
    ENV_URL: "$K8S_REVIEW_URL"
    ENV_API_URL: "$K8S_REVIEW_URL"
    ENV_SPACE: "$K8S_REVIEW_SPACE"
    ENV_TOKEN: "$K8S_REVIEW_TOKEN"
    ENV_CA_CERT: "$K8S_REVIEW_CA_CERT"
@@ -725,9 +740,6 @@ k8s-score-integration:
  extends: .k8s-score
  variables:
    ENV_TYPE: integration
  environment:
    name: integration
    url: "${K8S_INTEG_ENVIRONMENT_URL}"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
@@ -748,14 +760,14 @@ k8s-integration:
  variables:
    ENV_TYPE: integration
    ENV_APP_NAME: "$K8S_INTEG_APP_NAME"
    ENV_URL: "$K8S_INTEG_URL"
    ENV_API_URL: "$K8S_INTEG_URL"
    ENV_SPACE: "$K8S_INTEG_SPACE"
    ENV_TOKEN: "$K8S_INTEG_TOKEN"
    ENV_CA_CERT: "$K8S_INTEG_CA_CERT"
    ENV_KUBE_CONFIG: "$K8S_INTEG_KUBE_CONFIG"
    ENV_URL: "${K8S_INTEG_ENVIRONMENT_URL}"
  environment:
    name: integration
    url: "${K8S_INTEG_ENVIRONMENT_URL}"
  resource_group: integration
  rules:
    # only on integration branch(es), with $K8S_INTEG_SPACE set
@@ -772,9 +784,6 @@ k8s-score-staging:
  extends: .k8s-score
  variables:
    ENV_TYPE: staging
  environment:
    name: staging
    url: "${K8S_STAGING_ENVIRONMENT_URL}"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
@@ -795,14 +804,14 @@ k8s-staging:
  variables:
    ENV_TYPE: staging
    ENV_APP_NAME: "$K8S_STAGING_APP_NAME"
    ENV_URL: "$K8S_STAGING_URL"
    ENV_API_URL: "$K8S_STAGING_URL"
    ENV_SPACE: "$K8S_STAGING_SPACE"
    ENV_TOKEN: "$K8S_STAGING_TOKEN"
    ENV_CA_CERT: "$K8S_STAGING_CA_CERT"
    ENV_KUBE_CONFIG: "$K8S_STAGING_KUBE_CONFIG"
    ENV_URL: "${K8S_STAGING_ENVIRONMENT_URL}"
  environment:
    name: staging
    url: "${K8S_STAGING_ENVIRONMENT_URL}"
  resource_group: staging
  rules:
    # only on production branch(es), with $K8S_STAGING_SPACE set
@@ -812,9 +821,6 @@ k8s-score-production:
  extends: .k8s-score
  variables:
    ENV_TYPE: production
  environment:
    name: production
    url: "${K8S_PROD_ENVIRONMENT_URL}"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
@@ -838,14 +844,14 @@ k8s-production:
    ENV_TYPE: production
    ENV_APP_SUFFIX: "" # no suffix for prod
    ENV_APP_NAME: "$K8S_PROD_APP_NAME"
    ENV_URL: "$K8S_PROD_URL"
    ENV_API_URL: "$K8S_PROD_URL"
    ENV_SPACE: "$K8S_PROD_SPACE"
    ENV_TOKEN: "$K8S_PROD_TOKEN"
    ENV_CA_CERT: "$K8S_PROD_CA_CERT"
    ENV_KUBE_CONFIG: "$K8S_PROD_KUBE_CONFIG"
    ENV_URL: "${K8S_PROD_ENVIRONMENT_URL}"
  environment:
    name: production
    url: "${K8S_PROD_ENVIRONMENT_URL}"
  resource_group: production
  rules:
    # exclude non-production branches