Skip to content

Commit c63bf70

Browse files
authored
Merge pull request #5 from Bonial-International-GmbH/IN_sync-upstream
Sync with gerrit upstream repo
2 parents 27b47ba + 63b28a6 commit c63bf70

File tree

80 files changed

+1770
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1770
-437
lines changed

Pipfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ black = "~=22.3.0"
1111
docker = "~=6.0.1"
1212
pytest = "~=6.2.5"
1313
passlib = "~=1.7.4"
14-
pyopenssl = "~=22.0.0"
15-
requests = "~=2.27.1"
14+
pyopenssl = "~=22.1.0"
15+
requests = "~=2.31.0"
1616
pytest-timeout = "~=2.1.0"
1717
kubernetes = "~=21.7.0"
1818
pygit2 = "~=1.9.1"

Pipfile.lock

+224-136
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build

+100-95
Original file line numberDiff line numberDiff line change
@@ -2,130 +2,135 @@
22
BASE_IMAGE=alpine:3.16.1
33

44
usage() {
5-
me=`basename "$0"`
6-
echo >&2 "Usage: $me [--help] [--tag TAG] [--gerrit-url URL] [--base-image IMAGE] [IMAGE]"
7-
exit 1
5+
me=$(basename "$0")
6+
echo >&2 "Usage: $me [--help] [--tag TAG] [--gerrit-url URL] [--base-image IMAGE] [IMAGE]"
7+
exit 1
88
}
99

10-
while test $# -gt 0 ; do
11-
case "$1" in
12-
--help)
13-
usage
14-
;;
15-
16-
--tag)
17-
shift
18-
TAG=$1
19-
shift
20-
;;
21-
22-
--gerrit-url)
23-
shift
24-
GERRIT_WAR_URL=$1
25-
shift
26-
;;
27-
28-
--healthcheck-jar-url)
29-
shift
30-
HEALTHCHECK_JAR_URL=$1
31-
shift
32-
;;
33-
34-
--base-image)
35-
shift
36-
BASE_IMAGE=$1
37-
shift
38-
;;
39-
40-
*)
41-
break
42-
esac
10+
while test $# -gt 0; do
11+
case "$1" in
12+
--help)
13+
usage
14+
;;
15+
16+
--tag)
17+
shift
18+
TAG=$1
19+
shift
20+
;;
21+
22+
--gerrit-url)
23+
shift
24+
GERRIT_WAR_URL=$1
25+
shift
26+
;;
27+
28+
--healthcheck-jar-url)
29+
shift
30+
HEALTHCHECK_JAR_URL=$1
31+
shift
32+
;;
33+
34+
--base-image)
35+
shift
36+
BASE_IMAGE=$1
37+
shift
38+
;;
39+
40+
*)
41+
break
42+
;;
43+
esac
4344
done
4445

4546
#Get list of images
4647
source container-images/publish_list
4748
IMAGES=$(get_image_list)
4849

4950
if test -n "$GERRIT_WAR_URL"; then
50-
BUILD_ARGS="--build-arg GERRIT_WAR_URL=$GERRIT_WAR_URL"
51+
BUILD_ARGS="--build-arg GERRIT_WAR_URL=$GERRIT_WAR_URL"
5152
fi
5253

5354
if test -n "$HEALTHCHECK_JAR_URL"; then
54-
BUILD_ARGS="$BUILD_ARGS --build-arg HEALTHCHECK_JAR_URL=$HEALTHCHECK_JAR_URL"
55+
BUILD_ARGS="$BUILD_ARGS --build-arg HEALTHCHECK_JAR_URL=$HEALTHCHECK_JAR_URL"
5556
fi
5657

5758
export REV="$(git describe --always --dirty)"
5859

59-
docker_build(){
60-
IMAGE=$1
61-
62-
docker build \
63-
--platform=linux/amd64 \
64-
--build-arg TAG=$REV \
65-
-t k8sgerrit/$IMAGE:$TAG \
66-
./container-images/$IMAGE
67-
68-
if test $? -ne 0; then
69-
REPORT="$REPORT Failed: k8sgerrit/$IMAGE.\n"
70-
RETURN_CODE=1
71-
else
72-
REPORT="$REPORT Success: k8sgerrit/$IMAGE:$TAG\n"
73-
fi
60+
docker_build() {
61+
IMAGE=$1
62+
63+
docker build \
64+
--platform=linux/amd64 \
65+
--build-arg TAG=$REV \
66+
-t k8sgerrit/$IMAGE:$TAG \
67+
./container-images/$IMAGE
68+
69+
if test $? -ne 0; then
70+
REPORT="$REPORT Failed: k8sgerrit/$IMAGE.\n"
71+
RETURN_CODE=1
72+
else
73+
REPORT="$REPORT Success: k8sgerrit/$IMAGE:$TAG\n"
74+
fi
7475
}
7576

76-
docker_build_gerrit_base(){
77-
BUILD_ARGS="$BUILD_ARGS --build-arg TAG=$REV"
78-
docker build \
79-
--platform=linux/amd64 \
80-
$BUILD_ARGS \
81-
-t gerrit-base:$REV \
82-
./container-images/gerrit-base
83-
if test $? -ne 0; then
84-
echo -e "\n\nFailed to build gerrit-base image."
85-
exit 1
86-
fi
87-
88-
if test -z "$TAG"; then
89-
export TAG="$(create_image_tag)"
90-
fi
77+
docker_build_gerrit_base() {
78+
BUILD_ARGS="$BUILD_ARGS --build-arg TAG=$REV"
79+
docker build \
80+
--platform=linux/amd64 \
81+
$BUILD_ARGS \
82+
-t gerrit-base:$REV \
83+
./container-images/gerrit-base
84+
if test $? -ne 0; then
85+
echo -e "\n\nFailed to build gerrit-base image."
86+
exit 1
87+
fi
88+
89+
if test -z "$TAG"; then
90+
export TAG="$(create_image_tag)"
91+
fi
9192
}
9293

93-
create_image_tag(){
94-
GERRIT_VERSION=$(docker run --platform=linux/amd64 --entrypoint "/bin/sh" gerrit-base:$REV \
95-
-c "java -jar /var/gerrit/bin/gerrit.war version")
96-
GERRIT_VERSION=$(echo "${GERRIT_VERSION##*$'\n'}" | cut -d' ' -f3 | tr -d '[:space:]')
97-
echo "$REV-$GERRIT_VERSION"
94+
create_image_tag() {
95+
GERRIT_VERSION=$(docker run --platform=linux/amd64 --entrypoint "/bin/sh" gerrit-base:$REV \
96+
-c "java -jar /var/gerrit/bin/gerrit.war version")
97+
GERRIT_VERSION=$(echo "${GERRIT_VERSION##*$'\n'}" | cut -d' ' -f3 | tr -d '[:space:]')
98+
echo "$REV-$GERRIT_VERSION"
9899
}
99100

100101
REPORT="Build results: \n"
101102
RETURN_CODE=0
102103

103-
docker build --build-arg BASE_IMAGE="$BASE_IMAGE" --platform=linux/amd64 -t base:$REV ./container-images/base
104+
if test -n "$BASE_IMAGE"; then
105+
BASE_BUILD_ARGS="--build-arg BASE_IMAGE=$BASE_IMAGE"
106+
fi
107+
108+
docker build $BASE_BUILD_ARGS --platform=linux/amd64 -t base:$REV ./container-images/base
104109
if test $? -ne 0; then
105-
echo -e "\n\nFailed to build base image."
106-
exit 1
110+
echo -e "\n\nFailed to build base image."
111+
exit 1
107112
fi
108113

109-
if test $# -eq 0 ; then
110-
docker_build_gerrit_base
111-
for IMAGE in $IMAGES; do
112-
docker_build $IMAGE
113-
done
114+
if test $# -eq 0; then
115+
docker_build_gerrit_base
116+
for IMAGE in $IMAGES; do
117+
docker_build $IMAGE
118+
done
114119
else
115-
while test $# -gt 0 ; do
116-
if [[ $1 = gerrit-* ]]; then
117-
docker_build_gerrit_base
118-
else
119-
if test -z "$TAG"; then
120-
TAG="$(git describe --always --dirty)-unknown"
121-
fi
122-
echo -e "\nNo Image containing Gerrit will be built." \
123-
"The Gerrit-version can thus not be determinded." \
124-
"Using tag $TAG\n"
125-
fi
126-
docker_build $1
127-
shift
128-
done
120+
while test $# -gt 0; do
121+
if [[ $1 = gerrit-* ]]; then
122+
docker_build_gerrit_base
123+
else
124+
if test -z "$TAG"; then
125+
TAG="$(git describe --always --dirty)-unknown"
126+
fi
127+
echo -e "\nNo Image containing Gerrit will be built." \
128+
"The Gerrit-version can thus not be determinded." \
129+
"Using tag $TAG\n"
130+
fi
131+
docker_build $1
132+
shift
133+
done
129134
fi
130135

131136
echo -e "\n\n$REPORT"

container-images/base/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BASE_IMAGE
1+
ARG BASE_IMAGE=alpine:3.16.1
22
FROM $BASE_IMAGE
33

44
ENV LC_ALL=C.UTF-8

container-images/gerrit-base/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ RUN mkdir -p /var/gerrit/bin && \
1515
mkdir -p /var/war
1616

1717
# Download Gerrit release
18-
ARG GERRIT_WAR_URL=https://gerrit-releases.storage.googleapis.com/gerrit-3.6.2.war
18+
ARG GERRIT_WAR_URL=https://gerrit-releases.storage.googleapis.com/gerrit-3.8.0.war
1919
RUN curl -k -o /var/war/gerrit.war ${GERRIT_WAR_URL} && \
2020
ln -s /var/war/gerrit.war /var/gerrit/bin/gerrit.war
2121

2222
# Download healthcheck plugin
23-
ARG HEALTHCHECK_JAR_URL=https://gerrit-ci.gerritforge.com/view/Plugins-stable-3.6/job/plugin-healthcheck-bazel-master-stable-3.6/lastSuccessfulBuild/artifact/bazel-bin/plugins/healthcheck/healthcheck.jar
23+
ARG HEALTHCHECK_JAR_URL=https://gerrit-ci.gerritforge.com/view/Plugins-stable-3.8/job/plugin-healthcheck-bazel-master-stable-3.8/lastSuccessfulBuild/artifact/bazel-bin/plugins/healthcheck/healthcheck.jar
2424
RUN curl -k -o /var/plugins/healthcheck.jar ${HEALTHCHECK_JAR_URL} && \
2525
ln -s /var/plugins/healthcheck.jar /var/gerrit/plugins/healthcheck.jar
2626

container-images/gerrit-init/dependencies/Pipfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ verify_ssl = true
77

88
[packages]
99
pyyaml = "~=6.0"
10-
requests = "~=2.27.1"
10+
requests = "~=2.31.0"
1111

1212
[requires]
1313
python_version = "3.9"

0 commit comments

Comments
 (0)