blob: 722ac49ab909bb411eb54770ac529715fbf912ef [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -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.
14if [ "$SCRATCH_OWNER" = "${JOB_NAME:?}-${BUILD_NUMBER:?}" ]; then
15 rm -rf "${SCRATCH_OWNER_SPACE?:}"
16 exit 0
17fi
18
19# On Jenkins v1, $FILER_WS will be unset if we don't need to clean up
20if [ -z "$FILER_WS" ]; then
21 exit 0
22fi
23
24rm -rf "$FILER_WS"