osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/37506?usp=email )

Change subject: jobs/various: clean workspace on success
......................................................................

jobs/various: clean workspace on success

When investigating why space run out on build4, I found that some of the
jenkins workspaces take up a lot of space after everything is built.

If the build was successful, we don't need to keep the workspaces around
so remove them.

Examples:
* ~3 GiB: gerrit-osmo-ttcn3-hacks-build
* ~1 GiB: Osmocom_OBS_nightly
* ~1 GiB: Osmocom-build-tags-against-master
* ~1 GiB: master-osmo-bts

Change-Id: Ibedef518782ea9f68c6386f1ce7fba216e1886bc
---
M jobs/gerrit-verifications.yml
M jobs/master-builds.yml
M jobs/osmocom-build-tags-against-master.yml
M jobs/osmocom-obs-nightly-asan.yml
M jobs/osmocom-obs.yml
5 files changed, 38 insertions(+), 0 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml
index 3f7f47f..a1a7c0c 100644
--- a/jobs/gerrit-verifications.yml
+++ b/jobs/gerrit-verifications.yml
@@ -720,6 +720,8 @@

     builders:
       - shell: '{obj:cmd}'
+      # Remove workspace on success to free up space
+      - shell: 'rm -rf "$WORKSPACE"'

     publishers:
        - warnings:
diff --git a/jobs/master-builds.yml b/jobs/master-builds.yml
index ff7307c..9a5c1f7 100644
--- a/jobs/master-builds.yml
+++ b/jobs/master-builds.yml
@@ -634,6 +634,11 @@

     builders:
       - shell: '{obj:cmd}'
+      - shell: |
+          # Remove workspace on success to free up space. Create an empty dir
+          # so the job does not abort when attempting to collect artifacts.
+          rm -rf "$WORKSPACE"
+          mkdir -p "$WORKSPACE"

     publishers:
        - archive:
diff --git a/jobs/osmocom-build-tags-against-master.yml 
b/jobs/osmocom-build-tags-against-master.yml
index e33c9a3..8ae4a63 100644
--- a/jobs/osmocom-build-tags-against-master.yml
+++ b/jobs/osmocom-build-tags-against-master.yml
@@ -32,6 +32,9 @@
             -w /build \
             "$USER/debian-bookworm-build" \
             scripts/osmocom-build-old-tags-against-master.sh
+
+          # Remove workspace on success to free up space
+          rm -rf "$WORKSPACE"
     scm:
       - git:
           branches:
diff --git a/jobs/osmocom-obs-nightly-asan.yml 
b/jobs/osmocom-obs-nightly-asan.yml
index 14ddbef..a08eefd 100644
--- a/jobs/osmocom-obs-nightly-asan.yml
+++ b/jobs/osmocom-obs-nightly-asan.yml
@@ -45,6 +45,9 @@
             osmocom:nightly:asan \
             ALL_OSMOCOM_PACKAGES \
             --exclude-package $EXCLUDE_PACKAGES
+
+          # Remove workspace on success to free up space
+          rm -rf "$WORKSPACE"
     scm:
       - git:
           branches:
diff --git a/jobs/osmocom-obs.yml b/jobs/osmocom-obs.yml
index eb77f4d..e61b16b 100644
--- a/jobs/osmocom-obs.yml
+++ b/jobs/osmocom-obs.yml
@@ -42,6 +42,10 @@
             --feed {type} \
             --meta \
             osmocom:{type}
+
+          # Remove workspace on success to free up space
+          rm -rf "$WORKSPACE"
+
     scm:
       - git:
           branches:

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/37506?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ibedef518782ea9f68c6386f1ce7fba216e1886bc
Gerrit-Change-Number: 37506
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to