Skip to content

Allow trigger branching strategy customisation#98

Merged
jbadavis merged 1 commit into
mainfrom
feat/clouldbuild-braching-strategy
Feb 26, 2026
Merged

Allow trigger branching strategy customisation#98
jbadavis merged 1 commit into
mainfrom
feat/clouldbuild-braching-strategy

Conversation

@jbadavis

@jbadavis jbadavis commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

The Cloud Build trigger is updated to allow parent modules to specify a
custom branching strategy based on a project's needs.

Here the Cloud Run v2 Job is updated to take advantage of this.
Additional modules can be updated in the future to allow for a
customised branching strategy to be passed.

Validation defaults are removed as they're unused in the module.

@jbadavis jbadavis force-pushed the feat/clouldbuild-braching-strategy branch 5 times, most recently from 3102193 to 2ae93f1 Compare February 25, 2026 17:03
memotoro
memotoro previously approved these changes Feb 25, 2026
variable "branching_strategy" {
description = "Branching strategy for different environments"
type = map(any)
default = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By removing this default values, won't this be affecting triggers created with this module ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is now specified in locals:

https://github.com/NandosUK/infrastructure-terraform-modules/pull/98/changes#diff-129fd87e2e7e1569396ba98d00bbc72bcdacb88809af686031ae44176c2ef365R27

If no variable is passed it defaults to null and the second arg of the coalesce function is used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all good. It looks like the default values before where slightly different to the ones in the variables. All good now

@memotoro memotoro dismissed their stale review February 25, 2026 17:18

I didn't mean to approve yet. :(

@jbadavis jbadavis requested a review from Copilot February 25, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Cloud Build trigger module to support caller-provided trigger branching strategies (with defaults applied internally), and wires that capability through the Cloud Run v2 Job module so parent modules can customize trigger branch matching per project needs.

Changes:

  • Add a trigger_branching_strategy input to cloud-run-v2-job and pass it through to the trigger module.
  • Change cloud-cloudbuild-trigger to accept a nullable branching_strategy input and apply module defaults via locals.
  • Remove unused validate branching defaults (previously present in the variable default).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
gcp/cloud-run-v2-job/variables.tf Adds a new variable to allow passing a trigger branching strategy from parent modules.
gcp/cloud-run-v2-job/main.tf Passes the new branching strategy variable into the Cloud Build trigger module.
gcp/cloud-cloudbuild-trigger/variables.tf Makes branching strategy default nullable to enable caller customization.
gcp/cloud-cloudbuild-trigger/main.tf Switches trigger branch selection to use a locally-resolved default strategy when none is provided.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gcp/cloud-cloudbuild-trigger/main.tf
Comment thread gcp/cloud-cloudbuild-trigger/variables.tf
Comment thread gcp/cloud-cloudbuild-trigger/variables.tf
@jbadavis jbadavis force-pushed the feat/clouldbuild-braching-strategy branch 3 times, most recently from 6af0629 to d34e07a Compare February 26, 2026 09:38
The Cloud Build trigger is updated to allow parent modules to specify a
custom branching strategy based on a project's needs.

Here the Cloud Run v2 Job is updated to take advantage of this.
Additional modules can be updated in the future to allow for a
customised branching strategy to be passed.

Validation defaults are removed as they're unused in the module.
@jbadavis jbadavis force-pushed the feat/clouldbuild-braching-strategy branch from d34e07a to 18cc76c Compare February 26, 2026 09:39

@memotoro memotoro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable "branching_strategy" {
description = "Branching strategy for different environments"
type = map(any)
default = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all good. It looks like the default values before where slightly different to the ones in the variables. All good now

@jbadavis jbadavis merged commit 6b897b6 into main Feb 26, 2026
2 checks passed
@jbadavis jbadavis deleted the feat/clouldbuild-braching-strategy branch February 26, 2026 09:47
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.70.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants