Skip to content

Commit 4200bb4

Browse files
authored
Setup Jenkins CI (#17)
1 parent a8bccdf commit 4200bb4

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ RUN set -x \
3939
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
4040
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
4141
&& export GNUPGHOME="$(mktemp -d)" \
42-
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
43-
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
42+
&& gpg --no-tty --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
43+
&& gpg --no-tty --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
4444
&& { command -v gpgconf && gpgconf --kill all || :; } \
4545
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
4646
&& chmod +x /usr/local/bin/gosu \
@@ -174,10 +174,12 @@ RUN set -ex; \
174174
sed -ri 's/^(JVM_PATCH_VERSION)=.*/\1=25/' "$CASSANDRA_CONFIG/cassandra-env.sh"
175175

176176
# copy readiness probe script for kubernetes
177-
COPY --chown=cassandra:cassandra ready-probe.sh /
178-
177+
COPY ready-probe.sh /
179178
# Add custom logback.xml including variables.
180-
COPY --chown=cassandra:cassandra logback.xml $CASSANDRA_CONFIG/
179+
COPY logback.xml $CASSANDRA_CONFIG/
180+
181+
# Can't use COPY --chown here because it is not supported on old docker versions
182+
RUN chown cassandra:cassandra ready-probe.sh $CASSANDRA_CONFIG/logback.xml
181183

182184
COPY docker-entrypoint.sh /usr/local/bin/
183185
RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pipelineBuildDocker()

build.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,24 @@ init() {
110110
fi
111111

112112
# extract the elassandra version name
113-
ELASSANDRA_VERSION=$(echo ${PACKAGE_SRC} | sed 's/.*elassandra\-\(.*\).deb/\1/')
114-
113+
# It exists two flavor of package name : elassandra_version_all.deb and elassandra-version.deb
114+
ELASSANDRA_VERSION=$(echo ${PACKAGE_SRC} | sed 's/_all//' | sed 's/elassandra_/elassandra-/' | sed 's/.*elassandra\-\(.*\).deb/\1/')
115115
}
116116

117117

118118
#-- build the image --#
119119
build() {
120120
# setup the tmp-build directory
121121
mkdir -p tmp-build
122-
cp ${PACKAGE_SRC} tmp-build/
122+
cp ${PACKAGE_SRC} tmp-build/elassandra-${ELASSANDRA_VERSION}.deb
123123
ELASSANDRA_PACKAGE=tmp-build/elassandra-${ELASSANDRA_VERSION}.deb
124124

125+
# workaround for old docker version that does not support arg before from (such as the one installed on aks)
126+
if [ "$(docker version -f '{{.Server.Version}}' | cut -d'.' -f1)" -lt "17" ]; then
127+
sed -i 's/ARG BASE_IMAGE//g' Dockerfile
128+
sed -i 's/\${BASE_IMAGE}/'${BASE_IMAGE}'/g' Dockerfile
129+
fi
130+
125131
# build the image
126132
echo "Building docker image for ELASSANDRA_PACKAGE=$ELASSANDRA_PACKAGE"
127133
docker build --build-arg ELASSANDRA_VERSION=${ELASSANDRA_VERSION} \
@@ -198,5 +204,4 @@ tag_and_push() {
198204
push ${DOCKER_IMAGE}:${tag}
199205
}
200206

201-
main
202-
207+
main $@

0 commit comments

Comments
 (0)