Skip to content

Commit 40d7294

Browse files
authored
GAE standard: allow passing entrypoint and shorten service names (#47)
- For some reason, app.yaml can't be used to override `entrypoint`. I think this is because of the way terraform calls the GAE admin API. Instead, allow passing it so individual languages can override if needed. - The service name was too long. Service name becomes the DNS name and IDNA specifies they should have no "label" (part between dots) longer than 64 characters. This was causing issues with Flask.
1 parent b34538f commit 40d7294

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

e2e_testing.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ type GaeCmd struct {
6363
}
6464

6565
type GaeStandardCmd struct {
66-
Runtime string `arg:"required" help:"The language runtime for the instrumented test server, used in naming the service"`
67-
AppSource string `arg:"required" help:"The full path of the zip file that contains the source code to run in GAE"`
66+
Runtime string `arg:"required" help:"The language runtime for the instrumented test server, used in naming the service"`
67+
AppSource string `arg:"required" help:"The full path of the zip file that contains the source code to run in GAE"`
68+
Entrypoint string `help:"Optional entrypoint to control how GAE starts the application. See https://cloud.google.com/appengine/docs/standard/reference/app-yaml#entrypoint"`
6869
}
6970

7071
type CloudRunCmd struct {

setupgaestandard.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ func SetupGaeStandard(
3535
args.TestRunID,
3636
gaeStandardTfDir,
3737
map[string]string{
38-
"runtime": args.GaeStandard.Runtime,
39-
"appsource": args.GaeStandard.AppSource,
38+
"runtime": args.GaeStandard.Runtime,
39+
"appsource": args.GaeStandard.AppSource,
40+
"entrypoint": args.GaeStandard.Entrypoint,
4041
},
4142
logger,
4243
)

tf/gae-standard/gae-standard.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource "google_app_engine_standard_app_version" "test_service" {
2121

2222
version_id = "v1"
2323
project = var.project_id
24-
service = "test-standard-service-${var.runtime}-${terraform.workspace}"
24+
service = "standard-${var.runtime}-${terraform.workspace}"
2525
runtime = var.runtime
2626

2727
deployment {
@@ -32,9 +32,9 @@ resource "google_app_engine_standard_app_version" "test_service" {
3232
}
3333
}
3434

35-
// Required, but leave empty to fall back to the runtime default
35+
// Required, but if variable is unset (empty string), fall back to the runtime default
3636
entrypoint {
37-
shell = ""
37+
shell = var.entrypoint
3838
}
3939

4040
env_variables = {
@@ -84,6 +84,11 @@ variable "runtime" {
8484
type = string
8585
}
8686

87+
variable "entrypoint" {
88+
type = string
89+
default = ""
90+
}
91+
8792
output "pubsub_info" {
8893
value = module.pubsub.info
8994
description = "Info about the request/response pubsub topics and subscription to use in the test"

tf/gae/gae.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
resource "google_app_engine_flexible_app_version" "test_service" {
2121
version_id = "v1"
2222
project = var.project_id
23-
service = "test-service-${var.runtime}-${terraform.workspace}"
23+
service = "flex-${var.runtime}-${terraform.workspace}"
2424
runtime = "custom"
2525

2626
deployment {

0 commit comments

Comments
 (0)