GCP CloudBuild -> Failed to trigger build: unrecognized arguments

I want to run a trigger by passing some substitution values. Here is my command:

 

gcloud beta builds triggers run my-service --branch=test-deploy-of-history --project=dev-project --substitutions=_SERVICE_NAME=flow

 

 But it is giving me this error:
ERROR: (gcloud.beta.builds.triggers.run) unrecognized arguments: --substitutions=_SERVICE_NAME=flow

can we not pass substitution values to trigger a build ? 
How to trigger the build if someone wants to pass extra arguments ?

Solved Solved
0 4 999
1 ACCEPTED SOLUTION

According to the Google Cloud CLI - Release Notes version 438.0.0

-Added flag to specify substitutions in gcloud builds trigger runs 

 See reference here. You can do the gcloud components update which updates all your installed components to the latest versions.

View solution in original post

4 REPLIES 4

Hi @omar115,

Welcome to the Google Cloud Community!

Take a look at Substituting Variable Values. It explains how to use default substitutions or define your own substitutions. 

You should try putting quotation marks on your value like so:

gcloud beta builds triggers run my-service --branch=test-deploy-of-history --project=dev-project --substitutions=_SERVICE_NAME="flow"

 There are also rules to follow when Using User-Defined Substitutions. Your variables should also be specified in these formats:

  • $_SERVICE_NAME
  • ${_SERVICE_NAME}

If the above options don't work, you can contact Google Cloud Support to further look into your case. Let me know if it helped, thanks!

I tried your command, I think the --substitutions is not supported though in the documentation they mentioned it:
https://cloud.google.com/sdk/gcloud/reference/beta/builds/triggers/run

After trying this command:

gcloud beta builds triggers run my-service --branch=test-deploy-of-history --project=dev-project --substitutions=_SERVICE_NAME="flow"

 I got this error:

ERROR: (gcloud.beta.builds.triggers.run) unrecognized arguments: --substitutions=_SERVICE_NAME=flow

I think whenever you are trying --substitutions it is saying that unrecognized arguments. I think it only supported in gcloud builds submit command not this command.

Can you check again ?

According to the Google Cloud CLI - Release Notes version 438.0.0

-Added flag to specify substitutions in gcloud builds trigger runs 

 See reference here. You can do the gcloud components update which updates all your installed components to the latest versions.

Thank you very much. gcloud components update work for me.