Skip to content

GCP-919: Add terraform apply provision step for gcp-hcp e2e - #83390

Closed
jimdaga wants to merge 2 commits into
openshift:mainfrom
jimdaga:feature/GCP-919-tf-apply-step
Closed

jimdaga wants to merge 2 commits into
openshift:mainfrom
jimdaga:feature/GCP-919-tf-apply-step

Conversation

@jimdaga

@jimdaga jimdaga commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements Prow step-registry entries for full GCP HCP e2e infrastructure provisioning using Terraform Cloud ephemeral workspaces.

Components Added

  • gcp-hcp-tf-provision: Runs terraform apply via TFC (provision infrastructure)
  • gcp-hcp-tf-deprovision: Runs terraform destroy with robust fallback logic
  • gcp-hcp-verify-argocd-sync: Placeholder for future ArgoCD sync validation
  • gcp-hcp-e2e workflow: Updated to use new steps

Key Features

  • Terraform 1.15.8 (from .tool-versions)
  • TFC token via vault mount (/etc/terraform-cloud/token)
  • Run-id generation via sha256sum (b + 7 hex chars)
  • WIF credential fallback in deprovision
  • TFC API retry logic with exponential backoff
  • 10m grace period for graceful shutdown
  • Auto-destroy 24h safety net for crashed pipelines

Testing Plan

Manual testing with pj-rehearse after PR #1050 merges in gcp-hcp-infra.

Jira

https://redhat.atlassian.net/browse/GCP-919

Dependencies

  • Requires PR openshift-online/gcp-hcp-infra#1050 to be merged first
  • Requires vault secret tfcloud-ci-secret configured (CI team)
  • Requires cluster profile platform-gcp with wif-config.json

Summary by CodeRabbit

This PR updates the OpenShift CI workflow for GCP HCP end-to-end tests.

  • Adds Terraform Cloud steps to provision and deprovision GCP HCP infrastructure.
  • Adds WIF authentication, credential handling, retry logic, run ID generation, and a 24-hour auto-destroy policy.
  • Adds a placeholder step that validates provisioning outputs and defers ArgoCD synchronization checks.
  • Updates the workflow to provision infrastructure before tests and clean it up afterward.
  • Runs terraform-validate from the bin container.
  • Adds ownership and step metadata for the new registry entries.

jimdaga and others added 2 commits August 6, 2026 13:31
…in image

The terraform-validate test uses `from: src` which means terraform-init
runs from scratch every time. Switch to `from: bin` to reuse the image
built by binary_build_commands (which already runs make terraform-init),
eliminating redundant provider and module downloads.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add Prow step-registry entries for full GCP HCP e2e infrastructure provisioning:

- gcp-hcp-tf-provision: Runs terraform apply via TFC ephemeral workspaces
- gcp-hcp-tf-deprovision: Runs terraform destroy with robust fallback logic
- gcp-hcp-verify-argocd-sync: Placeholder for future ArgoCD sync validation
- Updated gcp-hcp-e2e workflow to use new steps

Key features:
- Terraform 1.15.8 (from .tool-versions)
- TFC token via vault mount (/etc/terraform-cloud/token)
- Run-id generation via sha256sum (b + 7 hex chars)
- WIF credential fallback in deprovision
- TFC API retry logic with exponential backoff
- 10m grace period for graceful shutdown
- Auto-destroy 24h safety net for crashed pipelines

Jira: GCP-919
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 13, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

@jimdaga: This pull request references GCP-919 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Implements Prow step-registry entries for full GCP HCP e2e infrastructure provisioning using Terraform Cloud ephemeral workspaces.

Components Added

  • gcp-hcp-tf-provision: Runs terraform apply via TFC (provision infrastructure)
  • gcp-hcp-tf-deprovision: Runs terraform destroy with robust fallback logic
  • gcp-hcp-verify-argocd-sync: Placeholder for future ArgoCD sync validation
  • gcp-hcp-e2e workflow: Updated to use new steps

Key Features

  • Terraform 1.15.8 (from .tool-versions)
  • TFC token via vault mount (/etc/terraform-cloud/token)
  • Run-id generation via sha256sum (b + 7 hex chars)
  • WIF credential fallback in deprovision
  • TFC API retry logic with exponential backoff
  • 10m grace period for graceful shutdown
  • Auto-destroy 24h safety net for crashed pipelines

Testing Plan

Manual testing with pj-rehearse after PR #1050 merges in gcp-hcp-infra.

Jira

https://redhat.atlassian.net/browse/GCP-919

Dependencies

  • Requires PR openshift-online/gcp-hcp-infra#1050 to be merged first
  • Requires vault secret tfcloud-ci-secret configured (CI team)
  • Requires cluster profile platform-gcp with wif-config.json

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 13, 2026
@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jimdaga

jimdaga commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

/test all

@jimdaga

jimdaga commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jimdaga

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. labels Aug 13, 2026
@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The OWNERS file contains untrusted users, which makes it INVALID. The following users are mentioned in OWNERS file(s) but are untrusted for the following reasons. One way to make the user trusted is to add them as members of the openshift org. You can then trigger verification by writing /verify-owners in a comment.

  • jdagosti
    • User is not a member of the org. User is not a collaborator. Satisfy at least one of these conditions to make the user trusted.
    • ci-operator/step-registry/gcp-hcp/tf-deprovision/OWNERS
    • ci-operator/step-registry/gcp-hcp/tf-provision/OWNERS
    • ci-operator/step-registry/gcp-hcp/verify-argocd-sync/OWNERS

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b9982fad-c2e2-4545-888d-d640fa03b066

📥 Commits

Reviewing files that changed from the base of the PR and between 8631408 and fa3b304.

📒 Files selected for processing (14)
  • ci-operator/config/openshift-online/gcp-hcp-infra/openshift-online-gcp-hcp-infra-main.yaml
  • ci-operator/step-registry/gcp-hcp/e2e/gcp-hcp-e2e-workflow.yaml
  • ci-operator/step-registry/gcp-hcp/tf-deprovision/OWNERS
  • ci-operator/step-registry/gcp-hcp/tf-deprovision/gcp-hcp-tf-deprovision-commands.sh
  • ci-operator/step-registry/gcp-hcp/tf-deprovision/gcp-hcp-tf-deprovision-ref.metadata.json
  • ci-operator/step-registry/gcp-hcp/tf-deprovision/gcp-hcp-tf-deprovision-ref.yaml
  • ci-operator/step-registry/gcp-hcp/tf-provision/OWNERS
  • ci-operator/step-registry/gcp-hcp/tf-provision/gcp-hcp-tf-provision-commands.sh
  • ci-operator/step-registry/gcp-hcp/tf-provision/gcp-hcp-tf-provision-ref.metadata.json
  • ci-operator/step-registry/gcp-hcp/tf-provision/gcp-hcp-tf-provision-ref.yaml
  • ci-operator/step-registry/gcp-hcp/verify-argocd-sync/OWNERS
  • ci-operator/step-registry/gcp-hcp/verify-argocd-sync/gcp-hcp-verify-argocd-sync-commands.sh
  • ci-operator/step-registry/gcp-hcp/verify-argocd-sync/gcp-hcp-verify-argocd-sync-ref.metadata.json
  • ci-operator/step-registry/gcp-hcp/verify-argocd-sync/gcp-hcp-verify-argocd-sync-ref.yaml

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

The GCP HCP end-to-end workflow now provisions infrastructure before testing, validates provisioning outputs, and deprovisions infrastructure afterward. New Terraform steps handle GCP authentication, Terraform Cloud configuration, apply, output storage, destroy, and cleanup fallback behavior.

Changes

GCP HCP infrastructure lifecycle

Layer / File(s) Summary
Provision infrastructure
ci-operator/step-registry/gcp-hcp/tf-provision/*
Adds Terraform provisioning, GCP Workload Identity Federation authentication, Terraform Cloud setup, auto-destroy configuration, apply execution, and shared output files.
Run validation workflow
ci-operator/step-registry/gcp-hcp/e2e/gcp-hcp-e2e-workflow.yaml, ci-operator/step-registry/gcp-hcp/verify-argocd-sync/*, ci-operator/config/openshift-online/gcp-hcp-infra/openshift-online-gcp-hcp-infra-main.yaml
Runs provisioning in the pre phase, validates provisioning outputs in the test phase, changes Terraform validation to the bin container, and reserves the ArgoCD synchronization check as a placeholder.
Deprovision infrastructure
ci-operator/step-registry/gcp-hcp/tf-deprovision/*
Adds Terraform destruction with credential and run-ID recovery, Terraform Cloud configuration, best-effort cleanup behavior, and step registry wiring for the post phase.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant Provision
  participant Verify
  participant Deprovision
  Workflow->>Provision: Provision GCP HCP infrastructure
  Provision-->>Workflow: Write Terraform outputs to SHARED_DIR
  Workflow->>Verify: Validate provisioning outputs
  Verify-->>Workflow: Report validation status
  Workflow->>Deprovision: Destroy infrastructure in post phase
  Deprovision-->>Workflow: Report cleanup status
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@jimdaga

jimdaga commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Closing - will recreate with correct upstream repo

@jimdaga jimdaga closed this Aug 13, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@jimdaga: the pj-rehearse plugin accommodates running rehearsal tests for the changes in this PR. Expand 'Interacting with pj-rehearse' for usage details. The following rehearsable tests have been affected by this change:

Test name Repo Type Reason
pull-ci-openshift-online-gcp-hcp-infra-main-e2e-platform openshift-online/gcp-hcp-infra presubmit Registry content changed

Prior to this PR being merged, you will need to either run and acknowledge or opt to skip these rehearsals.

Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants