Skip to content

Commit

Permalink
CI: resilience with the new MacOS workers (#26789) (#26820)
Browse files Browse the repository at this point in the history
(cherry picked from commit e2889bf)

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
  • Loading branch information
mergify[bot] and v1v committed Jul 12, 2021
1 parent 9c7c360 commit cd9e4c2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions dev-tools/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion script/fix_permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down

0 comments on commit cd9e4c2

Please sign in to comment.