diff --git a/Jenkinsfile b/Jenkinsfile index bd700f89526..6461ebccda6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -699,12 +699,16 @@ def tearDown() { */ def fixPermissions(location) { if(isUnix()) { - sh(label: 'Fix permissions', script: """#!/usr/bin/env bash - set +x - echo "Cleaning up ${location}" - source ./dev-tools/common.bash - docker_setup - script/fix_permissions.sh ${location}""", returnStatus: true) + catchError(message: 'There were some failures when fixing the permissions', buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + timeout(5) { + sh(label: 'Fix permissions', script: """#!/usr/bin/env bash + set +x + echo "Cleaning up ${location}" + source ./dev-tools/common.bash + docker_setup + script/fix_permissions.sh ${location}""", returnStatus: true) + } + } } } diff --git a/dev-tools/common.bash b/dev-tools/common.bash index 9439e15e93d..be2bb0d71b3 100644 --- a/dev-tools/common.bash +++ b/dev-tools/common.bash @@ -106,6 +106,9 @@ docker_setup() { OS="$(uname)" case $OS in 'Darwin') + if ! command -v docker-machine ; then + echo "docker-machine is not installed but most likely docker desktop" + fi # Start the docker machine VM (ignore error if it's already running). docker-machine start default || true eval $(docker-machine env default) diff --git a/script/fix_permissions.sh b/script/fix_permissions.sh index 7bf8b162e47..48a079c46dc 100755 --- a/script/fix_permissions.sh +++ b/script/fix_permissions.sh @@ -2,7 +2,7 @@ set +e readonly LOCATION="${1?Please define the path where the fix permissions should run from}" -if ! docker version ; then +if ! docker version 2>&1 >/dev/null ; then echo "It requires Docker daemon to be installed and running" else ## Detect architecture to support ARM specific docker images. @@ -14,6 +14,7 @@ else fi set -e echo "Change ownership of all files inside the specific folder from root/root to current user/group" + set -x docker run -v "${LOCATION}":/beat ${DOCKER_IMAGE} sh -c "find /beat -user 0 -exec chown -h $(id -u):$(id -g) {} \;" fi