From bede56598c7da6484466a71b05f2b560c59327d1 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Mon, 10 Mar 2025 20:03:12 -0400 Subject: [PATCH] Fix console build for GKE (#2713) We use the $environment property to set the console config. If it is not given, 'alpha' is used, which has the same effect as 'production'. TESTED=ran :jetty:copyConsole with -Penvironment=(sandbox|production|alpha) and checked the resulting js file. --- build.gradle | 10 +++------- console-webapp/build.gradle | 4 +--- console-webapp/gradle.properties | 1 + release/build_nomulus_for_env.sh | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) create mode 100644 console-webapp/gradle.properties diff --git a/build.gradle b/build.gradle index ef9ae4d94..ccc901697 100644 --- a/build.gradle +++ b/build.gradle @@ -95,26 +95,22 @@ task stage { description = 'Generates application directories for all services.' } -// App-engine environment configuration. We set up all of the variables in -// the root project. - -def environments = ['production', 'sandbox', 'alpha', 'crash', 'qa'] - def gcpProject = null apply from: "${rootDir.path}/projects.gradle" if (environment == '') { - // Keep the project null, this will prevent deployment. Set the + // Keep the project null, this will prevent deployment. Set the // environment to "alpha" because other code needs this property to // explode the war file. environment = 'alpha' -} else if (environment != 'production' && environment != 'sandbox') { +} else { gcpProject = projects[environment] if (gcpProject == null) { throw new GradleException("-Penvironment must be one of " + "${projects.keySet()}.") } + project(':console-webapp').setProperty('configuration', environment) } rootProject.ext.environment = environment diff --git a/console-webapp/build.gradle b/console-webapp/build.gradle index c30323667..37f0f05a2 100644 --- a/console-webapp/build.gradle +++ b/console-webapp/build.gradle @@ -40,9 +40,7 @@ task runConsoleWebappUnitTests(type: Exec) { task buildConsoleWebapp(type: Exec) { workingDir "${consoleDir}/" executable 'npm' - def configuration = project.hasProperty('configuration') ? - project.getProperty('configuration') : - 'production' + def configuration = project.getProperty('configuration') args 'run', "build", "--configuration=${configuration}" doFirst { println "Building console for environment: ${configuration}" diff --git a/console-webapp/gradle.properties b/console-webapp/gradle.properties new file mode 100644 index 000000000..04bc504bd --- /dev/null +++ b/console-webapp/gradle.properties @@ -0,0 +1 @@ +configuration=production diff --git a/release/build_nomulus_for_env.sh b/release/build_nomulus_for_env.sh index 5de5ff108..12288fe2d 100755 --- a/release/build_nomulus_for_env.sh +++ b/release/build_nomulus_for_env.sh @@ -51,7 +51,7 @@ else mv services/"${service}"/build/staged-app "${dest}/${service}" done - ./gradlew :console-webapp:buildConsoleWebapp -Pconfiguration="${environment}" + ./gradlew :console-webapp:buildConsoleWebapp -Penvironment="${environment}" mkdir -p "${dest}/console" && cp -r console-webapp/staged/* "${dest}/console" mv core/build/resources/main/google/registry/env/common/META-INF \