@@ -200,11 +200,27 @@ public class DeployFunction extends CloudSdkMojo {
200
200
*/
201
201
@ Parameter (alias = "deploy.envvarsfile" , property = "function.deploy.envvarsfile" )
202
202
String envVarsFile ;
203
+ /**
204
+ * List of key-value pairs to set as build environment variables. All existing environment variables
205
+ * will be removed first.
206
+ */
207
+ @ Parameter (alias = "deploy.setbuildenvvars" , property = "function.deploy.setbuildenvvars" )
208
+ Map <String , String > buildEnvironmentVariables ;
209
+ /**
210
+ * Path to a local YAML file with definitions for all build environment variables. All existing
211
+ * environment variables will be removed before the new environment variables are added.
212
+ */
213
+ @ Parameter (alias = "deploy.buildenvvarsfile" , property = "function.deploy.buildenvvarsfile" )
214
+ String buildEnvVarsFile ;
203
215
204
216
boolean hasEnvVariables () {
205
217
return (this .environmentVariables != null && !this .environmentVariables .isEmpty ());
206
218
}
207
219
220
+ boolean hasBuildEnvVariables () {
221
+ return (this .buildEnvironmentVariables != null && !this .buildEnvironmentVariables .isEmpty ());
222
+ }
223
+
208
224
// Select a downloaded Cloud SDK or a user defined Cloud SDK version.
209
225
static Function <String , ManagedCloudSdk > newManagedSdkFactory () {
210
226
return version -> {
@@ -331,6 +347,13 @@ public List<String> getCommands() {
331
347
if (envVarsFile != null ) {
332
348
commands .add ("--env-vars-file=" + envVarsFile );
333
349
}
350
+ if (hasBuildEnvVariables ()) {
351
+ Joiner .MapJoiner mapJoiner = Joiner .on ("," ).withKeyValueSeparator ("=" );
352
+ commands .add ("--set-build-env-vars=" + mapJoiner .join (buildEnvironmentVariables ));
353
+ }
354
+ if (buildEnvVarsFile != null ) {
355
+ commands .add ("--build-env-vars-file=" + buildEnvVarsFile );
356
+ }
334
357
commands .add ("--runtime=" + runtime );
335
358
336
359
if (projectId != null ) {
0 commit comments