Search code examples
shgcloud

Can I use multiple --subtitutions flags in gcloud builds sbmit command?


This is what I'm doing right now:

gcloud builds submit ./dist                                     \
--config=./cloudbuild.yaml                                      \
--substitutions=_SUB_1=$VALUE_1,_SUB_2=$VALUE_2,_SUB_3=$VALUE_3 \
--project=$PROJECT_ID

This is what I'd like to do:

--substitutions=_SUB_1=$VALUE_1 \
--substitutions=_SUB_2=$VALUE_2 \
--substitutions=_SUB_3=$VALUE_3 \

Is this allowed?


Solution

  • Have you tried repeating the flag to prove to yourself whether that works?

    I think it doesn't and you must use your first syntax.

    When parsing command-line arguments, there's a distinction between a flag --xxx that has a repeating value and a repeating flag ---xxx=A --xxx=B that takes a singular value so, generally, the two aren't interchangeable (though it's logical to want these to be equivalent).

    Do you want this because you're trying to script the command and encountering problems?