michaelsembwever commented on code in PR #2852: URL: https://github.com/apache/cassandra/pull/2852#discussion_r1520255524
########## .jenkins/Jenkinsfile: ########## @@ -11,762 +11,480 @@ // 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. +// +// These CI-agnostic scripts are used as an intermediate dockerized layer above the ant build.xml +// The ant build.xml is never invoked directly. +// +// +// 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` +def jdksSupported = ["11", "17"] +def archsSupported = ["amd64", "arm64"] +def pythonsSupported = ["3.8", "3.11"] +def jdkDefault = "11" +def pythonDefault = "3.8" +def stageResults = [:] + +// Steps config +def buildSteps = [ + 'jar': [script: 'build-jars.sh', toCopy: null], + 'artifacts': [script: 'build-artifacts.sh', toCopy: 'apache-cassandra-*.tar.gz,apache-cassandra-*.jar,apache-cassandra-*.pom'], + 'lint': [script: 'check-code.sh', toCopy: null], + 'debian': [script: 'build-debian.sh', toCopy: 'cassandra_*,cassandra-tools_*'], + 'redhat': [script: 'build-redhat.sh rpm', toCopy: '*.rpm'], +] +buildSteps.each() { + it.value.put('type', 'build') + it.value.put('splits', 1) +} + +def testSteps = [ + 'cqlsh-test': [splits: 1], + 'fqltool-test': [splits: 1], + 'test-cdc': [splits: 8], + 'test': [splits: 8], + 'test-trie': [splits: 8], + 'test-compression': [splits: 8], + 'stress-test': [splits: 1], + 'test-burn': [splits: 8], + 'long-test': [splits: 8], + 'test-oa': [splits: 8], + 'test-system-keyspace-directory': [splits: 8], + 'jvm-dtest': [splits: 8], + 'jvm-dtest-upgrade': [splits: 8], + 'simulator-dtest': [splits: 1], + 'dtest': [splits: 64], + 'dtest-novnode': [splits: 64], + 'dtest-offheap': [splits: 64], + 'dtest-large': [splits: 8], + 'dtest-large-novnode': [splits: 8], + 'dtest-upgrade': [splits: 64], + 'dtest-upgrade-novnode': [splits: 64], + 'dtest-upgrade-large': [splits: 64], + 'dtest-upgrade-novnode-large': [splits: 64], +] +testSteps.each() { + it.value.put('type', 'test') + it.value.put('script', '.build/docker/run-tests.sh') + if (it.key.startsWith('dtest')) { + it.value.put('python-dtest', true) + } +} + +def stepsMap = buildSteps + testSteps + +// define matrix axes +def Map matrix_axes = [ + arch: archsSupported, + jdk: jdksSupported, + python: pythonsSupported, + cython: ['yes', 'no'], + step: stepsMap.keySet(), + split: (1..64).toList() // needs to be max splits can be ?? +] + +def List _axes = getMatrixAxes(matrix_axes).findAll { axis -> + (isArchEnabled(axis['arch'])) && // skip disabled archs + (isJdkEnabled(axis['jdk'])) && // skip disabled jdks + (isStageEnabled(axis['step'])) && // skip disabled steps + !(axis['python'] != pythonDefault && 'cqlsh-test' != axis['step']) && // Use only python 3.8 for all tests but cqlsh-test + !(axis['cython'] != 'no' && 'cqlsh-test' != axis['step']) && // cython only for cqlsh-test, disable for others + !(axis['jdk'] != jdkDefault && 'cqlsh-test' == axis['step']) && // run cqlsh-test only with jdk11 + // Disable splits for all but proper stages + !(axis['split'] > 1 && !stepsMap.findAll { entry -> entry.value.splits >= axis['split'] }.keySet().contains(axis['step'])) && + // run only the build types on non-amd64 + !(axis['arch'] != 'amd64' && stepsMap.findAll { entry -> 'build' == entry.value.type }.keySet().contains(axis['step'])) +} + +// Prepare tasks +def Map tasks = [ + jars: [failFast: !isPostCommit()], + tests: [failFast: !isPostCommit()], +] +for (def axis in _axes) { + def cell = axis + def name = getStepName(cell, stepsMap[cell.step]) + tasks[cell.step == "jar" ? "jars" : "tests"][name] = { -> + "${stepsMap[cell.step].type}"(stepsMap[cell.step], cell) // build() or test() + } +} + pipeline { - agent { label 'cassandra' } + agent none + options { + skipDefaultCheckout() + + // FIXME problem with this retry approach is it retries the whole pipeline. what we want is just cell retry + //retry(2) + } + parameters { + string(name: 'repository', defaultValue: scm.userRemoteConfigs[0].url, description: 'Cassandra Repository') + string(name: 'branch', defaultValue: env.BRANCH_NAME, description: 'Branch') + choice(name: 'architecture', choices: archsSupported + "all", description: 'Pick architecture. The ARM64 is disabled by default at the moment.') + choice(name: 'jdk', choices: jdksSupported + "all", description: 'Pick JDK versions.') + booleanParam(name: 'stage_artifacts', defaultValue: false, description: 'Disable to exlude stage') // return default to true + booleanParam(name: 'stage_lint', defaultValue: false) // return default to true + booleanParam(name: 'stage_debian', defaultValue: false) // return default to true + booleanParam(name: 'stage_redhat', defaultValue: false) // return default to true + booleanParam(name: 'stage_fqltool-test', defaultValue: false) // return default to true + booleanParam(name: 'stage_cqlsh-test', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-cdc', defaultValue: false) // return default to true + booleanParam(name: 'stage_test', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-trie', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-compression', defaultValue: false) // return default to true + booleanParam(name: 'stage_stress-test', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-burn', defaultValue: false) // return default to true + booleanParam(name: 'stage_long-test', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-oa', defaultValue: false) // return default to true + booleanParam(name: 'stage_test-system-keyspace-directory', defaultValue: false) // return default to true + booleanParam(name: 'stage_jvm-dtest', defaultValue: false) // return default to true + booleanParam(name: 'stage_jvm-dtest-upgrade', defaultValue: false) // return default to true + booleanParam(name: 'stage_simulator-dtest', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-novnode', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-offheap', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-large', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-large-novnode', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-upgrade', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-upgrade-novnode', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-upgrade-large', defaultValue: false) // return default to true + booleanParam(name: 'stage_dtest-upgrade-novnode-large', defaultValue: false) // return default to true Review Comment: this still needs a fix: - all post-commit stages must be enabled by default (so post-commit builds just run without prompting) - simpler UX (clicking a gazillion checkboxes is no good) -- 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]

