jjb: lava: do not use empty default params
[lttng-ci.git] / scripts / system-tests / system-trigger.groovy
index 0dc7d2b94b1ddd534e507a27c5ab9b2312b46092..6833c2a58dc26fc88e84957afb94be1bb7faaf5b 100644 (file)
@@ -290,13 +290,17 @@ def LaunchJob = { jobName, runConfig ->
   def job = Hudson.instance.getJob(jobName)
   def params = []
   for (paramdef in job.getProperty(ParametersDefinitionProperty.class).getParameterDefinitions()) {
-    params += paramdef.getDefaultParameterValue();
+    // If there is a default value for this parameter, use it. Don't use empty
+    // default value parameters.
+    if (paramdef.getDefaultValue()) {
+      params += paramdef.getDefaultParameterValue();
+    }
   }
 
-  params.add(new StringParameterValue('tools_commit_id', runConfig.lttngToolsCommitId))
-  params.add(new StringParameterValue('modules_commit_id', runConfig.lttngModulesCommitId))
-  params.add(new StringParameterValue('ust_commit_id', runConfig.lttngUstCommitId))
-  params.add(new StringParameterValue('kernel_tag_id', runConfig.linuxTagId))
+  params.add(new StringParameterValue('LTTNG_TOOLS_COMMIT_ID', runConfig.lttngToolsCommitId))
+  params.add(new StringParameterValue('LTTNG_MODULES_COMMIT_ID', runConfig.lttngModulesCommitId))
+  params.add(new StringParameterValue('LTTNG_UST_COMMIT_ID', runConfig.lttngUstCommitId))
+  params.add(new StringParameterValue('KERNEL_TAG_ID', runConfig.linuxTagId))
   def currBuild = job.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(params))
 
   if (currBuild != null ) {
@@ -322,9 +326,9 @@ def recentLttngBranchesOfInterest = ['master', 'stable-2.10', 'stable-2.9']
 def recentLinuxBranchesOfInterest = ['master', 'linux-4.9.y', 'linux-4.4.y']
 
 def legacyLttngBranchesOfInterest = ['stable-2.7']
-def legacyLinuxBranchesOfInterest = ['linux-3.18.y', 'linux-4.4.y']
+def legacyLinuxBranchesOfInterest = ['linux-3.18.y']
 
-// Generate configurations of interest
+// Generate configurations of interest.
 def configurationOfInterest = [] as Set
 
 recentLttngBranchesOfInterest.each { lttngBranch ->
@@ -342,19 +346,19 @@ legacyLttngBranchesOfInterest.each { lttngBranch ->
 def lttngBranchesOfInterest = recentLttngBranchesOfInterest + legacyLttngBranchesOfInterest
 def linuxBranchesOfInterest = recentLinuxBranchesOfInterest + legacyLinuxBranchesOfInterest
 
-// For Linux branches, we look for new non-RC tags
+// For LTTng branches, we look for new commits.
 def toolsHeadCommits = GetHeadCommits(toolsRepo, lttngBranchesOfInterest)
 def modulesHeadCommits = GetHeadCommits(modulesRepo, lttngBranchesOfInterest)
 def ustHeadCommits = GetHeadCommits(ustRepo, lttngBranchesOfInterest)
 
-// For LTTng branches, we look for new commits
+// For Linux branches, we look for new non-RC tags.
 def linuxLastTagIds = GetLastTagIds(linuxRepo, linuxBranchesOfInterest)
 
 // Load previously built Linux tag ids.
 println("Loading Git object IDs of previously built projects from the workspace.");
 def oldLinuxTags = LoadPreviousIdsFromWorkspace(linuxOnDiskPath) as Set
 
-// Load previously built LTTng commit ids
+// Load previously built LTTng commit ids.
 def oldToolsHeadCommits = LoadPreviousIdsFromWorkspace(toolsOnDiskPath) as Set
 def oldModulesHeadCommits = LoadPreviousIdsFromWorkspace(modulesOnDiskPath) as Set
 def oldUstHeadCommits = LoadPreviousIdsFromWorkspace(ustOnDiskPath) as Set
@@ -372,7 +376,7 @@ canaryRunConfigs.add(
 def runConfigs = [] as Set
 
 // For each top of branch kernel tags that were not seen before, schedule one
-// job for each lttng/linux tracked configurations
+// job for each lttng/linux tracked configurations.
 linuxLastTagIds.each { linuxTag ->
   if (!oldLinuxTags.contains(linuxTag.value)) {
     lttngBranchesOfInterest.each { lttngBranch ->
@@ -458,21 +462,9 @@ if (triggerJobName.contains("vm_tests")) {
   jobType = 'baremetal_benchmarks';
 }
 
-// Launch canary jobs.
-println("Schedule canary jobs once a day")
-canaryRunConfigs.each { config ->
-  def jobName = jobType + '_canary';
-  def currBuild = LaunchJob(jobName, config);
-
-  // LaunchJob will return null if the job doesn't exist or is disabled.
-  if (currBuild != null) {
-    ongoingBuild[jobName] = currBuild;
-  }
-}
-
 // Launch regular jobs.
 if (runConfigs.size() > 0) {
-  println("Schedule jobs because of code changes.");
+  println("\nSchedule jobs triggered by code changes:");
   runConfigs.each { config ->
     def jobName = CraftJobName(jobType, config);
     def currBuild = LaunchJob(jobName, config);
@@ -501,6 +493,18 @@ if (runConfigs.size() > 0) {
   println("No new commit or tags, nothing more to do.")
 }
 
+// Launch canary jobs.
+println("\nSchedule canary jobs once a day:")
+canaryRunConfigs.each { config ->
+  def jobName = jobType + '_canary';
+  def currBuild = LaunchJob(jobName, config);
+
+  // LaunchJob will return null if the job doesn't exist or is disabled.
+  if (currBuild != null) {
+    ongoingBuild[jobName] = currBuild;
+  }
+}
+
 // Save the tag and commit IDs scheduled in the past and during this run to the
 // workspace. We save it at the end to be sure all jobs were launched. We save
 // the object IDs even in case of failure. There is no point of re-running the
@@ -554,7 +558,7 @@ while (ongoingBuild.size() > 0) {
 
   // Sleep before the next iteration.
   try {
-    Thread.sleep(10000)
+    Thread.sleep(30000)
   } catch(e) {
     if (e in InterruptedException) {
       build.setResult(hudson.model.Result.ABORTED)
This page took 0.024619 seconds and 4 git commands to generate.