Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions function-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.9.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.9.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ public class DeployFunction extends CloudSdkMojo {
*/
@Parameter(
alias = "deploy.allowunauthenticated",
property = "function.deploy.allowunauthenticated",
defaultValue = "false")
boolean allowUnauthenticated;
property = "function.deploy.allowunauthenticated")
Boolean allowUnauthenticated;

/**
* Name of a Google Cloud Function (as defined in source code) that will be executed. Defaults to
Expand Down Expand Up @@ -314,8 +313,12 @@ public List<String> getCommands() {
if (triggerEvent != null) {
commands.add("--trigger-event=" + triggerEvent);
}
if (allowUnauthenticated) {
commands.add("--allow-unauthenticated");
if (allowUnauthenticated != null) {
if (allowUnauthenticated) {
commands.add("--allow-unauthenticated");
} else {
commands.add("--no-allow-unauthenticated");
}
}
if (functionTarget != null) {
commands.add("--entry-point=" + functionTarget);
Expand Down Expand Up @@ -371,6 +374,8 @@ public List<String> getCommands() {
if (projectId != null) {
commands.add("--project=" + projectId);
}

commands.add("--quiet");
return Collections.unmodifiableList(commands);
}

Expand All @@ -382,7 +387,9 @@ public void execute() throws MojoExecutionException {
System.out.println("Executing Cloud SDK command: gcloud " + String.join(" ", params));
gcloud.runCommand(params);
} catch (CloudSdkNotFoundException | IOException | ProcessHandlerException ex) {
Logger.getLogger(DeployFunction.class.getName()).log(Level.SEVERE, null, ex);
Logger.getLogger(DeployFunction.class.getName())
.log(Level.SEVERE, "Function deployment failed", ex);
throw new MojoExecutionException("Function deployment failed", ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void testDeployFunctionCommandLine() {
"--env-vars-file=myfile",
"--set-build-env-vars=env1=a,env2=b",
"--build-env-vars-file=myfile2",
"--runtime=java11");
"--runtime=java11",
"--quiet");
assertThat(mojo.getCommands()).isEqualTo(expected);
}
}
Loading