michaelsembwever commented on code in PR #2852:
URL: https://github.com/apache/cassandra/pull/2852#discussion_r1544353774


##########
.jenkins/Jenkinsfile:
##########
@@ -11,762 +11,518 @@
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// Se# Licensed to the Apache Software Foundation (ASF) under onee the License 
for the specific language governing permissions and
+// See the License for the specific language governing permissions and
 // limitations under the License.
 //
 //
-// Jenkins declaration of how to build and test the current codebase.
-//  Jenkins infrastructure related settings should be kept in
-//    
https://github.com/apache/cassandra-builds/blob/trunk/jenkins-dsl/cassandra_job_dsl_seed.groovy
+// Jenkins CI declaration.
+//
+// Scripting defs and the declarative pipeline is presented first.
+// The stepsMap array describes the pipeline stages to what CI-agnostic 
scripts they map to.
+// All `type: test` use the script `.build/docker/run-tests.sh`
+//
+// These CI-agnostic scripts are used as an intermediate dockerized layer 
above the ant build.xml
+//
+//
+// This Jenkinsfile is expected to work on any ci-cassandra.a.o clone.
+// Functionality that depends upon ASF Infra and the canonical 
ci-cassandra.a.o setup (e.g. post-commit builds)
+//  is required to quietly fail when run on other environments.
+//
 //
 // Validate/lint this file using the following command
 // `curl -X POST  -F "jenkinsfile=<.jenkins/Jenkinsfile" 
https://ci-cassandra.apache.org/pipeline-model-converter/validate`
 
+
 pipeline {
-  agent { label 'cassandra' }
+  agent none
+  options {
+    skipDefaultCheckout()
+  }
+  parameters {
+    string(name: 'repository', defaultValue: scm.userRemoteConfigs[0].url, 
description: 'Cassandra Repository')
+    string(name: 'branch', defaultValue: env.BRANCH_NAME, description: 
'Branch')
+
+    choice(name: 'profile', choices: pipelineProfiles().keySet() as List, 
description: 'Pick a pipeline profile.')
+    string(name: 'profile_custom_regexp', defaultValue: '', description: 
'Regexp against stages when using custom profile. See `testSteps` in 
Jenkinsfile for list of stages. Example: stress.*|jvm-dtest.*')
+
+    choice(name: 'architecture', choices: archsSupported() + "all", 
description: 'Pick architecture. The ARM64 is disabled by default at the 
moment.')
+    choice(name: 'jdk', choices: ["all"] + jdksSupported(), description: 'Pick 
JDK versions.')
+
+    string(name: 'dtest_repository', defaultValue: 
'https://github.com/apache/cassandra-dtest' ,description: 'Cassandra DTest 
Repository')
+    string(name: 'dtest_branch', defaultValue: 'trunk', description: 'DTest 
Branch')
+  }
+  environment {
+    javaVersionsSupported = jdksSupported().join(',')
+    javaVersionDefault = jdkDefault()
+  }
   stages {
-    stage('Init') {
+    stage('jar') {
       steps {
-          cleanWs()
-          script {
-              currentBuild.result='SUCCESS'
-          }
+        script {
+          parallel(tasks()['jars'])
+        }
       }
     }
-    stage('Build') {
+    stage('Tests') {
+      when {
+        // Skip if empty (failfast counts as an element)
+        expression { tasks()['tests'].size() > 1 }
+      }
       steps {
-       script {
-        def attempt = 1
-        retry(2) {
-          if (attempt > 1) {
-            sleep(60 * attempt)
-          }
-          attempt = attempt + 1
-          build job: "${env.JOB_NAME}-artifacts"
+        script {
+          parallel(tasks()['tests'])
         }
-       }
       }
     }
-    stage('Test') {
-      parallel {
-        stage('stress') {
-          steps {
-            script {
-              def attempt = 1
-              while (attempt <=2) {
-                if (attempt > 1) {
-                  sleep(60 * attempt)
-                }
-                attempt = attempt + 1
-                stress = build job: "${env.JOB_NAME}-stress-test", propagate: 
false
-                if (stress.result != 'FAILURE') break
-              }
-              if (stress.result != 'SUCCESS') unstable('stress test failures')
-              if (stress.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('stress-test', stress.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('fqltool') {
-          steps {
-              script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  fqltool = build job: "${env.JOB_NAME}-fqltool-test", 
propagate: false
-                  if (fqltool.result != 'FAILURE') break
-                }
-                if (fqltool.result != 'SUCCESS') unstable('fqltool test 
failures')
-                if (fqltool.result == 'FAILURE') currentBuild.result='FAILURE'
-              }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('fqltool-test', fqltool.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('units') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  test = build job: "${env.JOB_NAME}-test", propagate: false
-                  if (test.result != 'FAILURE') break
-              }
-              if (test.result != 'SUCCESS') unstable('unit test failures')
-              if (test.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test', test.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('long units') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  long_test = build job: "${env.JOB_NAME}-long-test", 
propagate: false
-                  if (long_test.result != 'FAILURE') break
-              }
-              if (long_test.result != 'SUCCESS') unstable('long unit test 
failures')
-              if (long_test.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('long-test', long_test.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('burn') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  burn = build job: "${env.JOB_NAME}-test-burn", propagate: 
false
-                  if (burn.result != 'FAILURE') break
-              }
-              if (burn.result != 'SUCCESS') unstable('burn test failures')
-              if (burn.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test-burn', burn.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('cdc') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  cdc = build job: "${env.JOB_NAME}-test-cdc", propagate: false
-                  if (cdc.result != 'FAILURE') break
-              }
-              if (cdc.result != 'SUCCESS') unstable('cdc failures')
-              if (cdc.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test-cdc', cdc.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('compression') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  compression = build job: "${env.JOB_NAME}-test-compression", 
propagate: false
-                  if (compression.result != 'FAILURE') break
-              }
-              if (compression.result != 'SUCCESS') unstable('compression 
failures')
-              if (compression.result == 'FAILURE') 
currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test-compression', 
compression.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('oa') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  oa = build job: "${env.JOB_NAME}-test-oa", propagate: false
-                  if (oa.result != 'FAILURE') break
-              }
-              if (oa.result != 'SUCCESS') unstable('oa failures')
-              if (oa.result == 'FAILURE') currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test-oa', oa.getNumber())
-                    }
-                }
-            }
-          }
-        }
-        stage('system-keyspace-directory') {
-          steps {
-            script {
-                def attempt = 1
-                while (attempt <=2) {
-                  if (attempt > 1) {
-                    sleep(60 * attempt)
-                  }
-                  attempt = attempt + 1
-                  system_keyspace_directory = build job: 
"${env.JOB_NAME}-test-system-keyspace-directory", propagate: false
-                  if (system_keyspace_directory.result != 'FAILURE') break
-              }
-              if (system_keyspace_directory.result != 'SUCCESS') 
unstable('system-keyspace-directory failures')
-              if (system_keyspace_directory.result == 'FAILURE') 
currentBuild.result='FAILURE'
-            }
-          }
-          post {
-            always {
-                warnError('missing test xml files') {
-                    script {
-                        copyTestResults('test-system-keyspace-directory', 
system_keyspace_directory.getNumber())
-                    }
-                }
-            }
-          }
+    stage('Summary') {
+      steps {
+        summateStatus()
+      }
+    }
+  }
+  post {
+    always {
+      generateTestReports()
+      sendNotifications()
+    }
+  }
+}
+
+///////////////////////////
+//// scripting support ////
+///////////////////////////
+
+def jdksSupported() { return ["11", "17"] }

Review Comment:
   > the build should fail if the hardcoded values don't match those from 
build.xml
   
   given recent changes
   - turning tasks() into a method instead of global variables, and
   - changing the 'jdk' parameter to be "what jdks to restrict the build to", 
rather that "what jdks to build with"
   
   it's easy now to completely remove the hardcoded methods, but it means 
changing the 'jdk' parameter from choice to string.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to