From 7a3d57d5830eba45a197f46b5872938123dce454 Mon Sep 17 00:00:00 2001
From: Violeta Sebe <vsebe@ca.ibm.com>
Date: Mon, 20 Sep 2021 12:02:34 -0400
Subject: [PATCH] Set programmatically enableInstallers and enableSigner flags

Remove enableInstallers and enableSigner hard-coded values in job
regenerator. Infer values from defaults.json.
Disable installers by default.

Signed-off-by: Violeta Sebe <vsebe@ca.ibm.com>
---
 pipelines/build/common/config_regeneration.groovy      |  4 ++--
 .../build/regeneration/build_pipeline_generator.groovy |  3 +++
 pipelines/defaults.json                                | 10 ++++++----
 pipelines/jobs/pipeline_job_template.groovy            |  4 ++--
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/pipelines/build/common/config_regeneration.groovy b/pipelines/build/common/config_regeneration.groovy
index 0e422e1cb..8b5f615a1 100644
--- a/pipelines/build/common/config_regeneration.groovy
+++ b/pipelines/build/common/config_regeneration.groovy
@@ -444,8 +444,8 @@ class Regeneration implements Serializable {
                 ADOPT_BUILD_NUMBER: "",
                 ENABLE_TESTS: DEFAULTS_JSON['testDetails']['enableTests'] as Boolean,
                 ENABLE_TESTDYNAMICPARALLEL: DEFAULTS_JSON['testDetails']['enableTestDynamicParallel'] as Boolean,
-                ENABLE_INSTALLERS: true,
-                ENABLE_SIGNER: true,
+                ENABLE_INSTALLERS: DEFAULTS_JSON['enableInstallers'] as Boolean,
+                ENABLE_SIGNER: DEFAULTS_JSON['enableSigner'] as Boolean,
                 CLEAN_WORKSPACE: true,
                 CLEAN_WORKSPACE_AFTER: true,
                 CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER: false
diff --git a/pipelines/build/regeneration/build_pipeline_generator.groovy b/pipelines/build/regeneration/build_pipeline_generator.groovy
index c669d4e35..f624c9cf7 100644
--- a/pipelines/build/regeneration/build_pipeline_generator.groovy
+++ b/pipelines/build/regeneration/build_pipeline_generator.groovy
@@ -212,6 +212,9 @@ node('master') {
         config.put("defaultsJson", DEFAULTS_JSON)
         config.put("adoptDefaultsJson", ADOPT_DEFAULTS_JSON)
 
+        config.put("enableInstallers", DEFAULTS_JSON['enableInstallers'] as Boolean)
+        config.put("enableSigner", DEFAULTS_JSON['enableSigner'] as Boolean)
+
         println "[INFO] FINAL CONFIG FOR NIGHTLY $javaVersion"
         println JsonOutput.prettyPrint(JsonOutput.toJson(config))
 
diff --git a/pipelines/defaults.json b/pipelines/defaults.json
index 70a04f343..0414555fb 100644
--- a/pipelines/defaults.json
+++ b/pipelines/defaults.json
@@ -12,7 +12,7 @@
         "rootUrl"            : "https://hyc-runtimes-jenkins.swg-devops.com/",
         "rootDirectory"      : "build-scripts"
     },
-    "templateDirectories" : {
+    "templateDirectories"    : {
         "downstream"         : "pipelines/build/common/create_job_from_template.groovy",
         "upstream"           : "pipelines/jobs/pipeline_job_template.groovy",
         "weekly"             : "pipelines/jobs/weekly_release_pipeline_job_template.groovy"
@@ -30,7 +30,7 @@
         "tester"             : "pipelines/build/prTester/pr_test_pipeline.groovy",
         "buildfarm"          : "build-farm/make-adopt-build-farm.sh"
     },
-    "baseFileDirectories": {
+    "baseFileDirectories"    : {
         "upstream"           : "pipelines/build/common/build_base_file.groovy",
         "downstream"         : "pipelines/build/common/openjdk_build_pipeline.groovy"
     },
@@ -45,7 +45,7 @@
             "sanity.system",
             "special.system"
         ],
-        "weeklyDefault"     : [
+        "weeklyDefault"      : [
             "extended.openjdk",
             "extended.perf",
             "extended.jck",
@@ -53,7 +53,7 @@
             "special.functional",
             "special.jck"
         ],
-        "disabled" : [
+        "disabled"           : [
             "sanity.external"
         ],
         "enableTestDynamicParallel" : false,
@@ -62,6 +62,8 @@
             "numMachines"    : "3"
          }
     },
+    "enableInstallers"       : false,
+    "enableSigner"           : true,
     "importLibraryScript"    : "pipelines/build/common/import_lib.groovy",
     "defaultsUrl"            : "https://raw.githubusercontent.com/ibmruntimes/ci-jenkins-pipelines/ibm/pipelines/defaults.json"
 }
diff --git a/pipelines/jobs/pipeline_job_template.groovy b/pipelines/jobs/pipeline_job_template.groovy
index 655ffb658..9a5415306 100644
--- a/pipelines/jobs/pipeline_job_template.groovy
+++ b/pipelines/jobs/pipeline_job_template.groovy
@@ -4,8 +4,8 @@ gitRefSpec = ""
 propagateFailures = true
 runTests = enableTests
 runParallel = true
-runInstaller = true
-runSigner = true
+runInstaller = enableInstallers
+runSigner = enableSigner
 cleanWsBuildOutput = true
 jdkVersion = "${JAVA_VERSION}"
 isLightweight = true