Cloudkeel-DD CI/CD templates
Copy-paste starting points for wiring Cloudkeel-DD into your pipeline. These are not a published GitHub Action or GitLab CI/CD Component - copy the file into your repo and adjust paths/branches to match your setup.
What they do
Section titled “What they do”-
Policy check (on every PR touching
terraform/): runsterraform plan, extractsresource_changesviaterraform show -json, and POSTs them toPOST /api/ci/policy-check. If any enabled policy is violated, the job exits non-zero and fails the PR check.When the template’s PR/MR context fields are present (
github_repo+github_commit_sha+github_pr_numberon GitHub, orgitlab_project_idgitlab_commit_sha+gitlab_mr_iidon GitLab - both templates set these automatically from CI-provided variables), Cloudkeel-DD also posts the result back to the PR/MR itself: a commit status (pass/fail, shows up in the PR’s checks list) plus a comment/note listing any violations, so a reviewer sees it inline without opening the CI job log. This uses each platform’s Commit Status API specifically (not GitHub’s Checks API, which is GitHub-App-only, and not GitLab’s External Status Checks, which is a Premium/Ultimate-only feature) - both work with the same plainGITHUB_PAT/GITLAB_PATtoken Cloudkeel-DD already uses for remediation. Posting failures (bad token, repo not found, rate limit) never fail the underlying policy check itself -passedin the response is always the real verdict;github_posting/gitlab_postingreport separately whether the PR-side posting succeeded.
-
Post-deploy scan trigger (on merge to
main): callsPOST /api/ci/trigger-scanso Cloudkeel-DD picks up the change immediately instead of waiting for the next scheduled scan.
- In Cloudkeel-DD, go to Settings -> CI/CD API keys and create a key. Copy it immediately - it’s only shown once.
- Add two secrets/variables to your CI platform:
DRIFT_DETECTIVE_API_URL- your Cloudkeel-DD instance’s base URL.DRIFT_DETECTIVE_API_KEY- the key from step 1.- GitLab: mark both Masked but NOT Protected. The policy check
runs on merge-request pipelines (the feature branch); a Protected
variable is only exposed on protected branches, so it would be invisible
and the job fails with
DRIFT_DETECTIVE_API_URL: parameter not set. - GitHub: repository secrets are available to
pull_requestworkflows from branches in the same repo; nothing extra to set.
- Copy
github-actions/drift-policy-check.ymlinto.github/workflows/, orgitlab-ci/drift-policy-check.ymlinto (orinclude:d from).gitlab-ci.yml. - Adjust the
terraform/**path filters and branch names if your repo layout differs from the default. The GitLab template runs on merge-request pipelines (via aworkflow:block + amerge_request_eventrule) - keep those, or a barechanges:rule produces an “empty/invalid pipeline” error on MRs.
What’s not included
Section titled “What’s not included”- No auto-remediation from CI - opening a remediation PR/MR stays a manual, human-approved action inside Cloudkeel-DD.
- One API key can call any
/api/ci/*endpoint for its tenant - there’s no per-integration or per-endpoint scoping yet. - PR/MR posting requires a real
GITHUB_PAT/GITLAB_PATconfigured on the Cloudkeel-DD backend (same token used for remediation) - without one, the policy check itself still works and returns the real result, butgithub_posting/gitlab_postingwill reportsuccess: falsewith a clear “no token configured” error instead of posting anything.