Skip to content

Commit

Permalink
remove traces to on_dry_run_omit
Browse files Browse the repository at this point in the history
Change-Id: I088dec086ac1f4b08eead9e9922c932861ae9dbc
  • Loading branch information
Frans Fürst committed Jan 8, 2025
1 parent 2be38a5 commit efa0401
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 96 deletions.
86 changes: 40 additions & 46 deletions buildscripts/scripts/build-cmk-image.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,55 +92,49 @@ def main() {
}

smart_stage(name: 'Build Image', condition: build_image) {
on_dry_run_omit(LONG_RUNNING, "Download build sources") {
artifacts_helper.download_deb(
"${INTERNAL_DEPLOY_DEST}",
"${INTERNAL_DEPLOY_PORT}",
artifacts_helper.download_deb(
"${INTERNAL_DEPLOY_DEST}",
"${INTERNAL_DEPLOY_PORT}",
"${cmk_version_rc_aware}",
"${source_dir}",
"${EDITION}",
"jammy");
artifacts_helper.download_source_tar(
"${INTERNAL_DEPLOY_DEST}",
"${INTERNAL_DEPLOY_PORT}",
"${cmk_version_rc_aware}",
"${source_dir}",
"${EDITION}");

/// TODO: fix this:
/// build-cmk-container does not support the downloads dir
/// to have an arbitrary location, so we have to provide
/// `download` inside the checkout_dir
sh("""
scripts/run-uvenv python \
buildscripts/scripts/build-cmk-container.py \
--branch=${branch_name} \
--edition=${EDITION} \
--version=${cmk_version} \
--source_path=${source_dir} \
--set_latest_tag=${SET_LATEST_TAG} \
--set_branch_latest_tag=${SET_BRANCH_LATEST_TAG} \
--no_cache=${BUILD_IMAGE_WITHOUT_CACHE} \
--image_cmk_base=${CUSTOM_CMK_BASE_IMAGE} \
--action=build \
-vvvv
""");

def filename = versioning.get_docker_artifact_name(EDITION, cmk_version);
stage("Upload to internal registry") {
println("Uploading ${filename}");
artifacts_helper.upload_via_rsync(
"${package_dir}",
"${cmk_version_rc_aware}",
"${source_dir}",
"${EDITION}",
"jammy");
artifacts_helper.download_source_tar(
"${filename}",
"${INTERNAL_DEPLOY_DEST}",
"${INTERNAL_DEPLOY_PORT}",
"${cmk_version_rc_aware}",
"${source_dir}",
"${EDITION}");
}

on_dry_run_omit(LONG_RUNNING, "Run build-cmk-container.sh") {
/// TODO: fix this:
/// build-cmk-container does not support the downloads dir
/// to have an arbitrary location, so we have to provide
/// `download` inside the checkout_dir
sh("""
scripts/run-uvenv python \
buildscripts/scripts/build-cmk-container.py \
--branch=${branch_name} \
--edition=${EDITION} \
--version=${cmk_version} \
--source_path=${source_dir} \
--set_latest_tag=${SET_LATEST_TAG} \
--set_branch_latest_tag=${SET_BRANCH_LATEST_TAG} \
--no_cache=${BUILD_IMAGE_WITHOUT_CACHE} \
--image_cmk_base=${CUSTOM_CMK_BASE_IMAGE} \
--action=build \
-vvvv
""");
}

def filename = versioning.get_docker_artifact_name(EDITION, cmk_version);
on_dry_run_omit(LONG_RUNNING, "Upload to internal registry") {
stage("Upload to internal registry") {
println("Uploading ${filename}");
artifacts_helper.upload_via_rsync(
"${package_dir}",
"${cmk_version_rc_aware}",
"${filename}",
"${INTERNAL_DEPLOY_DEST}",
"${INTERNAL_DEPLOY_PORT}",
);
}
);
}

def perform_public_upload = true;
Expand Down
37 changes: 16 additions & 21 deletions buildscripts/scripts/test-integration-docker.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,28 @@ def main() {
}

stage('Download') {
on_dry_run_omit(LONG_RUNNING, "Download package and source") {
artifacts_helper.download_deb(
INTERNAL_DEPLOY_DEST,
INTERNAL_DEPLOY_PORT,
cmk_version_rc_aware,
"${package_dir}/${cmk_version_rc_aware}",
EDITION,
"jammy", // TODO (CMK-11568): This must be kept in sync with e.g. docker/Dockerfile
);
artifacts_helper.download_deb(
INTERNAL_DEPLOY_DEST,
INTERNAL_DEPLOY_PORT,
cmk_version_rc_aware,
"${package_dir}/${cmk_version_rc_aware}",
EDITION,
"jammy", // TODO (CMK-11568): This must be kept in sync with e.g. docker/Dockerfile
);

artifacts_helper.download_source_tar(
INTERNAL_DEPLOY_DEST,
INTERNAL_DEPLOY_PORT,
cmk_version_rc_aware,
"${package_dir}/${cmk_version_rc_aware}",
EDITION,
);
}
artifacts_helper.download_source_tar(
INTERNAL_DEPLOY_DEST,
INTERNAL_DEPLOY_PORT,
cmk_version_rc_aware,
"${package_dir}/${cmk_version_rc_aware}",
EDITION,
);
}

// TODO: don't run make-test-docker but use docker.inside() instead
stage('test cmk-docker integration') {
dir("${checkout_dir}/tests") {
def cmd = "make test-docker-docker WORKSPACE='${checkout_dir}' BRANCH='$branch_name' EDITION='$EDITION' VERSION='$cmk_version_rc_aware'";
on_dry_run_omit(LONG_RUNNING, "RUN ${cmd}") {
sh(cmd);
}
sh("make test-docker-docker WORKSPACE='${checkout_dir}' BRANCH='$branch_name' EDITION='$EDITION' VERSION='$cmk_version_rc_aware'");
}
}
}
Expand Down
29 changes: 0 additions & 29 deletions buildscripts/scripts/utils/common.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,6 @@ cleanup_directory = { directory ->
sh("mkdir -p '${directory}'");
}

/// Run a block based on a global "dry run level"
/// Global level = "0" (or unset) means "run everything"
/// Global level "1" means "avoid dangerous side effects"
/// Global level "2" means "avoid dangerous side effects and long running stuff (like builds)"
LONG_RUNNING = 1;
GLOBAL_IMPACT = 2;
on_dry_run_omit = { level, title, fn ->
if (("${global_dry_run_level}" == "0" && level <= 2) ||
("${global_dry_run_level}" == "1" && level <= 1) ||
("${global_dry_run_level}" == "2" && level <= 0)) {
/*
print(
"""
|==========================================================================================
| RUN (level=${level} DRY_RUN_LEVEL=${global_dry_run_level}): "${title}"
|==========================================================================================
""".stripMargin());
// return;
*/
return fn();
}
print(
"""
||==========================================================================================
|| OMIT(level=${level} DRY_RUN_LEVEL=${global_dry_run_level}): "${title}"
||==========================================================================================
""".stripMargin());
}

shout = { msg ->
sh("figlet -w 150 ${msg}");
}
Expand Down

0 comments on commit efa0401

Please sign in to comment.