Skip to content

Commit

Permalink
Small improvements to the Google Cloud Function guides
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Nov 6, 2024
1 parent 7ec531d commit fba9f6c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
15 changes: 10 additions & 5 deletions docs/src/main/asciidoc/funqy-gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ You will have a single JAR inside the `target/deployment` repository that contai
Then you will be able to use `gcloud` to deploy your function to Google Cloud.
The `gcloud` command will be different depending on which event triggers your function.

NOTE: We will use the Java 17 runtime but you can switch to the Java 21 runtime by using `--runtime=java21` instead of `--runtime=java17` on the deploy commands.
NOTE: We will use the Java 21 runtime, but you can switch to the Java 17 runtime by using `--runtime=java17` instead of `--runtime=java21` on the deploy commands.

[WARNING]
====
Expand All @@ -168,7 +168,7 @@ Use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-funky-pubsub \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyBackgroundFunction \
--runtime=java17 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish \
--runtime=java21 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish \
--source=target/deployment
----

Expand Down Expand Up @@ -205,7 +205,7 @@ Then, use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-funky-storage \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyBackgroundFunction \
--runtime=java17 --trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--runtime=java21 --trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--source=target/deployment
----

Expand Down Expand Up @@ -246,7 +246,7 @@ Then, use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyCloudEventsFunction \
--runtime=java17 --trigger-bucket=example-cloud-event --source=target/deployment
--runtime=java21 --trigger-bucket=example-cloud-event --source=target/deployment
----

[IMPORTANT]
Expand Down Expand Up @@ -371,7 +371,7 @@ This will call your cloud events function with an event on the `"MY_FILE.txt` fi

Quarkus provides built-in support for testing your Funqy Google Cloud functions via the `quarkus-test-google-cloud-functions` dependency.

To use it, you must add the following test dependency in your `pom.xml`.
To use it, you must add the following test dependencies in your `pom.xml`.

[source,xml]
----
Expand All @@ -380,6 +380,11 @@ To use it, you must add the following test dependency in your `pom.xml`.
<artifactId>quarkus-test-google-cloud-functions</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
----

This extension provides a `@WithFunction` annotation that can be used to annotate `@QuarkusTest` test cases to start a Cloud Function invoker before you test cases and stop it at the end.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/gcp-functions-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ The result of the previous command is a single JAR file inside the `target/deplo

Then you will be able to use `gcloud` to deploy your function to Google Cloud.

NOTE: We will use the Java 17 runtime but you can switch to the Java 21 runtime by using `--runtime=java21` instead of `--runtime=java17` on the deploy commands.
NOTE: We will use the Java 21 runtime, but you can switch to the Java 17 runtime by using `--runtime=java17` instead of `--runtime=java21` on the deploy commands.

[source,bash]
----
gcloud functions deploy quarkus-example-http \
--entry-point=io.quarkus.gcp.functions.http.QuarkusHttpFunction \
--runtime=java17 --trigger-http --allow-unauthenticated --source=target/deployment
--runtime=java21 --trigger-http --allow-unauthenticated --source=target/deployment
----

[IMPORTANT]
Expand Down
15 changes: 10 additions & 5 deletions docs/src/main/asciidoc/gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ The result of the previous command is a single JAR file inside the `target/deplo
Then you will be able to use `gcloud` to deploy your function to Google Cloud.
The `gcloud` command will be different depending on which event triggers your function.

NOTE: We will use the Java 17 runtime but you can switch to the Java 21 runtime by using `--runtime=java21` instead of `--runtime=java17` on the deploy commands.
NOTE: We will use the Java 21 runtime but you can switch to the Java 17 runtime by using `--runtime=java17` instead of `--runtime=java21` on the deploy commands.

[WARNING]
====
Expand All @@ -262,7 +262,7 @@ This is an example command to deploy your `HttpFunction` to Google Cloud:
----
gcloud functions deploy quarkus-example-http \
--entry-point=io.quarkus.gcp.functions.QuarkusHttpFunction \
--runtime=java17 --trigger-http --allow-unauthenticated --source=target/deployment
--runtime=java21 --trigger-http --allow-unauthenticated --source=target/deployment
----

[IMPORTANT]
Expand All @@ -289,7 +289,7 @@ it needs to use `--trigger-event google.storage.object.finalize` and the `--trig
gcloud functions deploy quarkus-example-storage \
--entry-point=io.quarkus.gcp.functions.QuarkusBackgroundFunction \
--trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--runtime=java17 --source=target/deployment
--runtime=java21 --source=target/deployment
----

[IMPORTANT]
Expand All @@ -315,7 +315,7 @@ it needs to use `--trigger-event google.pubsub.topic.publish` and the `--trigger
----
gcloud functions deploy quarkus-example-pubsub \
--entry-point=io.quarkus.gcp.functions.QuarkusBackgroundFunction \
--runtime=java17 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish --source=target/deployment
--runtime=java21 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish --source=target/deployment
----

[IMPORTANT]
Expand All @@ -341,7 +341,7 @@ it needs to use `--trigger-bucket` parameter with the name of a previously creat
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
--entry-point=io.quarkus.gcp.functions.QuarkusCloudEventsFunction \
--runtime=java17 --trigger-bucket=example-cloud-event --source=target/deployment
--runtime=java21 --trigger-bucket=example-cloud-event --source=target/deployment
----

[IMPORTANT]
Expand Down Expand Up @@ -485,6 +485,11 @@ To use it, you must add the following test dependency in your `pom.xml`.
<artifactId>quarkus-test-google-cloud-functions</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
----

This extension provides a `@WithFunction` annotation that can be used to annotate `@QuarkusTest` test cases to start a Cloud Function invoker before you test cases and stop it at the end.
Expand Down

0 comments on commit fba9f6c

Please sign in to comment.