Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_cloudbuild_trigger should support Invert Regex option in trigger_template #4195

Closed
MichaelDao opened this issue Aug 9, 2019 · 8 comments

Comments

@MichaelDao
Copy link

MichaelDao commented Aug 9, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

I am trying to setup my cloud build CI/CD in a way that one trigger will only run for the master branch and the second trigger will run on any branch except the master.

Usually I will be able to solve this with a regex with negative lookahead, e.g. ^(?!.*master).*$

The problem here is that google cloud build triggers do not support any lookahead in their regex.

Luckily google provides us with an Invert Regex option!

invertregex

Anyways there seems to be nothing for the invert regex option as seen here:
https://www.terraform.io/docs/providers/google/r/cloud_build_trigger.html#trigger_template

This would be a nice feature to have, as a temporary workaround, I am ignoring anything that starts with master
^(?:[^m]|m[^a]|ma[^s]|mas[^t]|mast[^e]|maste[^r]|master.)

I would like to help out as a contributor if possible, will need help though.

New or Affected Resource(s)

  • google_cloudbuild_trigger

Potential Terraform Configuration

provider "google" {
    project = "my-project"
}

resource "google_cloudbuild_trigger" "trigger" {
    trigger_template {
        branch_name = "master"
        repo_name = "my-repo"
        invert_regex = true
    }
}

References

@ghost ghost added the enhancement label Aug 9, 2019
@joeyorlando
Copy link

I could help out contributing this! 😃

@stephanlindauer
Copy link

i think, after this invert flag is currently not exposed through the google cloud api, there is not much we can do on the terraform provider side.
is there an ETA on when this flag will be exposed through the google api? @danawillow @paddycarver

@danawillow
Copy link
Contributor

You're welcome to file an issue against the GCP API if it's something you'd like to see! https://cloud.google.com/support/docs/issue-trackers

@stephanlindauer
Copy link

please star this ticket to indicate that you are also effected by this missing api feature: https://issuetracker.google.com/issues/148122483

@harryparkdotio
Copy link

I believe it's now exposed via the api


https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers#GitHubEventsConfig

https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers#PushFilter

@stephanlindauer
Copy link

@danawillow how long until we can expect that to be in the provider?

@megan07
Copy link
Contributor

megan07 commented Jul 22, 2020

Closed by GoogleCloudPlatform/magic-modules#3628

@megan07 megan07 closed this as completed Jul 22, 2020
@ghost
Copy link

ghost commented Aug 22, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants