diff --git a/buildscripts/scripts/test-composition.groovy b/buildscripts/scripts/test-composition.groovy index 32dd37af3cc..4ccf95788a8 100644 --- a/buildscripts/scripts/test-composition.groovy +++ b/buildscripts/scripts/test-composition.groovy @@ -8,6 +8,8 @@ /// Other artifacts: ??? /// Depends on: ??? +import org.jenkinsci.plugins.pipeline.modeldefinition.Utils + def main() { check_job_parameters([ "EDITION", @@ -24,7 +26,8 @@ def main() { // TODO: we should always use USE_CASE directly from the job parameters def use_case = (USE_CASE == "fips") ? USE_CASE : "daily_tests" test_jenkins_helper.assert_fips_testing(use_case, NODE_LABELS); - def distros = versioning.get_distros(edition: EDITION, use_case: use_case, override: OVERRIDE_DISTROS); + def all_distros = versioning.get_distros(override: "all"); + def distros_under_test = versioning.get_distros(edition: EDITION, use_case: use_case, override: OVERRIDE_DISTROS); def safe_branch_name = versioning.safe_branch_name(scm); def branch_version = versioning.get_branch_version(checkout_dir); @@ -43,13 +46,13 @@ def main() { |Run composition tests for
|VERSION: ${VERSION}
|EDITION: ${EDITION}
- |distros: ${distros}
+ |distros: ${distros_under_test}
""".stripMargin()); print( """ |===== CONFIGURATION =============================== - |distros:...................│${distros}│ + |distros:...................│${distros_under_test}│ |branch_name:.............. │${branch_name}│ |safe_branch_name:......... │${safe_branch_name}│ |cmk_version:.............. │${cmk_version}│ @@ -60,22 +63,62 @@ def main() { |=================================================== """.stripMargin()); - // TODO: don't run make test-composition-docker but use docker.inside() instead - stage('test cmk-docker integration') { - docker.withRegistry(DOCKER_REGISTRY, "nexus") { - testing_helper.run_make_targets( - DOCKER_GROUP_ID: get_docker_group_id(), - DISTRO_LIST: distros, - EDITION: EDITION, - VERSION: VERSION, - DOCKER_TAG: docker_tag, - MAKE_TARGET: "test-composition-docker", - BRANCH: branch_name, - cmk_version: cmk_version_rc_aware, - OTEL_EXPORTER_OTLP_ENDPOINT: env.OTEL_EXPORTER_OTLP_ENDPOINT, - ); + def build_for_parallel = [:]; + def parallel_stages_states = []; + def base_folder = "${currentBuild.fullProjectName.split('/')[0..-3].join('/')}"; + def relative_job_name = "${base_folder}/builders/test-composition-single-f12less"; + + all_distros.each { item -> + def distro = item; + def stepName = "Composition test for ${distro}"; + + build_for_parallel[stepName] = { -> + def run_condition = distro in distros_under_test; + println("Should ${distro} be tested? ${run_condition}"); + + /// this makes sure the whole parallel thread is marked as skipped + if (! run_condition){ + Utils.markStageSkippedForConditional(stepName); + } + + smart_stage( + name: stepName, + condition: run_condition, + raiseOnError: false, + ) { + def this_exit_successfully = false; + def job = build( + job: relative_job_name, + propagate: false, // do not raise here, continue, get status via result property later + parameters: [ + string(name: "DISTRO", value: distro), + string(name: "EDITION", value: EDITION), + string(name: "VERSION", value: VERSION), + string(name: "DOCKER_TAG", value: docker_tag), + string(name: "CUSTOM_GIT_REF", value: CUSTOM_GIT_REF), + string(name: "CIPARAM_OVERRIDE_BUILD_NODE", value: CIPARAM_OVERRIDE_BUILD_NODE), + string(name: "CIPARAM_CLEANUP_WORKSPACE", value: CIPARAM_CLEANUP_WORKSPACE), + ], + ); + println("job result is: ${job.result}"); + // be really really sure if it is a success + if (job.result == "SUCCESS") { + this_exit_successfully = true; + } else { + error("${distro.NAME} failed"); + } + parallel_stages_states.add(this_exit_successfully); + } } } + + stage('Run composition tests') { + parallel build_for_parallel; + } + + println("All stages results: ${parallel_stages_states}"); + all_true = parallel_stages_states.every { it == true } == true; + currentBuild.result = all_true ? "SUCCESS" : "FAILED"; } return this;