|
| 1 | +// -*- groovy -*- |
| 2 | +// |
| 3 | +// Copyright (c) 2022-2023 Amazon.com, Inc. or its affiliates. All rights |
| 4 | +// reserved. |
| 5 | +// Copyright (c) 2022-2023 Joe Downs. All rights reserved. |
| 6 | +// $COPYRIGHT$ |
| 7 | +// |
| 8 | +// Additional copyrights may follow |
| 9 | +// |
| 10 | +// $HEADER$ |
| 11 | +// |
| 12 | +// Build an Open MPI Pull Request |
| 13 | +// |
| 14 | +// |
| 15 | +// WORKSPACE Layout: |
| 16 | +// autotools-install/ Autotools install for the builder |
| 17 | +// ompi/ Open MPI source tree |
| 18 | + |
| 19 | +// We if we push changes to a PR, we don't need to keep old jobs running, so |
| 20 | +// we'll use the milestone step in Jenkins. Using an example from |
| 21 | +// https://stackoverflow.com/questions/40760716/jenkins-abort-running-build-if-new-one-is-started: |
| 22 | +// |
| 23 | +// - Build 1 runs and creates milestone 1. |
| 24 | +// - While build 1 is running, build 2 fires. It has milestone 1 and milestone |
| 25 | +// 2. It passes milestone 1, which causes build 1 to abort. |
| 26 | +def buildNumber = env.BUILD_NUMBER as int |
| 27 | +if (buildNumber > 1) { |
| 28 | + milestone(buildNumber - 1) |
| 29 | +} |
| 30 | +milestone(buildNumber) |
| 31 | + |
| 32 | +check_stages = prepare_check_stages() |
| 33 | +println("Initialized Pipeline") |
| 34 | + |
| 35 | +// Today, we only expect to have one stage (do everything), but allow that |
| 36 | +// we may split build and test stages in the future. |
| 37 | +for (check_stage in check_stages) { |
| 38 | + parallel(check_stage) |
| 39 | +} |
| 40 | + |
| 41 | +println('Tests Completed') |
| 42 | + |
| 43 | +// Returns a list of build stages ("build Open MPI", "Build Tests", etc.), |
| 44 | +// although currently we only support the one stage of "everything", where each |
| 45 | +// build stage is a map of different configurations to test. |
| 46 | +def prepare_check_stages() { |
| 47 | + def configure_options = ["--disable-dlopen", "--disable-oshmem", "--enable-builtin-atomic", "--enable-ipv6"] |
| 48 | + def compilers = ["clang10", "gcc5", "gcc6", "gcc7", "gcc8", "gcc9", "gcc10"] |
| 49 | + def platforms = ["amazon_linux_2", "amazon_linux_2-arm64", "rhel7", "rhel8", "ubuntu_18.04"] |
| 50 | + def check_stages_list = [] |
| 51 | + |
| 52 | + // Build everything stage |
| 53 | + def build_parallel_map = [:] |
| 54 | + for (platform in platforms) { |
| 55 | + def name = "Platform: ${platform}".replaceAll("-", "") |
| 56 | + build_parallel_map.put(name, prepare_build(name, platform, "")) |
| 57 | + } |
| 58 | + |
| 59 | + for (compiler in compilers) { |
| 60 | + def name = "Compiler: ${compiler}".replaceAll("-", "") |
| 61 | + build_parallel_map.put(name, prepare_build(name, compiler, "--compiler \\\"${compiler}\\\"")) |
| 62 | + } |
| 63 | + |
| 64 | + for (configure_option in configure_options) { |
| 65 | + def name = "Configure: ${configure_option}".replaceAll("-", "") |
| 66 | + build_parallel_map.put(name, prepare_build(name, "(ec2&&linux)", "--configure-args \\\"${configure_option}\\\"")) |
| 67 | + } |
| 68 | + |
| 69 | + build_parallel_map.put("distcheck", prepare_build("distcheck", "tarball_build", "--distcheck")) |
| 70 | + |
| 71 | + check_stages_list.add(build_parallel_map) |
| 72 | + |
| 73 | + return check_stages_list |
| 74 | +} |
| 75 | + |
| 76 | +def prepare_build(build_name, label, build_arg) { |
| 77 | + return { |
| 78 | + stage("${build_name}") { |
| 79 | + node(label) { |
| 80 | + checkout(changelog: false, poll: false, scm: scm) |
| 81 | + sh "/bin/bash -x .ci/community-jenkins/pr-builder.sh ${build_arg} ompi" |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | +} |
0 commit comments