Skip to content

Add build-terraform-provider CI step to detect breaking changes#3894

Merged
nogates merged 10 commits intomasterfrom
andrei-mar-27-move-cli-to-go-client
Apr 13, 2026
Merged

Add build-terraform-provider CI step to detect breaking changes#3894
nogates merged 10 commits intomasterfrom
andrei-mar-27-move-cli-to-go-client

Conversation

@apatruddog
Copy link
Copy Markdown
Contributor

@apatruddog apatruddog commented Mar 27, 2026

What does this PR do?

Adds a build-terraform-provider job to the Go client CI that builds terraform-provider-datadog against the generated Go client code on every PR. This catches breaking changes (renamed types, removed fields, etc.) before they are merged, rather than discovering them after the fact.

How it works

  1. The build-terraform-provider step checks out terraform-provider-datadog, replaces its datadog-api-client-go dependency with the PR's commit, and runs go build ./....
  2. If the build fails, the CI reports exactly what broke and provides instructions to fix it.
  3. When a breaking change is intentional, a fix PR on terraform-provider-datadog must be created and linked. The link is passed in via the tf-provider-pr input (set by datadog-api-spec's CI — see below). The check then builds against that branch instead of master. Stale references to merged/closed PRs are automatically ignored.

Relationship with datadog-api-spec

This workflow is designed to be called from datadog-api-spec's CI pipeline, which handles the full flow:

  • Detects when a Fix Terraform Provider PR: link is added or changed in the api-spec PR description
  • Passes the URL directly as the tf-provider-pr input, so this workflow doesn't need to parse any PR description itself
  • If no input is provided (e.g. standalone go-client PRs), the check runs against master

Files changed

  • .github/workflows/reusable-go-test.yml — New build-terraform-provider job. Uses the tf-provider-pr input if provided, otherwise falls back to master.
  • .github/workflows/reusable-ci.yml — Passes the new tf-provider-pr input through to reusable-go-test.yml.
  • .github/workflows/test.yml — Passes secrets through to reusable-ci.yml.

Additional Notes

Validated end-to-end with a deliberate breaking change:

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

@apatruddog apatruddog requested review from a team as code owners March 27, 2026 17:16
@apatruddog apatruddog added the changelog/no-changelog Changes don't appear in changelog label Mar 27, 2026
@apatruddog apatruddog force-pushed the andrei-mar-27-move-cli-to-go-client branch from 9101ec0 to ed19f01 Compare April 1, 2026 07:35
@apatruddog apatruddog changed the title WIP: move CLI testing code to different repo [TEST] Step 1: Introduces build-terraform-provider CI step Apr 1, 2026
@apatruddog apatruddog changed the title [TEST] Step 1: Introduces build-terraform-provider CI step Add build-terraform-provider CI step to detect breaking changes Apr 1, 2026
@nogates nogates merged commit ac1d655 into master Apr 13, 2026
14 checks passed
@nogates nogates deleted the andrei-mar-27-move-cli-to-go-client branch April 13, 2026 15:14
github-actions bot pushed a commit that referenced this pull request Apr 13, 2026
* moves CLI testing to Go library repo

* Use PR description for terraform provider fix link instead of file

* Remove file-based terraform-provider-pr cleanup from release.yml

* Pass tf-provider-pr as input instead of re-parsing PR description

* Remove PR description parsing from go-client; use tf-provider-pr input or master

* Revert GO_CLIENT_BRANCH fallback, no longer needed without edited event

* Improve build failure message with force rebuild option

* Remove redundant explicit PR event types from test.yml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix rebuild instruction — a new commit is always required to re-trigger CI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Restore inputs.target-branch fallback for GO_CLIENT_BRANCH

When called from api-spec, github.event.pull_request.head.sha is the
api-spec SHA, not a go-client SHA — the lookup fails. inputs.target-branch
carries the correct go-client branch name in that path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: David Tapiador <david.tapiadordeldujo@datadoghq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> ac1d655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog Changes don't appear in changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants