Skip to content

Commit 16b398a

Browse files
committed
Support ARM properly with withChownWorkspace
1 parent 1d1c8bd commit 16b398a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vars/withChownWorkspace.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ def call(Closure body=null) {
55
} finally {
66
try {
77
echo "chowning workspace"
8-
sh 'docker run --rm -v $(pwd):/workspace busybox chown -R "$(id -u):$(id -g)" /workspace'
8+
def arch = sh(script: "docker version -f '{{ .Server.Arch }}'", returnStdout: true).trim()
9+
def image = "busybox"
10+
if (arch == "arm") {
11+
image = "armhf/busybox"
12+
}
13+
sh "docker run --rm -v \$(pwd):/workspace ${image} chown -R \"\$(id -u):\$(id -g)\" /workspace"
914
} catch (Exception e) {
1015
println e
1116
}

0 commit comments

Comments
 (0)