osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/42649?usp=email )
Change subject: jobs/gerrit: fix artifacts logic ......................................................................
jobs/gerrit: fix artifacts logic
The previous logic failed when there are no artifacts for archiving, for multiple reasons. Fix all of them:
* "allow-empty" needs to be set, so jenkins doesn't fail the job when it can't find any artifacts to archive. * The "artifacts" string must not be empty even if "allow-empty" is set, as otherwise it assumes a configuration error. * The jenkins jobs fails in the archiving step if the workspace dir doesn't exist.
Fixes: 4c392b9e ("jobs/gerrit: archive osmo-ccid-firmware artifacts") Change-Id: If7a051d7be2beb617c2eda4fd1a669565c2c5b55 --- M jobs/gerrit-verifications.yml 1 file changed, 10 insertions(+), 3 deletions(-)
Approvals: fixeria: Looks good to me, but someone else must approve jolly: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified
diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index faae9b9..1177a51 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -113,7 +113,10 @@ # Range from oldest supported Debian version to newest, see: # https://gerrit.osmocom.org/c/osmo-ci/+/40861/comment/d35a8783_2a3833a4/ pipeline_binpkgs: "debian:11 debian:13" - artifacts: "" + # When using an empty string, archiving fails even if allow-empty is set: + # "ERROR: Step ‘Archive the artifacts’ failed: No artifacts are configured + # for archiving." + artifacts: "nothing"
# in alphabetical order repos: @@ -856,14 +859,18 @@
builders: - shell: '{obj:cmd}' - # Remove workspace on success to free up space + # Replace workspace with empty dir to free up space. Having an empty dir + # is required so the artifacts logic doesn't fail (even if there is + # nothing to archive). - shell: | - if [ -z "{artifacts}" ]; then + if [ "{artifacts}" = "nothing" ]; then rm -rf "$WORKSPACE" + mkdir "$WORKSPACE" fi
publishers: - archive: + allow-empty: true artifacts: '{obj:artifacts}' - warnings: console-log-parsers: