Skip to content

Commit 0fed743

Browse files
committed
Copy built artifacts of triggered jobs even if the triggered job failed
CMK-21726 Change-Id: I2c284b359f1ef3651ecbf5cd96a964da02a8c876
1 parent 4f6b822 commit 0fed743

File tree

5 files changed

+59
-9
lines changed

5 files changed

+59
-9
lines changed

buildscripts/scripts/build-cmk-deliverables.groovy

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ def main() {
9494
def stages = [
9595
"Build source package": {
9696
sleep(0.1 * timeOffsetForOrder++);
97+
def build_instance = null;
98+
9799
smart_stage(
98100
name: "Build source package",
99101
raiseOnError: false,
100102
) {
101-
def build_instance = smart_build(
103+
build_instance = smart_build(
102104
// see global-defaults.yml, needs to run in minimal container
103105
use_upstream_build: true,
104106
relative_job_name: "${branch_base_folder}/builders/build-cmk-source_tgz",
@@ -118,6 +120,12 @@ def main() {
118120
no_remove_others: true, // do not delete other files in the dest dir
119121
download: false, // use copyArtifacts to avoid nested directories
120122
);
123+
}
124+
smart_stage(
125+
name: "Copy artifacts",
126+
condition: build_instance,
127+
raiseOnError: false,
128+
) {
121129
copyArtifacts(
122130
projectName: "${branch_base_folder}/builders/build-cmk-source_tgz",
123131
selector: specific(build_instance.getId()),
@@ -128,12 +136,13 @@ def main() {
128136
},
129137
"Build BOM": {
130138
sleep(0.1 * timeOffsetForOrder++);
139+
def build_instance = null;
131140

132141
smart_stage(
133142
name: "Build BOM",
134143
raiseOnError: false,
135144
) {
136-
def build_instance = smart_build(
145+
build_instance = smart_build(
137146
// see global-defaults.yml, needs to run in minimal container
138147
use_upstream_build: true,
139148
relative_job_name: "${branch_base_folder}/builders/build-cmk-bom",
@@ -150,6 +159,12 @@ def main() {
150159
no_remove_others: true, // do not delete other files in the dest dir
151160
download: false, // use copyArtifacts to avoid nested directories
152161
);
162+
}
163+
smart_stage(
164+
name: "Copy artifacts",
165+
condition: build_instance,
166+
raiseOnError: false,
167+
) {
153168
copyArtifacts(
154169
projectName: "${branch_base_folder}/builders/build-cmk-bom",
155170
selector: specific(build_instance.getId()),
@@ -163,18 +178,20 @@ def main() {
163178
stages += all_distros.collectEntries { distro ->
164179
[("${distro}") : {
165180
sleep(0.1 * timeOffsetForOrder++);
166-
167181
def run_condition = distro in selected_distros;
182+
def build_instance = null;
183+
168184
/// this makes sure the whole parallel thread is marked as skipped
169185
if (! run_condition){
170186
Utils.markStageSkippedForConditional("${distro}");
171187
}
188+
172189
smart_stage(
173190
name: "distro package ${distro}",
174191
condition: run_condition,
175192
raiseOnError: false,
176193
) {
177-
def build_instance = smart_build(
194+
build_instance = smart_build(
178195
// see global-defaults.yml, needs to run in minimal container
179196
use_upstream_build: true,
180197
relative_job_name: "${branch_base_folder}/builders/build-cmk-distro-package",
@@ -195,6 +212,12 @@ def main() {
195212
no_remove_others: true, // do not delete other files in the dest dir
196213
download: false, // use copyArtifacts to avoid nested directories
197214
);
215+
}
216+
smart_stage(
217+
name: "Copy artifacts",
218+
condition: run_condition && build_instance,
219+
raiseOnError: false,
220+
) {
198221
copyArtifacts(
199222
projectName: "${branch_base_folder}/builders/build-cmk-distro-package",
200223
selector: specific(build_instance.getId()),

buildscripts/scripts/test-composition.groovy

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def main() {
7474
("Test ${distro}") : {
7575
def stepName = "Test ${distro}";
7676
def run_condition = distro in selected_distros;
77+
def build_instance = null;
7778

7879
/// this makes sure the whole parallel thread is marked as skipped
7980
if (! run_condition){
@@ -85,7 +86,7 @@ def main() {
8586
condition: run_condition,
8687
raiseOnError: false,
8788
) {
88-
def build_instance = smart_build(
89+
build_instance = smart_build(
8990
// see global-defaults.yml, needs to run in minimal container
9091
use_upstream_build: true,
9192
relative_job_name: relative_job_name,
@@ -103,6 +104,12 @@ def main() {
103104
no_remove_others: true, // do not delete other files in the dest dir
104105
download: false, // use copyArtifacts to avoid nested directories
105106
);
107+
}
108+
smart_stage(
109+
name: "Copy artifacts",
110+
condition: run_condition && build_instance,
111+
raiseOnError: false,
112+
) {
106113
copyArtifacts(
107114
projectName: relative_job_name,
108115
selector: specific(build_instance.getId()), // buildNumber shall be a string

buildscripts/scripts/test-gui-e2e.groovy

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def main() {
7373
("Test ${distro}") : {
7474
def stepName = "Test ${distro}";
7575
def run_condition = distro in selected_distros;
76+
def build_instance = null;
7677

7778
/// this makes sure the whole parallel thread is marked as skipped
7879
if (! run_condition){
@@ -84,7 +85,7 @@ def main() {
8485
condition: run_condition,
8586
raiseOnError: false,
8687
) {
87-
def build_instance = smart_build(
88+
build_instance = smart_build(
8889
// see global-defaults.yml, needs to run in minimal container
8990
use_upstream_build: true,
9091
relative_job_name: relative_job_name,
@@ -105,6 +106,12 @@ def main() {
105106
no_remove_others: true, // do not delete other files in the dest dir
106107
download: false, // use copyArtifacts to avoid nested directories
107108
);
109+
}
110+
smart_stage(
111+
name: "Copy artifacts",
112+
condition: run_condition && build_instance,
113+
raiseOnError: false,
114+
) {
108115
copyArtifacts(
109116
projectName: relative_job_name,
110117
selector: specific(build_instance.getId()), // buildNumber shall be a string

buildscripts/scripts/test-integration-packages.groovy

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def main() {
7979
("Test ${distro}") : {
8080
def stepName = "Test ${distro}";
8181
def run_condition = distro in selected_distros;
82+
def build_instance = null;
8283

8384
/// this makes sure the whole parallel thread is marked as skipped
8485
if (! run_condition){
@@ -90,7 +91,7 @@ def main() {
9091
condition: run_condition,
9192
raiseOnError: false,
9293
) {
93-
def build_instance = smart_build(
94+
build_instance = smart_build(
9495
// see global-defaults.yml, needs to run in minimal container
9596
use_upstream_build: true,
9697
relative_job_name: relative_job_name,
@@ -108,6 +109,12 @@ def main() {
108109
no_remove_others: true, // do not delete other files in the dest dir
109110
download: false, // use copyArtifacts to avoid nested directories
110111
);
112+
}
113+
smart_stage(
114+
name: "Copy artifacts",
115+
condition: run_condition && build_instance,
116+
raiseOnError: false,
117+
) {
111118
copyArtifacts(
112119
projectName: relative_job_name,
113120
selector: specific(build_instance.getId()), // buildNumber shall be a string

buildscripts/scripts/test-update.groovy

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def main() {
6666
("Test ${distro}") : {
6767
def stepName = "Test ${distro}";
6868
def run_condition = distro in distros;
69+
def build_instance = null;
6970

7071
if (cross_edition_target && distro != "ubuntu-22.04") {
7172
// see CMK-18366
@@ -82,7 +83,7 @@ def main() {
8283
condition: run_condition,
8384
raiseOnError: true,
8485
) {
85-
def build_instance = smart_build(
86+
build_instance = smart_build(
8687
// see global-defaults.yml, needs to run in minimal container
8788
use_upstream_build: true,
8889
relative_job_name: relative_job_name,
@@ -102,7 +103,12 @@ def main() {
102103
no_remove_others: true, // do not delete other files in the dest dir
103104
download: false, // use copyArtifacts to avoid nested directories
104105
);
105-
106+
}
107+
smart_stage(
108+
name: "Copy artifacts",
109+
condition: run_condition && build_instance,
110+
raiseOnError: false,
111+
) {
106112
copyArtifacts(
107113
projectName: relative_job_name,
108114
selector: specific(build_instance.getId()), // buildNumber shall be a string

0 commit comments

Comments
 (0)