David Caro has uploaded a new change for review. Change subject: Doing proper mock cleanup ......................................................................
Doing proper mock cleanup Now it checks if there are any mounted dirs inside the chroot and tries to umount before removing. It will fail if unable to umount. Also the cleanup has been put as post-build task, so it should always run. Change-Id: I20cb54fb968556f3d1bdcf3a9ab14e826c56b352 Signed-off-by: David Caro <[email protected]> --- M jobs/confs/shell-scripts/mock_cleanup.sh M jobs/confs/yaml/builders/mock_install.yaml M jobs/confs/yaml/builders/mock_rpm.yaml A jobs/confs/yaml/publishers/mock-cleanup.yaml M jobs/confs/yaml/templates/create-rpms_mock.yaml M jobs/confs/yaml/templates/install-rpm-sanity.yaml 6 files changed, 35 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/jenkins refs/changes/97/35597/1 diff --git a/jobs/confs/shell-scripts/mock_cleanup.sh b/jobs/confs/shell-scripts/mock_cleanup.sh index f233581..c6d297d 100644 --- a/jobs/confs/shell-scripts/mock_cleanup.sh +++ b/jobs/confs/shell-scripts/mock_cleanup.sh @@ -1,9 +1,29 @@ #!/bin/bash -xe echo "shell-scripts/mock_cleanup.sh" -# remove chroot to free space -sudo rm -Rf mock mock-cache -# compress logs + + +# Archive the logs, we want them anyway pushd "$WORKSPACE"/exported-artifacts shopt -s nullglob tar cvjf logs.tbz *log *_pkgs "$WORKSPACE"/*log rm -f *log *_pkgs + +# remove chroot to free space +mock_dir="$PWD/mock" +failed=false +mounts=($(mount | awk '{{print $3}}' | grep "$mock_dir")) +if [[ "$mounts" ]]; then + echo "Found mounted dirs inside the chroot. Trying to umount." +fi +for mount in "${{mounts[@]}}"; do + umount "$mount" \ + || {{ + echo "ERROR: Failed to umount $mount. Aborting." + failed=true + }} +done +if $failed; then + echo "Aborting." + return 1 +fi +sudo rm -Rf mock mock-cache diff --git a/jobs/confs/yaml/builders/mock_install.yaml b/jobs/confs/yaml/builders/mock_install.yaml index 65cd6b8..ca449cc 100644 --- a/jobs/confs/yaml/builders/mock_install.yaml +++ b/jobs/confs/yaml/builders/mock_install.yaml @@ -6,4 +6,3 @@ - shell: !include-raw shell-scripts/build_local_srcrpm.sh - shell: !include-raw shell-scripts/mock_build_onlyrpm.sh - shell: !include-raw shell-scripts/mock_install.sh - - shell: !include-raw shell-scripts/mock_cleanup.sh diff --git a/jobs/confs/yaml/builders/mock_rpm.yaml b/jobs/confs/yaml/builders/mock_rpm.yaml index 0bb66e5..37212b5 100644 --- a/jobs/confs/yaml/builders/mock_rpm.yaml +++ b/jobs/confs/yaml/builders/mock_rpm.yaml @@ -5,7 +5,6 @@ - shell: !include-raw shell-scripts/mock_setup.sh - shell: !include-raw shell-scripts/build_local_srcrpm.sh - shell: !include-raw shell-scripts/mock_build_onlyrpm.sh - - shell: !include-raw shell-scripts/mock_cleanup.sh - builder: name: mock-onlyrpm-releng @@ -14,7 +13,6 @@ - shell: !include-raw shell-scripts/mock_setup.sh - shell: !include-raw shell-scripts/build_local_srcrpm_releng.sh - shell: !include-raw shell-scripts/mock_build_onlyrpm.sh - - shell: !include-raw shell-scripts/mock_cleanup.sh - builder: name: mock-all @@ -23,7 +21,6 @@ - shell: !include-raw shell-scripts/mock_setup.sh - shell: !include-raw shell-scripts/build_mock_srcrpm.sh - shell: !include-raw shell-scripts/mock_build_onlyrpm.sh - - shell: !include-raw shell-scripts/mock_cleanup.sh - builder: name: mock-all-releng @@ -32,4 +29,3 @@ - shell: !include-raw shell-scripts/mock_setup.sh - shell: !include-raw shell-scripts/build_mock_srcrpm_releng.sh - shell: !include-raw shell-scripts/mock_build_onlyrpm.sh - - shell: !include-raw shell-scripts/mock_cleanup.sh diff --git a/jobs/confs/yaml/publishers/mock-cleanup.yaml b/jobs/confs/yaml/publishers/mock-cleanup.yaml new file mode 100644 index 0000000..8cccca3 --- /dev/null +++ b/jobs/confs/yaml/publishers/mock-cleanup.yaml @@ -0,0 +1,9 @@ +- publisher: + name: mock-cleanup + publishers: + - post-tasks: + - matches: + - log-text: '.*' + operator: AND + escalate-status: true + script: !include-raw shell-scripts/mock_cleanup.sh diff --git a/jobs/confs/yaml/templates/create-rpms_mock.yaml b/jobs/confs/yaml/templates/create-rpms_mock.yaml index e178c9e..4b654cc 100644 --- a/jobs/confs/yaml/templates/create-rpms_mock.yaml +++ b/jobs/confs/yaml/templates/create-rpms_mock.yaml @@ -25,6 +25,7 @@ extra-repos: '{extra-repos}' extra-env: '{extra-env}' publishers: + - mock-cleanup - exported-artifacts ## Template for the releng-based jobs @@ -57,4 +58,5 @@ extra-repos: '{extra-repos}' extra-env: '{extra-env}' publishers: + - mock-cleanup - exported-artifacts diff --git a/jobs/confs/yaml/templates/install-rpm-sanity.yaml b/jobs/confs/yaml/templates/install-rpm-sanity.yaml index adfaa6e..129b90c 100644 --- a/jobs/confs/yaml/templates/install-rpm-sanity.yaml +++ b/jobs/confs/yaml/templates/install-rpm-sanity.yaml @@ -25,4 +25,5 @@ packages: '{packages}' env: '{env}' publishers: + - mock-cleanup - exported-artifacts -- To view, visit http://gerrit.ovirt.org/35597 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I20cb54fb968556f3d1bdcf3a9ab14e826c56b352 Gerrit-PatchSet: 1 Gerrit-Project: jenkins Gerrit-Branch: master Gerrit-Owner: David Caro <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
