Skip to content

Commit 78d3a6e

Browse files
authored
Merge pull request #398 from thockin/release-3.x
Downgrade libcurl to work around HTTP bug (v3)
2 parents 4765eb5 + 3f0d678 commit 78d3a6e

File tree

3 files changed

+52
-15
lines changed

3 files changed

+52
-15
lines changed

Dockerfile.in

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,30 @@
4444
# => either add the git-sync GID or else set --root, mount a volume,
4545
# and manage volume permissions to access that volume
4646

47-
FROM {ARG_FROM}
47+
#############################################################################
48+
# First we prepare the image that we want, regardless of build layers.
49+
#############################################################################
50+
FROM {ARG_FROM} as prep
4851

4952
RUN echo "deb http://deb.debian.org/debian/ buster-backports main contrib" > \
50-
/etc/apt/sources.list.d/backports.list \
51-
&& apt update \
52-
&& apt -y upgrade \
53-
&& apt -y install \
53+
/etc/apt/sources.list.d/backports.list
54+
RUN apt-get update
55+
RUN apt-get -y upgrade
56+
RUN apt-get -y install --no-install-recommends \
5457
ca-certificates \
5558
coreutils \
5659
socat \
57-
openssh-client \
58-
&& apt -y -t buster-backports install git \
59-
&& rm -rf /var/lib/apt/lists/*
60+
openssh-client
61+
# We want a newer git than the norm.
62+
RUN apt-get -y -t buster-backports install --no-install-recommends \
63+
git
64+
# libcurl3-gnutls=7.74.0-1.2~bpo10+1 is broken. We can downgrade for now until
65+
# the fix reaches upstream.
66+
# https://github.com/kubernetes/git-sync/issues/395
67+
RUN apt-get -y install --no-install-recommends --allow-downgrades \
68+
libcurl3-gnutls:amd64=7.64.0-4+deb10u2
69+
RUN apt-get -y autoremove
70+
RUN rm -rf /var/lib/apt/lists/*
6071

6172
# By default we will run as this user...
6273
RUN echo "git-sync:x:65533:65533::/tmp:/sbin/nologin" >> /etc/passwd
@@ -73,21 +84,29 @@ RUN echo "git-sync:x:65533:git-sync" >> /etc/group
7384
# they use our git-sync group. If the user needs a different group or sets
7485
# $GIT_SYNC_ROOT or --root, their values will override this, and we assume they
7586
# are handling permissions themselves.
76-
ENV GIT_SYNC_ROOT=/tmp/git
7787
RUN mkdir -m 02775 /tmp/git && chown 65533:65533 /tmp/git
7888

89+
# Add the platform-specific binary.
90+
COPY bin/{ARG_OS}_{ARG_ARCH}/{ARG_BIN} /{ARG_BIN}
91+
92+
# Add third-party licenses.
93+
COPY .licenses/ /LICENSES/
94+
95+
#############################################################################
96+
# Now we make a "clean" final image.
97+
#############################################################################
98+
FROM scratch
99+
COPY --from=prep / /
100+
79101
# Run as non-root by default. There's simply no reason to run as root.
80102
USER 65533:65533
81103

82104
# Setting HOME ensures that whatever UID this ultimately runs as can write to
83105
# files like ~/.gitconfig.
84106
ENV HOME=/tmp
107+
WORKDIR /tmp
85108

86-
# Add the platform-specific binary.
87-
COPY bin/{ARG_OS}_{ARG_ARCH}/{ARG_BIN} /{ARG_BIN}
88-
89-
# Add third-party licenses.
90-
COPY .licenses/ /LICENSES/
109+
# Default values for flags.
110+
ENV GIT_SYNC_ROOT=/tmp/git
91111

92-
WORKDIR /tmp
93112
ENTRYPOINT ["/{ARG_BIN}"]

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ container: .container-$(DOTFILE_IMAGE) container-name
138138
Dockerfile.in > .dockerfile-$(OS)_$(ARCH)
139139
@docker buildx build \
140140
--no-cache \
141+
--progress=plain \
141142
--load \
142143
--platform "$(OS)/$(ARCH)" \
143144
--build-arg HTTP_PROXY=$(HTTP_PROXY) \

test_e2e.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,23 @@ assert_file_absent "$ROOT"/error.json
13161316
# Wrap up
13171317
pass
13181318

1319+
##############################################
1320+
# Test github HTTPS
1321+
# TODO: it would be better if we set up a local HTTPS server
1322+
##############################################
1323+
testcase "github-https"
1324+
GIT_SYNC \
1325+
--one-time \
1326+
--repo="https://github.com/kubernetes/git-sync" \
1327+
--branch=e2e-branch \
1328+
--rev=HEAD \
1329+
--root="$ROOT" \
1330+
--dest="link" \
1331+
> "$DIR"/log."$TESTCASE" 2>&1
1332+
assert_file_exists "$ROOT"/link/LICENSE
1333+
# Wrap up
1334+
pass
1335+
13191336
# Finally...
13201337
echo
13211338
echo "cleaning up $DIR"

0 commit comments

Comments
 (0)