@@ -200,11 +200,27 @@ public class DeployFunction extends CloudSdkMojo {
200200 */
201201 @ Parameter (alias = "deploy.envvarsfile" , property = "function.deploy.envvarsfile" )
202202 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 ;
203215
204216 boolean hasEnvVariables () {
205217 return (this .environmentVariables != null && !this .environmentVariables .isEmpty ());
206218 }
207219
220+ boolean hasBuildEnvVariables () {
221+ return (this .buildEnvironmentVariables != null && !this .buildEnvironmentVariables .isEmpty ());
222+ }
223+
208224 // Select a downloaded Cloud SDK or a user defined Cloud SDK version.
209225 static Function <String , ManagedCloudSdk > newManagedSdkFactory () {
210226 return version -> {
@@ -331,6 +347,13 @@ public List<String> getCommands() {
331347 if (envVarsFile != null ) {
332348 commands .add ("--env-vars-file=" + envVarsFile );
333349 }
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+ }
334357 commands .add ("--runtime=" + runtime );
335358
336359 if (projectId != null ) {
0 commit comments