Skip to content

Commit d09627a

Browse files
tom93nickygerritsen
authored andcommitted
Switch from CI_PRE_CLONE_SCRIPT to FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR
CI_PRE_CLONE_SCRIPT is deprecated and will be removed in GitLab 16.0 (see [1]). We use it to disable "umask 0000", which can also be done using FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR (see [2]), so switch to that. Also add a regression test. (When I was implementing the original fix using CI_PRE_CLONE_SCRIPT in #137, I did also try FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR, but it didn't seem to work. It works fine now; I think the issue at the time was due to caching, see [3].) [1]: https://docs.gitlab.com/ee/update/deprecations?removal_milestone=16.0&breaking_only=true#deprecation-and-planned-removal-for-ci_pre_clone_script-variable-on-gitlab-saas [2]: https://www.gitlab.com/gitlab-org/gitlab-runner/-/issues/1736#note_1370906098 [3]: https://www.gitlab.com/gitlab-org/gitlab/-/issues/300715
1 parent 959d73b commit d09627a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.gitlab-ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ stages:
77
- deploy
88

99
variables:
10+
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: "true" # see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1736
1011
GITLABCI_VERSION: "2.1"
1112
GITLABCI_IMAGE: "gitlabci"
12-
CI_PRE_CLONE_SCRIPT: "umask 0022" # required until feature flag FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR is set to true on GitLab.com, see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1736
1313
CONTRIBUTOR_IMAGE: "domjudge/domjudge-contributor"
1414
DOMJUDGE_VERSION:
1515
value: "M.m.pp"
1616
description: "The DOMjudge version, Change this variable to 7.3.3 to release the 7.3.3 dockers. The file should be available on the domjudge.org webserver."
1717
DOMJUDGE_LATEST:
1818
value: "true"
19-
description: "Whether this is the latest release"
19+
description: "Whether this is the latest release"
2020

2121
# Docker Login steps
2222
.release_template: &release_docker
@@ -129,5 +129,20 @@ check-pr-DOMjudge:
129129
- HUBURL="https://registry.hub.docker.com/v2/repositories/domjudge/domserver/tags"
130130
- apk add jq curl
131131
- TAG=$(curl $HUBURL|jq '.results | sort_by(.name) | .[length-2].name')
132+
- TAG=${TAG//\"}
132133
- cd docker
133-
- sh ./build.sh ${TAG//\"}
134+
- sh ./build.sh "$TAG"
135+
- |
136+
# check that there are no world-writable files
137+
# (this is mainly a regression test for FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR)
138+
# ignore symbolic links, because they always have mode "rwxrwxrwx"
139+
# ignore directories with restricted deletion flag (e.g. /tmp), because they are fine
140+
# ignore character devices (e.g. /chroot/domjudge/dev/* in image domjudge/judgehost are fine)
141+
for IMG in domserver judgehost; do
142+
files=$(docker run --rm --pull=never "domjudge/$IMG:$TAG" find / -xdev -perm -o+w ! -type l ! \( -type d -a -perm -+t \) ! -type c)
143+
if [ -n "$files" ]; then
144+
echo "error: image docker/$IMG contains world-writable files:" >&2
145+
printf "%s\n" "$files" >&2
146+
exit 1
147+
fi
148+
done

0 commit comments

Comments
 (0)