From e28c651ac787e971efa3a37579262553cadb6442 Mon Sep 17 00:00:00 2001 From: Yugandharkumar Date: Fri, 10 Mar 2023 17:03:50 +0530 Subject: [PATCH] For older version of spinnaker --- docker/ubi8/build.gradle | 170 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 docker/ubi8/build.gradle diff --git a/docker/ubi8/build.gradle b/docker/ubi8/build.gradle new file mode 100644 index 00000000000..170b0a03844 --- /dev/null +++ b/docker/ubi8/build.gradle @@ -0,0 +1,170 @@ +import java.nio.file.Paths +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import org.redline_rpm.header.Flags + +plugins { + id "io.spinnaker.artifactregistry-publish" version "$spinnakerGradleVersion" + id "nebula.node" version "1.3.1" +} + +group = "com.netflix.spinnaker.deck" +apply plugin: "nebula.ospackage" + +node { + // Pulls node and npm versions from package.json. + def packageSlurper = new JsonSlurper() + def packageJson = packageSlurper.parse file('package.json') + + version = packageJson.engines.node.replaceAll(/[^\d\.]/, '') + npmVersion = packageJson.engines.npm.replaceAll(/[^\d\.]/, '') + yarnVersion = packageJson.engines.yarn.replaceAll(/[^\d\.]/, '') + + // Enabled the automatic download. False is the default (for now). + download = true +} + +task modules(type: YarnTask) { + dependsOn "yarn" + + yarnCommand = ["modules"] +} + +task eslintPluginCompile(type: YarnTask) { + dependsOn "modules" + + workingDir = file(Paths.get("packages", "eslint-plugin")) + yarnCommand = ["tsc"] +} + +task eslintPluginTest(type: YarnTask) { + dependsOn "eslintPluginCompile" + + workingDir = file(Paths.get("packages", "eslint-plugin")) + yarnCommand = ["test"] +} + +project.tasks.register('eslintPlugin') { + dependsOn 'eslintPluginCompile' + dependsOn 'eslintPluginTest' +} + +task lint(type: YarnTask) { + dependsOn "eslintPlugin" + + yarnCommand = ["lint"] +} + +task prettier(type: YarnTask) { + dependsOn "eslintPlugin" + dependsOn "lint" + + yarnCommand = ["prettier:check"] +} + +project.tasks.register('runLinters') { + dependsOn "lint" + dependsOn "prettier" +} + +task karma(type: YarnTask) { + dependsOn "modules" + + yarnCommand = ["test"] + args = ["--single-run", "--reporters", "dots"] + + if (project.hasProperty('skipTests')) { + karma.enabled = false + } +} + +task functionalTests(type: YarnTask) { + dependsOn "modules" + dependsOn "karma" + + yarnCommand = ["functional"] + + if (project.hasProperty('skipTests')) { + functionalTests.enabled = false + } +} + +project.tasks.register('test') { + dependsOn 'karma' + dependsOn 'functionalTests' +} + +task webpack(type: YarnTask) { + dependsOn "yarn" + dependsOn "modules" + dependsOn "runLinters" + dependsOn "test" + + yarnCommand = ["build"] + environment = [ + "NODE_ENV": "production", + "GATE_HOST": "spinnaker-api-prestaging.prod.netflix.net", + "NODE_OPTIONS": "--max_old_space_size=8192", + ] +} +webpack.outputs.dir file('build/webpack') + +task copyFavicon(type: Copy) { + dependsOn "webpack" + + from "packages/app/icons/prod-favicon.ico" + into "build/webpack" + rename "prod-favicon.ico", "favicon.ico" +} + +task generateVersionFile { + doLast { + 'git update-index --assume-unchanged version.json'.execute() + def buildInfo = [ + version: project.hasProperty('deckVersion') ? "${deckVersion}" : "n/a", + created: new Date().getTime() + ] + def buildJson = JsonOutput.prettyPrint(JsonOutput.toJson(buildInfo)) + mkdir "build/webpack" + file(Paths.get("build", "webpack", "version.json")).write(buildJson) + file("version.json").write(buildJson) + } +} +yarn.dependsOn 'generateVersionFile' + +buildDeb.dependsOn 'copyFavicon' +buildRpm.dependsOn 'webpack' +build.dependsOn 'buildDeb' + +String toVers(String v) { + int idx = v.indexOf('-') + if (idx != -1) { + return v.substring(0, idx) + } + return v +} + +String toRelease(String v) { + int idx = v.lastIndexOf('-') + if (idx != -1) { + return v.substring(idx + 1) + } + return '' +} + +ospackage { + packageName = "spinnaker-deck" + version = toVers(project.version.toString()) + release toRelease(project.version.toString()) + into "/opt/deck/html" + from "build/webpack" + os = LINUX +} + +buildRpm { + requires('httpd') +} + +buildDeb { + requires('apache2', '2.4.7', Flags.GREATER | Flags.EQUAL) +}