Skip to content

Commit

Permalink
Make BOM available in Jenkins
Browse files Browse the repository at this point in the history
Currently the BOM is not shipped in the 2.4 and 2.5 builds. This was
probably introduced with the change to `Build and deploy Checkmk
deliverables`.

The BOM file is archived in build-cmk-deliverables as well

CMK-21152

Change-Id: Idff9b90b274bc776cfe038f0d40822ac5b56efa4
(cherry picked from commit ed12f1e)
  • Loading branch information
Shortfinga authored and JonasScharpf committed Jan 22, 2025
1 parent d67695a commit c7e7030
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
17 changes: 15 additions & 2 deletions buildscripts/scripts/build-cmk-bom.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ def main() {

dir("${WORKSPACE}/dependencyscanner") {
def scanner_image;
def bom_path = "${checkout_dir}/omd/bill-of-materials.json";
def relative_bom_path = "omd/bill-of-materials.json";
def bom_path = "${checkout_dir}/${relative_bom_path}";

stage("Prepare BOM") {
stage("Prepare Dependencyscanner") {
checkout([
$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
Expand All @@ -45,6 +46,7 @@ def main() {
]);
scanner_image = docker.build("dependencyscanner", "--tag dependencyscanner .");
}

stage('Create BOM') {
// Further: the BOM image does not yet have a DISTRO label...
docker.withRegistry(DOCKER_REGISTRY, 'nexus') {
Expand All @@ -66,6 +68,17 @@ def main() {
}
}
}

// remember: only one archiveArtifacts step per job allowed
dir("${checkout_dir}") {
show_duration("archiveArtifacts") {
archiveArtifacts(
artifacts: relative_bom_path,
fingerprint: true,
);
}
}

stage("Upload BOM") {
withCredentials([
string(
Expand Down
10 changes: 8 additions & 2 deletions buildscripts/scripts/build-cmk-deliverables.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def main() {
name: "Build BOM",
raiseOnError: false,
) {
smart_build(
def build_instance = smart_build(
job: "${branch_base_folder}/builders/build-cmk-bom",
parameters: [
stringParam(name: "VERSION", value: params.VERSION),
Expand All @@ -141,6 +141,12 @@ def main() {
stringParam(name: "CIPARAM_BISECT_COMMENT", value: params.CIPARAM_BISECT_COMMENT),
]
);
copyArtifacts(
projectName: build_instance.getFullProjectName(),
selector: specific(build_instance.getId()),
target: relative_deliverables_dir,
fingerprintArtifacts: true,
)
}
}
];
Expand Down Expand Up @@ -193,7 +199,7 @@ def main() {
dir("${deliverables_dir}") {
show_duration("archiveArtifacts") {
archiveArtifacts(
artifacts: "*.deb, *.rpm, *.cma, *.tar.gz, ${bazel_log_prefix}*",
artifacts: "*.deb, *.rpm, *.cma, *.tar.gz, ${bazel_log_prefix}*, **/*.json",
fingerprint: true,
);
}
Expand Down

0 comments on commit c7e7030

Please sign in to comment.