mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
Build different console versions for different environments (#2715)
TESTED=deployed to alpha
This commit is contained in:
@@ -25,7 +25,7 @@ import textwrap
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
# We should never analyze any generated files
|
# We should never analyze any generated files
|
||||||
UNIVERSALLY_SKIPPED_PATTERNS = {"/build/", "cloudbuild-caches", "/out/", ".git/", ".gradle/", "/dist/", "karma.conf.js", "polyfills.ts", "test.ts", "/docs/console-endpoints/"}
|
UNIVERSALLY_SKIPPED_PATTERNS = {"/build/", "cloudbuild-caches", "/out/", ".git/", ".gradle/", "/dist/", "/console-alpha/", "/console-crash/", "/console-qa", "/console-sandbox", "/console-production", "karma.conf.js", "polyfills.ts", "test.ts", "/docs/console-endpoints/"}
|
||||||
# We can't rely on CI to have the Enum package installed so we do this instead.
|
# We can't rely on CI to have the Enum package installed so we do this instead.
|
||||||
FORBIDDEN = 1
|
FORBIDDEN = 1
|
||||||
REQUIRED = 2
|
REQUIRED = 2
|
||||||
|
|||||||
1
console-webapp/.gitignore
vendored
1
console-webapp/.gitignore
vendored
@@ -44,3 +44,4 @@ Thumbs.db
|
|||||||
|
|
||||||
# Build artifact
|
# Build artifact
|
||||||
/staged/dist
|
/staged/dist
|
||||||
|
/staged/console-*
|
||||||
|
|||||||
@@ -96,11 +96,17 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"namedChunks": true
|
"namedChunks": true
|
||||||
},
|
},
|
||||||
"development": {
|
"qa": {
|
||||||
"optimization": false,
|
"optimization": false,
|
||||||
"extractLicenses": false,
|
"extractLicenses": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"namedChunks": true
|
"namedChunks": true
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"namedChunks": true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
@@ -120,6 +126,9 @@
|
|||||||
"sandbox": {
|
"sandbox": {
|
||||||
"buildTarget": "console-webapp:build:sandbox"
|
"buildTarget": "console-webapp:build:sandbox"
|
||||||
},
|
},
|
||||||
|
"qa": {
|
||||||
|
"buildTarget": "console-webapp:build:qa"
|
||||||
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "console-webapp:build:development"
|
"buildTarget": "console-webapp:build:development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,48 @@ task buildConsoleWebapp(type: Exec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task buildConsoleForAll() {}
|
||||||
|
|
||||||
|
def createConsoleTask = { env ->
|
||||||
|
project.tasks.register("buildConsoleFor${env.capitalize()}", Exec) {
|
||||||
|
workingDir "${consoleDir}/"
|
||||||
|
executable 'npm'
|
||||||
|
args 'run', 'build', "--configuration=${env}"
|
||||||
|
doFirst {
|
||||||
|
println "Building console for environment: ${env}"
|
||||||
|
}
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from "${consoleDir}/staged/dist/"
|
||||||
|
into "${consoleDir}/staged/console-${env}"
|
||||||
|
}
|
||||||
|
delete "${consoleDir}/staged/dist"
|
||||||
|
}
|
||||||
|
dependsOn(tasks.npmInstallDeps)
|
||||||
|
}
|
||||||
|
project.tasks.register("deleteConsoleFor${env.capitalize()}", Delete) {
|
||||||
|
delete "${consoleDir}/staged/console-${env}"
|
||||||
|
}
|
||||||
|
tasks.named('clean') {
|
||||||
|
dependsOn(tasks.named("deleteConsoleFor${env.capitalize()}"))
|
||||||
|
}
|
||||||
|
tasks.named('buildConsoleForAll') {
|
||||||
|
dependsOn(tasks.named("buildConsoleFor${env.capitalize()}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
['alpha', 'crash', 'qa', 'sandbox', 'production'].forEach {env ->
|
||||||
|
createConsoleTask(env)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force an order so we don't run these tasks in parallel.
|
||||||
|
tasks.buildConsoleForCrash.mustRunAfter(tasks.buildConsoleForAlpha)
|
||||||
|
tasks.buildConsoleForQa.mustRunAfter(tasks.buildConsoleForCrash)
|
||||||
|
tasks.buildConsoleForSandbox.mustRunAfter(tasks.buildConsoleForQa)
|
||||||
|
tasks.buildConsoleForProduction.mustRunAfter(tasks.buildConsoleForSandbox)
|
||||||
|
// This task must run last, otherwise the previous tasks will have deleted the "dist" folder.
|
||||||
|
tasks.buildConsoleWebapp.mustRunAfter(tasks.buildConsoleForProduction)
|
||||||
|
|
||||||
task applyFormatting(type: Exec) {
|
task applyFormatting(type: Exec) {
|
||||||
workingDir "${consoleDir}/"
|
workingDir "${consoleDir}/"
|
||||||
executable 'npm'
|
executable 'npm'
|
||||||
|
|||||||
@@ -687,6 +687,7 @@ artifacts {
|
|||||||
task runTestServer(type: JavaExec) {
|
task runTestServer(type: JavaExec) {
|
||||||
main = 'google.registry.server.RegistryTestServerMain'
|
main = 'google.registry.server.RegistryTestServerMain'
|
||||||
classpath = sourceSets.test.runtimeClasspath
|
classpath = sourceSets.test.runtimeClasspath
|
||||||
|
dependsOn(rootProject.project('console-webapp').tasks.named('buildConsoleWebapp'))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('copyConsole', Copy) {
|
tasks.register('copyConsole', Copy) {
|
||||||
from("${rootDir}/console-webapp/staged/dist") {
|
from("${rootDir}/console-webapp/staged/") {
|
||||||
include "**/*"
|
include "console-*/*"
|
||||||
}
|
}
|
||||||
into layout.buildDirectory.dir('jetty-base/webapps/console')
|
into layout.buildDirectory.dir('jetty-base/webapps/')
|
||||||
dependsOn(':console-webapp:buildConsoleWebapp')
|
dependsOn(':console-webapp:buildConsoleForAll')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('stage') {
|
tasks.register('stage') {
|
||||||
|
|||||||
@@ -13,8 +13,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
environment=$1
|
env=${1:-"alpha"}
|
||||||
cd /jetty-base
|
cd /jetty-base
|
||||||
java -Dgoogle.registry.environment=${environment:-"alpha"} \
|
cp -rf webapps/console-${env} webapps/console
|
||||||
|
echo "Running ${env}"
|
||||||
|
java -Dgoogle.registry.environment=${env} \
|
||||||
-Djava.util.logging.config.file=/logging.properties \
|
-Djava.util.logging.config.file=/logging.properties \
|
||||||
-jar /usr/local/jetty/start.jar
|
-jar /usr/local/jetty/start.jar
|
||||||
|
|||||||
Reference in New Issue
Block a user