|
2 | 2 |
|
3 | 3 | def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
4 | 4 |
|
5 |
| -test_steps = [ |
6 |
| - 'deb': { -> |
7 |
| - stage('Ubuntu and Debian Package') { |
8 |
| - wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
9 |
| - try { |
10 |
| - checkout scm |
11 |
| - sh "make REF=$branch checkout" |
12 |
| - sh "make -C deb ubuntu-focal ubuntu-hirsute ubuntu-impish debian-bullseye" |
13 |
| - } finally { |
14 |
| - sh "make clean" |
15 |
| - } |
16 |
| - } |
17 |
| - } |
18 |
| - }, |
19 |
| - 'raspbian': { -> |
20 |
| - stage('Raspbian') { |
21 |
| - wrappedNode(label: 'ubuntu && armhf', cleanWorkspace: true) { |
22 |
| - try { |
23 |
| - checkout scm |
24 |
| - sh "make REF=$branch checkout" |
25 |
| - sh "make -C deb raspbian-buster raspbian-bullseye" |
26 |
| - } finally { |
27 |
| - sh "make clean" |
28 |
| - } |
29 |
| - } |
30 |
| - } |
31 |
| - }, |
32 |
| - 'rpm': { -> |
33 |
| - stage('Centos 7 and 8 RPM Packages') { |
34 |
| - wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
35 |
| - try { |
36 |
| - checkout scm |
37 |
| - sh "make REF=$branch checkout" |
38 |
| - sh "make -C rpm centos-7 centos-8 fedora-35" |
39 |
| - } finally { |
40 |
| - sh "make clean" |
41 |
| - } |
42 |
| - } |
43 |
| - } |
44 |
| - }, |
45 |
| - 'static-cross': { -> |
46 |
| - stage('Static Linux Binaries') { |
47 |
| - wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
48 |
| - try { |
49 |
| - checkout scm |
50 |
| - sh "make REF=$branch checkout" |
51 |
| - sh "make REF=$branch DOCKER_BUILD_PKGS='static-linux cross-mac cross-win' static" |
52 |
| - } finally { |
53 |
| - sh "make clean" |
54 |
| - } |
55 |
| - } |
56 |
| - } |
57 |
| - }, |
| 5 | +def pkgs = [ |
| 6 | + [target: "centos-7", image: "centos:7", arches: ["amd64", "aarch64"]], // (EOL: June 30, 2024) |
| 7 | + [target: "centos-8", image: "centos:8", arches: ["amd64", "aarch64"]], |
| 8 | + [target: "debian-buster", image: "debian:buster", arches: ["amd64", "aarch64", "armhf"]], // Debian 10 (EOL: 2024) |
| 9 | + [target: "debian-bullseye", image: "debian:bullseye", arches: ["amd64", "aarch64", "armhf"]], // Debian 11 (Next stable) |
| 10 | + [target: "fedora-33", image: "fedora:33", arches: ["amd64", "aarch64"]], // EOL: November 23, 2021 |
| 11 | + [target: "fedora-34", image: "fedora:34", arches: ["amd64", "aarch64"]], // EOL: May 17, 2022 |
| 12 | + [target: "fedora-35", image: "fedora:35", arches: ["amd64", "aarch64"]], // EOL: November 30, 2022 |
| 13 | + [target: "raspbian-buster", image: "balenalib/rpi-raspbian:buster", arches: ["armhf"]], // Debian/Raspbian 10 (EOL: 2024) |
| 14 | + [target: "raspbian-bullseye", image: "balenalib/rpi-raspbian:bullseye", arches: ["armhf"]], // Debian/Raspbian 11 (Next stable) |
| 15 | + [target: "ubuntu-bionic", image: "ubuntu:bionic", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 18.04 LTS (End of support: April, 2023. EOL: April, 2028) |
| 16 | + [target: "ubuntu-focal", image: "ubuntu:focal", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 20.04 LTS (End of support: April, 2025. EOL: April, 2030) |
| 17 | + [target: "ubuntu-hirsute", image: "ubuntu:hirsute", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 21.04 (EOL: January, 2022) |
| 18 | + [target: "ubuntu-impish", image: "ubuntu:impish", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 21.10 (EOL: July, 2022) |
58 | 19 | ]
|
59 | 20 |
|
60 |
| -parallel(test_steps) |
| 21 | +def genBuildStep(LinkedHashMap pkg, String arch) { |
| 22 | + def nodeLabel = "linux&&${arch}" |
| 23 | + def platform = "" |
| 24 | + def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME |
| 25 | + |
| 26 | + if (arch == 'armhf') { |
| 27 | + // Running armhf builds on EC2 requires --platform parameter |
| 28 | + // Otherwise it accidentally pulls armel images which then breaks the verify step |
| 29 | + platform = "--platform=linux/${arch}" |
| 30 | + nodeLabel = "${nodeLabel}&&ubuntu" |
| 31 | + } else { |
| 32 | + nodeLabel = "${nodeLabel}&&ubuntu-2004" |
| 33 | + } |
| 34 | + return { -> |
| 35 | + wrappedNode(label: nodeLabel, cleanWorkspace: true) { |
| 36 | + stage("${pkg.target}-${arch}") { |
| 37 | + // This is just a "dummy" stage to make the distro/arch visible |
| 38 | + // in Jenkins' BlueOcean view, which truncates names.... |
| 39 | + sh 'echo starting...' |
| 40 | + } |
| 41 | + stage("info") { |
| 42 | + sh 'docker version' |
| 43 | + sh 'docker info' |
| 44 | + } |
| 45 | + stage("build") { |
| 46 | + try { |
| 47 | + checkout scm |
| 48 | + sh "make REF=$branch ${pkg.target}" |
| 49 | + } finally { |
| 50 | + sh "make clean" |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +def build_package_steps = [ |
| 58 | + 'static-linux': { -> |
| 59 | + wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
| 60 | + stage("static-linux") { |
| 61 | + // This is just a "dummy" stage to make the distro/arch visible |
| 62 | + // in Jenkins' BlueOcean view, which truncates names.... |
| 63 | + sh 'echo starting...' |
| 64 | + } |
| 65 | + stage("info") { |
| 66 | + sh 'docker version' |
| 67 | + sh 'docker info' |
| 68 | + } |
| 69 | + stage("build") { |
| 70 | + try { |
| 71 | + checkout scm |
| 72 | + sh "make REF=$branch DOCKER_BUILD_PKGS='static-linux' static" |
| 73 | + } finally { |
| 74 | + sh "make clean" |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + }, |
| 79 | + 'cross-mac': { -> |
| 80 | + wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
| 81 | + stage("cross-mac") { |
| 82 | + // This is just a "dummy" stage to make the distro/arch visible |
| 83 | + // in Jenkins' BlueOcean view, which truncates names.... |
| 84 | + sh 'echo starting...' |
| 85 | + } |
| 86 | + stage("info") { |
| 87 | + sh 'docker version' |
| 88 | + sh 'docker info' |
| 89 | + } |
| 90 | + stage("build") { |
| 91 | + try { |
| 92 | + checkout scm |
| 93 | + sh "make REF=$branch DOCKER_BUILD_PKGS='cross-mac' static" |
| 94 | + } finally { |
| 95 | + sh "make clean" |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | + }, |
| 100 | + 'cross-win': { -> |
| 101 | + wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) { |
| 102 | + stage("cross-win") { |
| 103 | + // This is just a "dummy" stage to make the distro/arch visible |
| 104 | + // in Jenkins' BlueOcean view, which truncates names.... |
| 105 | + sh 'echo starting...' |
| 106 | + } |
| 107 | + stage("info") { |
| 108 | + sh 'docker version' |
| 109 | + sh 'docker info' |
| 110 | + } |
| 111 | + stage("build") { |
| 112 | + try { |
| 113 | + checkout scm |
| 114 | + sh "make REF=$branch DOCKER_BUILD_PKGS='cross-win' static" |
| 115 | + } finally { |
| 116 | + sh "make clean" |
| 117 | + } |
| 118 | + } |
| 119 | + } |
| 120 | + }, |
| 121 | +] |
| 122 | + |
| 123 | +def genPackageSteps(opts) { |
| 124 | + return opts.arches.collectEntries { |
| 125 | + ["${opts.image}-${it}": genBuildStep(opts, it)] |
| 126 | + } |
| 127 | +} |
| 128 | + |
| 129 | +build_package_steps << pkgs.collectEntries { genPackageSteps(it) } |
| 130 | + |
| 131 | +parallel(build_package_steps) |
0 commit comments