1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 06:15:42 +00:00

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.
This commit is contained in:
Lai Jiang
2025-03-10 20:03:12 -04:00
committed by GitHub
parent 467d9c7bf1
commit bede56598c
4 changed files with 6 additions and 11 deletions

View File

@@ -95,26 +95,22 @@ task stage {
description = 'Generates application directories for all services.' 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 def gcpProject = null
apply from: "${rootDir.path}/projects.gradle" apply from: "${rootDir.path}/projects.gradle"
if (environment == '') { 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 // environment to "alpha" because other code needs this property to
// explode the war file. // explode the war file.
environment = 'alpha' environment = 'alpha'
} else if (environment != 'production' && environment != 'sandbox') { } else {
gcpProject = projects[environment] gcpProject = projects[environment]
if (gcpProject == null) { if (gcpProject == null) {
throw new GradleException("-Penvironment must be one of " + throw new GradleException("-Penvironment must be one of " +
"${projects.keySet()}.") "${projects.keySet()}.")
} }
project(':console-webapp').setProperty('configuration', environment)
} }
rootProject.ext.environment = environment rootProject.ext.environment = environment

View File

@@ -40,9 +40,7 @@ task runConsoleWebappUnitTests(type: Exec) {
task buildConsoleWebapp(type: Exec) { task buildConsoleWebapp(type: Exec) {
workingDir "${consoleDir}/" workingDir "${consoleDir}/"
executable 'npm' executable 'npm'
def configuration = project.hasProperty('configuration') ? def configuration = project.getProperty('configuration')
project.getProperty('configuration') :
'production'
args 'run', "build", "--configuration=${configuration}" args 'run', "build", "--configuration=${configuration}"
doFirst { doFirst {
println "Building console for environment: ${configuration}" println "Building console for environment: ${configuration}"

View File

@@ -0,0 +1 @@
configuration=production

View File

@@ -51,7 +51,7 @@ else
mv services/"${service}"/build/staged-app "${dest}/${service}" mv services/"${service}"/build/staged-app "${dest}/${service}"
done done
./gradlew :console-webapp:buildConsoleWebapp -Pconfiguration="${environment}" ./gradlew :console-webapp:buildConsoleWebapp -Penvironment="${environment}"
mkdir -p "${dest}/console" && cp -r console-webapp/staged/* "${dest}/console" mkdir -p "${dest}/console" && cp -r console-webapp/staged/* "${dest}/console"
mv core/build/resources/main/google/registry/env/common/META-INF \ mv core/build/resources/main/google/registry/env/common/META-INF \