Skip to content

Commit 5485969

Browse files
committed
Clean up test-results and package_download in all test jobs
Add a "Prepare workspace" stage to the test jobs that were missing one. Each stage now deletes and recreates test-results and package_download before executing. CMK-33087 Change-Id: I080acd44d272a256318903ca91bb0ade2526d067 (cherry picked from commit 5784737)
1 parent ddf2c2e commit 5485969

11 files changed

+104
-24
lines changed

buildscripts/scripts/test-composition-single-f12less.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void main() {
3232
// Use the directory also used by tests/testlib/containers.py to have it find
3333
// the downloaded package.
3434
def download_dir = "package_download";
35+
def result_dir = "test-results";
3536
def make_target = "test-composition-docker";
3637

3738
def setup_values = single_tests.common_prepare(
@@ -45,6 +46,13 @@ void main() {
4546
// todo: build progress mins?
4647

4748
dir("${checkout_dir}") {
49+
stage("Prepare workspace") {
50+
sh("""
51+
rm -rf ${result_dir} ${download_dir}
52+
mkdir -p ${result_dir} ${download_dir}
53+
""");
54+
}
55+
4856
stage("Fetch Checkmk package") {
4957
single_tests.fetch_package(
5058
edition: edition,
@@ -70,7 +78,7 @@ void main() {
7078
stage("Run `make ${make_target}`") {
7179
dir("${checkout_dir}/tests") {
7280
single_tests.run_make_target(
73-
result_path: "${checkout_dir}/test-results/${distro}",
81+
result_path: "${checkout_dir}/${result_dir}/${distro}",
7482
edition: edition,
7583
docker_tag: setup_values.docker_tag,
7684
version: "daily",
@@ -87,7 +95,7 @@ void main() {
8795
}
8896
} finally {
8997
stage("Archive / process test reports") {
90-
single_tests.archive_and_process_reports(test_results: "test-results/**");
98+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
9199
}
92100
}
93101
}

buildscripts/scripts/test-gui-crawl-f12less.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void main() {
2828

2929
def make_target = "test-gui-crawl-docker";
3030
def download_dir = "package_download";
31+
def result_dir = "test-results";
3132
def setup_values = single_tests.common_prepare(
3233
version: "daily",
3334
make_target: make_target,
@@ -64,6 +65,13 @@ void main() {
6465
// todo: build progress mins?
6566

6667
dir("${checkout_dir}") {
68+
stage("Prepare workspace") {
69+
sh("""
70+
rm -rf ${result_dir} ${download_dir}
71+
mkdir -p ${result_dir} ${download_dir}
72+
""");
73+
}
74+
6775
stage("Fetch Checkmk package") {
6876
single_tests.fetch_package(
6977
edition: edition,
@@ -89,7 +97,7 @@ void main() {
8997
stage("Run `make ${make_target}`") {
9098
dir("${checkout_dir}/tests") {
9199
single_tests.run_make_target(
92-
result_path: "${checkout_dir}/test-results/${distro}",
100+
result_path: "${checkout_dir}/${result_dir}/${distro}",
93101
edition: edition,
94102
docker_tag: setup_values.docker_tag,
95103
version: "daily",
@@ -105,7 +113,7 @@ void main() {
105113
}
106114
} finally {
107115
stage("Archive / process test reports") {
108-
single_tests.archive_and_process_reports(test_results: "test-results/**");
116+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
109117
}
110118
stage('archive crawler report') {
111119
xunit([

buildscripts/scripts/test-gui-e2e-f12less.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void main() {
3131

3232
def make_target = "test-gui-e2e-${edition}-docker";
3333
def download_dir = "package_download";
34+
def result_dir = "test-results";
3435

3536
def setup_values = single_tests.common_prepare(
3637
version: "daily",
@@ -43,6 +44,13 @@ void main() {
4344
// todo: build progress mins?
4445

4546
dir("${checkout_dir}") {
47+
stage("Prepare workspace") {
48+
sh("""
49+
rm -rf ${result_dir} ${download_dir}
50+
mkdir -p ${result_dir} ${download_dir}
51+
""");
52+
}
53+
4654
stage("Fetch Checkmk package") {
4755
single_tests.fetch_package(
4856
edition: edition,
@@ -68,7 +76,7 @@ void main() {
6876
stage("Run `make ${make_target}`") {
6977
dir("${checkout_dir}/tests") {
7078
single_tests.run_make_target(
71-
result_path: "${checkout_dir}/test-results/${distro}",
79+
result_path: "${checkout_dir}/${result_dir}/${distro}",
7280
edition: edition,
7381
docker_tag: setup_values.docker_tag,
7482
version: "daily",
@@ -87,7 +95,7 @@ void main() {
8795
}
8896
finally {
8997
stage("Archive / process test reports") {
90-
single_tests.archive_and_process_reports(test_results: "test-results/**");
98+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
9199
}
92100
}
93101
}

buildscripts/scripts/test-integration-single-f12less-otel.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void main() {
2323

2424
def make_target = "test-integration-otel-docker";
2525
def download_dir = "package_download";
26+
def result_dir = "test-results";
2627

2728
def setup_values = single_tests.common_prepare(
2829
version: "daily",
@@ -35,6 +36,13 @@ void main() {
3536
// todo: build progress mins?
3637

3738
dir("${checkout_dir}") {
39+
stage("Prepare workspace") {
40+
sh("""
41+
rm -rf ${result_dir} ${download_dir}
42+
mkdir -p ${result_dir} ${download_dir}
43+
""");
44+
}
45+
3846
stage("Fetch Checkmk package") {
3947
single_tests.fetch_package(
4048
edition: edition,
@@ -60,7 +68,7 @@ void main() {
6068
stage("Run `make ${make_target}`") {
6169
dir("${checkout_dir}/tests") {
6270
single_tests.run_make_target(
63-
result_path: "${checkout_dir}/test-results/${distro}",
71+
result_path: "${checkout_dir}/${result_dir}/${distro}",
6472
edition: edition,
6573
docker_tag: setup_values.docker_tag,
6674
version: "daily",
@@ -73,7 +81,7 @@ void main() {
7381
}
7482
} finally {
7583
stage("Archive / process test reports") {
76-
single_tests.archive_and_process_reports(test_results: "test-results/**");
84+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
7785
}
7886
}
7987
}

buildscripts/scripts/test-integration-single-f12less-redfish.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void main() {
2323

2424
def make_target = "test-integration-redfish-docker";
2525
def download_dir = "package_download";
26+
def result_dir = "test-results";
2627

2728
def setup_values = single_tests.common_prepare(
2829
version: "daily",
@@ -35,6 +36,13 @@ void main() {
3536
// todo: build progress mins?
3637

3738
dir("${checkout_dir}") {
39+
stage("Prepare workspace") {
40+
sh("""
41+
rm -rf ${result_dir} ${download_dir}
42+
mkdir -p ${result_dir} ${download_dir}
43+
""");
44+
}
45+
3846
stage("Fetch Checkmk package") {
3947
single_tests.fetch_package(
4048
edition: edition,
@@ -60,7 +68,7 @@ void main() {
6068
stage("Run `make ${make_target}`") {
6169
dir("${checkout_dir}/tests") {
6270
single_tests.run_make_target(
63-
result_path: "${checkout_dir}/test-results/${distro}",
71+
result_path: "${checkout_dir}/${result_dir}/${distro}",
6472
edition: edition,
6573
docker_tag: setup_values.docker_tag,
6674
version: "daily",
@@ -76,7 +84,7 @@ void main() {
7684
}
7785
} finally {
7886
stage("Archive / process test reports") {
79-
single_tests.archive_and_process_reports(test_results: "test-results/**");
87+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
8088
}
8189
}
8290
}

buildscripts/scripts/test-integration-single-f12less.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ void main() {
2424

2525
def make_target = "test-integration-docker";
2626
def download_dir = "package_download";
27+
def result_dir = "test-results";
2728

2829
def setup_values = single_tests.common_prepare(
2930
version: "daily",
@@ -36,6 +37,13 @@ void main() {
3637
// todo: build progress mins?
3738

3839
dir("${checkout_dir}") {
40+
stage("Prepare workspace") {
41+
sh("""
42+
rm -rf ${result_dir} ${download_dir}
43+
mkdir -p ${result_dir} ${download_dir}
44+
""");
45+
}
46+
3947
stage("Fetch Checkmk package") {
4048
single_tests.fetch_package(
4149
edition: edition,
@@ -61,7 +69,7 @@ void main() {
6169
stage("Run `make ${make_target}`") {
6270
dir("${checkout_dir}/tests") {
6371
single_tests.run_make_target(
64-
result_path: "${checkout_dir}/test-results/${distro}",
72+
result_path: "${checkout_dir}/${result_dir}/${distro}",
6573
edition: edition,
6674
docker_tag: setup_values.docker_tag,
6775
version: "daily",
@@ -78,7 +86,7 @@ void main() {
7886
}
7987
} finally {
8088
stage("Archive / process test reports") {
81-
single_tests.archive_and_process_reports(test_results: "test-results/**");
89+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
8290
}
8391
}
8492
}

buildscripts/scripts/test-performance.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void main() {
1111

1212
def single_tests = load("${checkout_dir}/buildscripts/scripts/utils/single_tests.groovy");
1313
def test_jenkins_helper = load("${checkout_dir}/buildscripts/scripts/utils/test_helper.groovy");
14-
def result_dir = "${checkout_dir}/results";
14+
def result_dir = "results";
1515
def distro = params.DISTRO;
1616
def edition = params.EDITION;
1717
def fake_artifacts = params.FAKE_ARTIFACTS;
@@ -30,8 +30,8 @@ void main() {
3030
dir("${checkout_dir}") {
3131
stage("Prepare workspace") {
3232
sh("""
33-
rm -rf "${result_dir}"
34-
mkdir -p "${result_dir}"
33+
rm -rf ${result_dir} ${download_dir}
34+
mkdir -p ${result_dir} ${download_dir}
3535
""");
3636
}
3737

@@ -88,7 +88,7 @@ void main() {
8888
}
8989

9090
stage("Archive / process test reports") {
91-
dir("${result_dir}") {
91+
dir("${checkout_dir}/${result_dir}") {
9292
show_duration("archiveArtifacts") {
9393
archiveArtifacts(
9494
artifacts: "**",

buildscripts/scripts/test-plugins-piggyback.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void main() {
2828

2929
def make_target = "test-plugins-piggyback-docker";
3030
def download_dir = "package_download";
31+
def result_dir = "test-results";
3132

3233
def setup_values = single_tests.common_prepare(
3334
version: "daily",
@@ -65,6 +66,13 @@ void main() {
6566
// todo: build progress mins?
6667

6768
dir("${checkout_dir}") {
69+
stage("Prepare workspace") {
70+
sh("""
71+
rm -rf ${result_dir} ${download_dir}
72+
mkdir -p ${result_dir} ${download_dir}
73+
""");
74+
}
75+
6876
stage("Fetch Checkmk package") {
6977
single_tests.fetch_package(
7078
edition: edition,
@@ -90,7 +98,7 @@ void main() {
9098
stage("Run `make ${make_target}`") {
9199
dir("${checkout_dir}/tests") {
92100
single_tests.run_make_target(
93-
result_path: "${checkout_dir}/test-results/${distro}",
101+
result_path: "${checkout_dir}/${result_dir}/${distro}",
94102
edition: edition,
95103
docker_tag: setup_values.docker_tag,
96104
version: "daily",
@@ -107,7 +115,7 @@ void main() {
107115
}
108116
finally {
109117
stage("Archive / process test reports") {
110-
single_tests.archive_and_process_reports(test_results: "test-results/**");
118+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
111119
}
112120
}
113121
}

buildscripts/scripts/test-plugins.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void main() {
2828

2929
def make_target = "test-plugins-docker";
3030
def download_dir = "package_download";
31+
def result_dir = "test-results";
3132

3233
def setup_values = single_tests.common_prepare(
3334
version: "daily",
@@ -65,6 +66,13 @@ void main() {
6566
// todo: build progress mins?
6667

6768
dir("${checkout_dir}") {
69+
stage("Prepare workspace") {
70+
sh("""
71+
rm -rf ${result_dir} ${download_dir}
72+
mkdir -p ${result_dir} ${download_dir}
73+
""");
74+
}
75+
6876
stage("Fetch Checkmk package") {
6977
single_tests.fetch_package(
7078
edition: edition,
@@ -90,7 +98,7 @@ void main() {
9098
stage("Run `make ${make_target}`") {
9199
dir("${checkout_dir}/tests") {
92100
single_tests.run_make_target(
93-
result_path: "${checkout_dir}/test-results/${distro}",
101+
result_path: "${checkout_dir}/${result_dir}/${distro}",
94102
edition: edition,
95103
docker_tag: setup_values.docker_tag,
96104
version: "daily",
@@ -107,7 +115,7 @@ void main() {
107115
}
108116
finally {
109117
stage("Archive / process test reports") {
110-
single_tests.archive_and_process_reports(test_results: "test-results/**");
118+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
111119
}
112120
}
113121
}

buildscripts/scripts/test-update-single-f12less.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void main() {
6565
}
6666
def make_target = build_make_target(edition, cross_edition_target);
6767
def download_dir = "package_download";
68+
def result_dir = "test-results";
6869

6970
def setup_values = single_tests.common_prepare(
7071
version: params.VERSION,
@@ -77,6 +78,13 @@ void main() {
7778
// todo: build progress mins?
7879

7980
dir("${checkout_dir}") {
81+
stage("Prepare workspace") {
82+
sh("""
83+
rm -rf ${result_dir} ${download_dir}
84+
mkdir -p ${result_dir} ${download_dir}
85+
""");
86+
}
87+
8088
stage("Fetch Checkmk package") {
8189
single_tests.fetch_package(
8290
// use the cross edition target or fall back to the value of edition
@@ -103,7 +111,7 @@ void main() {
103111
stage("Run `make ${make_target}`") {
104112
dir("${checkout_dir}/tests") {
105113
single_tests.run_make_target(
106-
result_path: "${checkout_dir}/test-results/${distro}",
114+
result_path: "${checkout_dir}/${result_dir}/${distro}",
107115
// use the cross edition target or fall back to the value of edition
108116
edition: cross_edition_target ?: edition,
109117
docker_tag: setup_values.docker_tag,
@@ -121,7 +129,7 @@ void main() {
121129
}
122130
} finally {
123131
stage("Archive / process test reports") {
124-
single_tests.archive_and_process_reports(test_results: "test-results/**");
132+
single_tests.archive_and_process_reports(test_results: "${result_dir}/**");
125133
}
126134
}
127135
}

0 commit comments

Comments
 (0)