GitLab CI¶
Example job. Adjust image, paths, and protected-branch rules.
stages:
- validate
- apply
variables:
EVE_IAC_URL: https://eve.example:8787
.eve-iac:
image: python:3.12
before_script:
- pip install eve-iac --index-url https://gitlab.com/api/v4/projects/eve-ng-dev%2Feve-iac/packages/pypi/simple
variables:
EVE_IAC_CA_FILE: "$CI_PROJECT_DIR/ci/eve-iac-ca.pem"
validate:
extends: .eve-iac
stage: validate
script:
- eve-iac session
- eve-iac validate ./IaC/spine-leaf
- eve-iac plan ./IaC/spine-leaf --json
apply:
extends: .eve-iac
stage: apply
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- eve-iac reconcile ./IaC/spine-leaf --direction to_eve
# First deploy of a new managed lab:
# - eve-iac deploy ./IaC/spine-leaf
Set EVE_IAC_TOKEN (or username/password plus eve-iac login) as a masked CI/CD variable. Do not echo --json login output.
eve-iac destroy ./IaC/spine-leaf --yes and eve-iac reconcile ./IaC/spine-leaf --prune --yes belong in manual jobs only.