Leonardo Sandoval | 9dfdd1b | 2020-08-06 17:08:11 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 2 | # |
Leonardo Sandoval | 579c737 | 2020-10-23 15:23:32 -0500 | [diff] [blame] | 3 | # Copyright (c) 2019-2020 Arm Limited. All rights reserved. |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | set -e |
| 9 | |
| 10 | # Clean up filer work space if we had cloned the repository ourselves |
| 11 | |
| 12 | # On Jenkins v2, $SCRATCH_OWNER will be set to the job name and build number. If |
| 13 | # that matches with that of the current job, then remove the scratch space. |
| 14 | if [ "$SCRATCH_OWNER" = "${JOB_NAME:?}-${BUILD_NUMBER:?}" ]; then |
| 15 | rm -rf "${SCRATCH_OWNER_SPACE?:}" |
| 16 | exit 0 |
| 17 | fi |
| 18 | |
| 19 | # On Jenkins v1, $FILER_WS will be unset if we don't need to clean up |
| 20 | if [ -z "$FILER_WS" ]; then |
| 21 | exit 0 |
| 22 | fi |
| 23 | |
| 24 | rm -rf "$FILER_WS" |