Skip to content

Commit d9622a9

Browse files
Replace `.gradle cp-r dance with sudo chown.
1 parent 7c51d40 commit d9622a9

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

.gitlab-ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,9 @@ default:
231231
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
232232
- export GRADLE_ARGS=" --build-cache --stacktrace --no-daemon --parallel --max-workers=$GRADLE_WORKERS"
233233
- *normalize_node_index
234-
# for weird reasons, Gradle will always "chmod 700" the .gradle folder
235-
# with Gitlab caching, .gradle is always owned by root and thus Gradle's chmod invocation fails
236-
# This dance is a hack to have .gradle owned by the Gitlab runner user
237-
- gitlab_section_start "gradle-dance" "Fix .gradle directory permissions"
238-
- cp -r .gradle .gradle-copy
239-
- rm -rf .gradle
240-
- mv .gradle-copy .gradle
241-
- ls -la
242-
- gitlab_section_end "gradle-dance"
234+
# GitLab's cache helper restores .gradle as root, but we run as non-root-user (uid 1001),
235+
# and Gradle does `chmod 700 .gradle` on startup which requires user ownership.
236+
- sudo chown -R 1001:1001 .gradle
243237
after_script:
244238
- *cgroup_info
245239
- *container_info

0 commit comments

Comments
 (0)