Skip to content

Commit

Permalink
Adds pipeline for source-package
Browse files Browse the repository at this point in the history
as a requirement for CMK-17193: source package had been built as a
separate stage only in `cmk-build-packages` before

Change-Id: I0c86b152126b84cc5b6512dfd7c59ef817771fd1
  • Loading branch information
Frans Fürst committed Jan 1, 2025
1 parent 28bc112 commit 9824af0
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions buildscripts/scripts/build-cmk-source_tgz.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!groovy

/// file: build-cmk-source_tgz.groovy

// todo:
// - check different editions (agents for raw?)
// - compare with source package generated by build-cmk-packages
// - check why providing agent binaries takes longer as expected

/// Creates the Checkmk source package
def main() {
check_job_parameters([
["EDITION", true],
["VERSION", true],
["DISABLE_CACHE", true],
]);

def versioning = load("${checkout_dir}/buildscripts/scripts/utils/versioning.groovy");
def package_helper = load("${checkout_dir}/buildscripts/scripts/utils/package_helper.groovy");

def edition = EDITION;
def version = VERSION;
def disable_cache = DISABLE_CACHE;
def safe_branch_name = versioning.safe_branch_name(scm);
def branch_version = versioning.get_branch_version(checkout_dir);
def cmk_version_rc_aware = versioning.get_cmk_version(safe_branch_name, branch_version, version);
def cmk_version = versioning.strip_rc_number_from_version(cmk_version_rc_aware);

print(
"""
|===== CONFIGURATION ===============================
|checkout_dir:............. │${checkout_dir}
|safe_branch_name:......... │${safe_branch_name}
|branch_version:........... │${branch_version}
|cmk_version:.............. │${cmk_version}
|edition:.................. │${edition}
|cmk_version_rc_aware:..... │${cmk_version_rc_aware}
|===================================================
""".stripMargin());

currentBuild.description += (
"""
|Edition: ${edition}<br>
|""".stripMargin());

inside_container(ulimit_nofile: 2048) {
smart_stage(name: "Prepare workspace") {
dir("${checkout_dir}") {
sh("make buildclean");
versioning.configure_checkout_folder(edition, cmk_version);
sh("make .venv");
}
}

smart_stage(name: "Provide agent binaries") {
package_helper.provide_agent_updaters(version, edition, disable_cache);
}

def source_package_name = {
dir("${checkout_dir}") {
stage("Create source package") {
withCredentials([
usernamePassword(
credentialsId: 'nexus',
passwordVariable: 'NEXUS_PASSWORD',
usernameVariable: 'NEXUS_USERNAME')
]) {
sh("make dist");
}
}
cmd_output("ls check-mk-${edition}-${cmk_version}.c?e*.tar.gz")
?:
error("Found no source package path matching ${checkout_dir}/check-mk-${edition}-${cmk_version}.c?e*.tar.gz")
}
}();

print("source_package_name: ${source_package_name}");

stage("Test source package") {
sh("""
${checkout_dir}/buildscripts/scripts/cleanup-source-archives.sh \
"${checkout_dir}/${source_package_name}"
""");
package_helper.test_package(
"${checkout_dir}/${source_package_name}",
"source",
WORKSPACE,
checkout_dir,
cmk_version);
}

stage("Archive stuff") {
dir("${checkout_dir}") {
show_duration("archiveArtifacts") {
archiveArtifacts(
artifacts: source_package_name,
fingerprint: true,
);
}
}
}
}
}

return this;

0 comments on commit 9824af0

Please sign in to comment.