File tree 9 files changed +65
-35
lines changed
9 files changed +65
-35
lines changed Original file line number Diff line number Diff line change 263
263
changes :
264
264
- dockerfiles/ci/go.fips.Dockerfile
265
265
- dockerfiles/ci/go.fips.Dockerfile.rebuild
266
+ - dockerfiles/ci/ubi.fips.base.Dockerfile
267
+ - dockerfiles/ci/ubi.fips.base.Dockerfile.rebuild
268
+ - .gitlab/ci/prepare.gitlab-ci.yml
269
+ - .gitlab/ci/_common.gitlab-ci.yml
270
+
271
+ .rules:prepare:ubi-base:image:merge-requests :
272
+ rules :
273
+ - << : *if-runner-merge-request-pipeline
274
+ changes :
275
+ - dockerfiles/ci/ubi.fips.base.Dockerfile
276
+ - dockerfiles/ci/ubi.fips.base.Dockerfile.rebuild
266
277
- .gitlab/ci/prepare.gitlab-ci.yml
267
278
- .gitlab/ci/_common.gitlab-ci.yml
268
279
Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ prepare go fips:
82
82
prepare ubi base :
83
83
extends :
84
84
- .docker
85
- - .rules:prepare:go-fips:image:merge-requests
85
+ - .rules:prepare:ubi-base:image:merge-requests
86
+ timeout : 4h
86
87
stage : prepare
87
88
image : docker:${DOCKER_VERSION}-git
88
89
script :
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ go-fips-docker:
27
27
ubi-fips-base-docker : export UBI_VERSION ?= $(UBI_FIPS_VERSION )
28
28
ubi-fips-base-docker : export BUILD_IMAGE ?= registry.gitlab.com/gitlab-org/gitlab-runner/ubi-fips-base:$(UBI_FIPS_VERSION )
29
29
ubi-fips-base-docker : export GIT_VERSION ?= $(GIT_VERSION )
30
+ ubi-fips-base-docker : export GIT_LFS_VERSION ?= $(GIT_LFS_VERSION )
30
31
ubi-fips-base-docker : export BUILD_DOCKERFILE ?= ./dockerfiles/ci/ubi.fips.base.Dockerfile
31
32
ubi-fips-base-docker :
32
33
# Building UBI FIPS base Docker image
Original file line number Diff line number Diff line change 2
2
3
3
set -eo pipefail
4
4
5
+ # shellcheck source=ci/docker_commands
6
+ source " ci/docker_commands"
7
+
8
+ # source order is important as some functions overlap in name
5
9
source " ci/_build_ci_image_common"
6
10
7
11
build () {
8
12
echo " Building UBI FIPS base image: ${BUILD_IMAGE} "
9
- docker build \
10
- --cache-from " ${BUILD_IMAGE} " \
13
+
14
+ trap cleanup_docker_context_trap ERR SIGINT SIGTERM
15
+ setup_docker_context
16
+
17
+ _docker_buildx build \
18
+ --platform linux/amd64,linux/ppc64le,linux/arm64 \
19
+ --no-cache \
11
20
--build-arg UBI_VERSION=" ${UBI_VERSION} " \
12
21
--build-arg GIT_VERSION=" ${GIT_VERSION} " \
22
+ --build-arg GIT_LFS_VERSION=" ${GIT_LFS_VERSION} " \
23
+ --push \
13
24
-t " ${BUILD_IMAGE} " \
14
25
-f " ${BUILD_DOCKERFILE} " \
15
26
" ${GIT_ROOT} "
27
+
28
+ trap - ERR SIGINT SIGTERM
29
+ cleanup_docker_context
16
30
}
17
31
18
32
login
19
33
pull
20
34
build
21
- push
22
35
logout
23
36
scan
Original file line number Diff line number Diff line change @@ -13,11 +13,10 @@ set -eo pipefail
13
13
cd /tmp
14
14
15
15
downloadURL=" https://github.com/git-lfs/git-lfs/archive/refs/tags/v${GIT_LFS_VERSION} .tar.gz"
16
- wget " ${downloadURL} " -O git-lfs-${GIT_LFS_VERSION} .tar.gz
16
+ wget " ${downloadURL} " -O " git-lfs-${GIT_LFS_VERSION} .tar.gz"
17
17
18
- tar -xzf git-lfs-${GIT_LFS_VERSION} .tar.gz
19
- make -C git-lfs-${GIT_LFS_VERSION}
20
- cp git-lfs-${GIT_LFS_VERSION} /bin/git-lfs /usr/bin/
21
- rm -fr /tmp/*
22
- git-lfs install --skip-repo
18
+ tar -xzf " git-lfs-${GIT_LFS_VERSION} .tar.gz"
19
+ make -C " git-lfs-${GIT_LFS_VERSION} "
20
+ cp " git-lfs-${GIT_LFS_VERSION} /bin/git-lfs" /usr/bin/
21
+ rm -rf /tmp/*
23
22
git-lfs version
Original file line number Diff line number Diff line change 1
1
ARG UBI_VERSION
2
2
3
- FROM redhat/ubi8-minimal:${UBI_VERSION}
3
+ FROM redhat/ubi8-minimal:${UBI_VERSION} AS git_lfs
4
4
5
- ARG PLATFORM_ARCH=amd64
5
+ ARG GIT_LFS_VERSION
6
+ # Build git-lfs from source. This is necessary to resolve a number of CVES
7
+ # vulnerabilties reported against this image.
8
+ #
9
+ # We can probably remove this on the next release of git-lfs.
10
+ # See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/31065
11
+ COPY dockerfiles/ci/build_git_lfs /tmp/
12
+
13
+ RUN microdnf update -y && \
14
+ microdnf install -y --setopt=tsflags=nodocs \
15
+ wget make git tar gzip go && \
16
+ /tmp/build_git_lfs
17
+
18
+ FROM redhat/ubi8-minimal:${UBI_VERSION}
6
19
7
20
RUN microdnf update -y && \
8
21
microdnf install -y --setopt=tsflags=nodocs \
@@ -42,6 +55,9 @@ RUN wget https://github.com/git/git/archive/refs/tags/v${GIT_VERSION}.tar.gz &&
42
55
rm -rf /git-${GIT_VERSION} && \
43
56
microdnf remove autoconf emacs-filesystem
44
57
58
+ COPY --from=git_lfs /usr/bin/git-lfs /usr/bin
59
+ RUN git-lfs install --skip-repo
60
+
45
61
RUN cd /tmp && \
46
62
git clone https://github.com/larsks/fakeprovide.git && \
47
63
cd fakeprovide && \
Original file line number Diff line number Diff line change @@ -9,14 +9,11 @@ ENV PATH="${PATH:-/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin}"
9
9
RUN microdnf update -y && \
10
10
microdnf install -y \
11
11
bash \
12
- git-lfs \
13
12
wget \
14
13
findutils && \
15
14
wget -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \
16
15
chmod +x /usr/bin/dumb-init
17
16
18
- RUN git lfs install --skip-repo
19
-
20
17
COPY ./helpers/entrypoint /
21
18
RUN chmod +x /entrypoint
22
19
Original file line number Diff line number Diff line change 54
54
fi
55
55
wget -nv " https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION} /dumb-init_${DUMB_INIT_VERSION} _${DUMB_INIT_ARCH} " \
56
56
-O /usr/bin/dumb-init
57
- wget -nv " https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION} /git-lfs-linux-${GIT_LFS_ARCH} -v${GIT_LFS_VERSION} .tar.gz" \
58
- -O /tmp/git-lfs.tar.gz
59
- sha256sum -c -w " ${SCRIPTPATH} /checksums-${ARCH} "
57
+
58
+ if [ -n " $GIT_LFS_VERSION " ]; then
59
+ wget -nv " https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION} /git-lfs-linux-${GIT_LFS_ARCH} -v${GIT_LFS_VERSION} .tar.gz" \
60
+ -O /tmp/git-lfs.tar.gz
61
+ sha256sum -c -w " ${SCRIPTPATH} /checksums-${ARCH} "
62
+ tar -xf /tmp/git-lfs.tar.gz -C /tmp/
63
+ mv " /tmp/git-lfs-${GIT_LFS_VERSION} /git-lfs" /usr/bin/git-lfs
64
+ rm -rf /tmp/git-lfs*
65
+ git-lfs install --skip-repo
66
+ git-lfs version
67
+ fi
60
68
61
69
if [[ -f /usr/bin/docker-machine ]]; then
62
70
chmod +x /usr/bin/docker-machine
65
73
66
74
chmod +x /usr/bin/dumb-init
67
75
dumb-init --version
68
-
69
- tar -xf /tmp/git-lfs.tar.gz -C /tmp/
70
- mv /tmp/git-lfs-${GIT_LFS_VERSION} /git-lfs /usr/bin/git-lfs
71
- rm -rf /tmp/git-lfs*
72
- git-lfs install --skip-repo
73
- git-lfs version
Original file line number Diff line number Diff line change @@ -6,21 +6,11 @@ ARG TARGETPLATFORM
6
6
7
7
ARG DOCKER_MACHINE_VERSION
8
8
ARG DUMB_INIT_VERSION
9
- ARG GIT_LFS_VERSION
10
9
11
10
COPY gitlab-runner_*.rpm checksums-* install-deps install-gitlab-runner /tmp/
12
- RUN /tmp/install-deps "${TARGETPLATFORM}" "${DOCKER_MACHINE_VERSION}" "${DUMB_INIT_VERSION}" "${GIT_LFS_VERSION}"
11
+ RUN /tmp/install-deps "${TARGETPLATFORM}" "${DOCKER_MACHINE_VERSION}" "${DUMB_INIT_VERSION}"
13
12
RUN rm -rf /tmp/* /etc/gitlab-runner/.runner_system_id
14
13
15
- # Build git-lfs from source. This is necessary to resolve a number of CVES
16
- # vulnerabilties reported against this image.
17
- #
18
- # We can probably remove this on the next release of git-lfs.
19
- # See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/31065
20
- RUN microdnf install -y --setopt=tsflags=nodocs go
21
- COPY build_git_lfs /tmp/
22
- RUN /tmp/build_git_lfs
23
-
24
14
FROM $BASE_IMAGE
25
15
26
16
COPY --from=0 / /
You can’t perform that action at this time.
0 commit comments