Skip to content

Commit 5afcaa2

Browse files
authored
Install git-lfs config to system rather than global (#1109) (#1111)
The upstream install script installs the config globally (scoped to the user). It is run as root, thus installed to `/root/.gitconfig` and unavailable to the jenkins user. Installing to the system, as distro packages do, makes the config available to any user (i.e. jenkins). The script currently has no way to change the scope or to opt out of the installation. The global config could be safely removed to save a few bytes, but opting for a slightly shorter Dockerfile instead.
1 parent 9a3941d commit 5afcaa2

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

alpine/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ RUN arch=$(uname -m | sed -e 's/x86_64/amd64/g' -e 's/aarch64/arm64/g') \
9494
&& curl -L -s -o git-lfs.tgz "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${arch}-v${GIT_LFS_VERSION}.tar.gz" \
9595
&& tar xzf git-lfs.tgz \
9696
&& bash git-lfs-*/install.sh \
97+
&& git lfs install --skip-repo --system \
9798
&& rm -rf git-lfs*
9899

99100
ENV JAVA_HOME=/opt/java/openjdk

debian/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ RUN arch=$(uname -m | sed -e 's/x86_64/amd64/g' -e 's/aarch64/arm64/g' -e 's/arm
104104
&& curl -L -s -o git-lfs.tgz "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${arch}-v${GIT_LFS_VERSION}.tar.gz" \
105105
&& tar xzf git-lfs.tgz \
106106
&& bash git-lfs-*/install.sh \
107+
&& git lfs install --skip-repo --system \
107108
&& rm -rf git-lfs*
108109

109110
ENV LANG=C.UTF-8

rhel/ubi9/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ RUN arch=$(uname -m | sed -e 's/x86_64/amd64/g' -e 's/aarch64/arm64/g') \
6868
&& curl -L -s -o git-lfs.tgz "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${arch}-v${GIT_LFS_VERSION}.tar.gz" \
6969
&& tar xzf git-lfs.tgz \
7070
&& bash git-lfs-*/install.sh \
71+
&& git lfs install --skip-repo --system \
7172
&& rm -rf git-lfs*
7273

7374
ENV LANG=C.UTF-8

tests/tests_agent.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ GIT_LFS_VERSION='3.7.1'
6565
assert_success
6666
run docker exec "${cid}" git lfs env
6767
assert_output --partial "${GIT_LFS_VERSION}"
68+
refute_output --regexp 'git config filter\.lfs\.\w+ = ""'
6869

6970
run docker exec "${cid}" sh -c "printenv | grep AGENT_WORKDIR"
7071
assert_equal "${output}" "AGENT_WORKDIR=/home/jenkins/agent"

0 commit comments

Comments
 (0)