Aller au contenu

Contract zones#

Prerequisites#

Inputs#

export GIT_PATH="${HOME}/git/"
export ZONE_NAME="obs-..."
export ENVS_NG="${GIT_PATH}/caascad/terraform/envs-ng"

1 - Requirements#

Admin Zone#

The only requirement to deploy a contract zone is that the admin zone of the same line is fully deployed.

2 - Declare zone in zones module (envs-ng)#

Clone envs-ng:

Repository: caascad/terraform/envs-ng

# git clone git@git.corp.caascad.com:caascad/terraform/envs-ng.git "${ENVS_NG}"
cd "${ENVS_NG}"
git pull
git switch -c "${ZONE_NAME}"
nix-shell

Example declaration in values.yaml:

  "obs-test-stg": {
      type: "contract"
      provider: type: "fe"
      metadata: line: "staging"
      parent_zone_name: "admin-stg"
      client_name:      "test_client"
  }

Generate static files and commit your changes

# Run script to generate static files from zones
generate-static-zones-files
# Add all modifications to the commit
git add zones/
git add gen/
git commit -m "Add ${ZONE_NAME} zone"
# Create target branch
git push -u origin "${ZONE_NAME}"

Create and submit your MR

- Comment your MR with message : `check zones` to trigger `check-zones` pipeline and validate the impacts of your changes on environments.

!!! info
    Please wait for the CI job completion before asking a validation.

3 - Build the contract zone#

Start trackbone:

cd ${ENVS_NG}/contexts/ngot
trackbone apply -z ${ZONE_NAME} --add-services -t bootstrap=true --non-interactive --detailed-exitcode -n 8

The deployment should run smoothly. If it fails on a step, you can restart the deployment from it:

trackbone apply -c <failed_conf> -z ${ZONE_NAME} --add-services -t bootstrap=true --cascade --non-interactive --detailed-exitcode -n 8