── ADVANCED ──
CI/CD Integration
Automate infrastructure generation in your CI/CD pipelines with Exo's non-interactive mode.
## Non-Interactive Mode
For CI/CD environments, use exo init with flags to skip the interactive wizard:
bash
exo init \ --name my-service \ --language go \ --framework gin \ --port 8080 \ --skip-prompt## GitHub Actions Example
Generate and validate infrastructure files as part of your CI pipeline:
.github/workflows/infra.yml
1name: Infrastructure Generation23on:4 push:5 branches: [main]6 pull_request:7 paths:8 - '.exo.yaml'9 - 'templates/**'1011jobs:12 generate:13 runs-on: ubuntu-latest14 steps:15 - uses: actions/checkout@v41617 - name: Install Exo18 run: |19 curl -sSL https://raw.githubusercontent.com/Harsh-BH/Exo/main/install.sh | bash20 echo "$HOME/.local/bin" >> $GITHUB_PATH2122 - name: Generate Infrastructure23 run: |24 exo gen docker25 exo gen k8s26 exo gen helm27 exo gen ci2829 - name: Validate Generated Files30 run: exo validate3132 - name: Lint Configuration33 run: exo lint3435 - name: Upload Artifacts36 uses: actions/upload-artifact@v437 with:38 name: infrastructure39 path: |40 Dockerfile41 k8s/42 charts/43 .github/workflows/ci.yml## GitLab CI Example
.gitlab-ci.yml
1stages:2 - generate3 - validate45generate-infra:6 stage: generate7 image: golang:1.25-alpine8 before_script:9 - go install github.com/Harsh-BH/Exo@latest10 script:11 - exo gen docker12 - exo gen k8s13 - exo gen terraform --cloud aws14 artifacts:15 paths:16 - Dockerfile17 - k8s/18 - infra/1920validate-infra:21 stage: validate22 image: golang:1.25-alpine23 before_script:24 - go install github.com/Harsh-BH/Exo@latest25 script:26 - exo validate27 - exo lint28 needs: [generate-infra]## Drift Detection
Detect when generated files have drifted from the templates. Useful as a PR check:
.github/workflows/drift.yml
1name: Drift Detection23on:4 pull_request:56jobs:7 check-drift:8 runs-on: ubuntu-latest9 steps:10 - uses: actions/checkout@v41112 - name: Install Exo13 run: curl -sSL https://raw.githubusercontent.com/Harsh-BH/Exo/main/install.sh | bash1415 - name: Regenerate and Diff16 run: |17 exo gen docker18 exo gen k8s19 git diff --exit-code || (echo "⚠ Infrastructure drift detected!" && exit 1)## Best Practices
▸ Pin the Exo version
Use a specific release tag in CI to ensure reproducible builds.
▸ Commit generated files
Keep Dockerfiles, K8s manifests, and CI configs in version control for auditability.
▸ Run validate + lint in CI
Catch misconfigurations before they reach production.
▸ Use .exo.yaml as single source of truth
All generation derives from the config — update it and regenerate.