Commit de0f7f2a authored by Michal Nowak's avatar Michal Nowak Committed by Michał Kępień
Browse files

Cache Kyua

Since image building happens in special Docker-in-Docker container, we
can't use GitLab cache as-is but we need to get the extracted cache
content first to the root/context directory where Docker build will take
place and then to the image itself during the Docker build. After that
updated content is copied out of the published image to a place where it
can be cached by GitLab.
parent 58711bba
......@@ -52,9 +52,14 @@ stages:
- apk add make
.docker_image_job: &docker_image_job
cache:
key: "${CI_JOB_NAME}-kyua-${KYUA_GIT_COMMIT}"
paths:
- kyua.tar
<<: *image_job
script:
- VERSIONS="$VERSIONS" DISTROS="$DISTROS" ARCHS="$ARCHS" CI_REGISTRY_IMAGE="$CI_REGISTRY_IMAGE" KYUA_GIT_COMMIT="$KYUA_GIT_COMMIT" make -C docker/ $TARGET
- test -e kyua.tar && mkdir "docker/bind9/${DISTROS}-${VERSIONS}-${ARCHS}" && mv -v kyua.tar "docker/bind9/${DISTROS}-${VERSIONS}-${ARCHS}"
- make -C docker/ "${TARGET:-all}"
.kvm_image_job: &kvm_image_job
<<: *image_job
......
......@@ -105,6 +105,10 @@ $(TARGETS):
-e 's,@[^@]*@,,g' \
< bind9/$(VENDOR)-template/Dockerfile \
> bind9/$@/Dockerfile
touch bind9/$@/kyua.tar
docker build --no-cache -t "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)" "bind9/$@"
docker push "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)"
CONTAINER_ID=$$(docker create "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)" /bin/sh); \
docker cp "$${CONTAINER_ID}:/kyua.tar" ..; \
docker rm "$${CONTAINER_ID}"
rm -rf bind9/$@
......@@ -40,5 +40,15 @@ RUN apk add \
lua5.3-libs \
sqlite-dev
RUN if [ "@DNSTAP@" = "yes" ]; then apk add fstrm-dev protobuf-c-dev; fi
RUN mkdir /usr/src && curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src
RUN cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && ./configure --prefix /usr && make && make install && cd .. && rm -rf /usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}"
COPY kyua.tar /
RUN if [ ! -s /kyua.tar ]; then \
mkdir /usr/src && curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
tar --directory /tmp/kyua-cache-root --create --file /kyua.tar . ; \
fi
RUN tar --extract --file /kyua.tar
......@@ -63,13 +63,34 @@ RUN if [ "@VERSION@" = "centos6" ]; then cd /usr/src/dnspython-$DNSPYTHON_VERSIO
RUN if [ "@VERSION@" = "centos6" ]; then curl -sSL https://sqlite.org/2018/sqlite-autoconf-$SQLITE_VERSION.tar.gz | tar -xz -C /usr/src; fi
RUN if [ "@VERSION@" = "centos6" ]; then cd /usr/src/sqlite-autoconf-$SQLITE_VERSION && ./configure --prefix /usr && make && make install; fi
RUN if [ "@VERSION@" = "centos6" ]; then ldconfig; fi
RUN curl -sSL https://github.com/jmmv/atf/releases/download/atf-$ATF_VERSION/atf-$ATF_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/atf-$ATF_VERSION && ./configure --prefix /usr && make && make install && cd .. && rm -rf /usr/tests /usr/src/atf-$ATF_VERSION
RUN ldconfig
RUN curl -sSL https://github.com/jmmv/lutok/releases/download/lutok-$LUTOK_VERSION/lutok-$LUTOK_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/lutok-$LUTOK_VERSION && ./configure --prefix /usr && make && make install && cd .. && rm -rf /usr/tests /usr/src/lutok-$LUTOK_VERSION
RUN ldconfig
RUN curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src
RUN cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && sed -i "s|^set(|tree_set(|; s|^\(\s\+\)set<|\1tree_set<|;" model/metadata.cpp && ./configure --prefix /usr && make && make install && cd .. && rm -rf /usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}"
COPY kyua.tar /
RUN if [ ! -s /kyua.tar ]; then \
curl -sSL "https://github.com/jmmv/atf/releases/download/atf-${ATF_VERSION}/atf-${ATF_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/atf-${ATF_VERSION}" && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/atf-${ATF_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/jmmv/lutok/releases/download/lutok-${LUTOK_VERSION}/lutok-${LUTOK_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/lutok-${LUTOK_VERSION}" && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/lutok-${LUTOK_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
sed -i "s|^set(|tree_set(|; s|^\(\s\+\)set<|\1tree_set<|;" model/metadata.cpp && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
tar --directory /tmp/kyua-cache-root --create --file /kyua.tar . ; \
fi
RUN tar --extract --file /kyua.tar
RUN ldconfig
RUN mkdir /usr/local/{lib64,share}/perl5 && cpan -fi Net::DNS
......@@ -102,13 +102,34 @@ RUN if [ "@RESPDIFF@" = "yes" ]; then apt-get -y install python3-dpkt python3-lm
RUN if [ "@SHELLCHECK@" = "yes" ]; then apt-get -y install shellcheck; fi
RUN if [ "@SOFTHSM@" -ge "2" ] 2>/dev/null; then apt-get -y install libsofthsm2 softhsm2; fi
RUN if [ "@SOFTHSM@" -lt "2" ] 2>/dev/null; then apt-get -y install libsofthsm softhsm; fi
# Kyua and dependencies
RUN curl -sSL https://github.com/jmmv/atf/releases/download/atf-$ATF_VERSION/atf-$ATF_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/atf-$ATF_VERSION && autoreconf -fi && ./configure --prefix /usr && make && make install
RUN ldconfig
RUN curl -sSL https://github.com/jmmv/lutok/releases/download/lutok-$LUTOK_VERSION/lutok-$LUTOK_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/lutok-$LUTOK_VERSION && autoreconf -fi && ./configure --prefix /usr && make && make install
RUN ldconfig
RUN curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src
RUN cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && ./configure --prefix /usr && make && make install && cd .. && rm -rf /usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}"
COPY kyua.tar /
RUN if [ ! -s /kyua.tar ]; then \
curl -sSL "https://github.com/jmmv/atf/releases/download/atf-${ATF_VERSION}/atf-${ATF_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/atf-${ATF_VERSION}" && \
autoreconf -fi && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/atf-${ATF_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/jmmv/lutok/releases/download/lutok-${LUTOK_VERSION}/lutok-${LUTOK_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/lutok-${LUTOK_VERSION}" && \
autoreconf -fi && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/lutok-${LUTOK_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
./configure --prefix /usr && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
tar --directory /tmp/kyua-cache-root --create --file /kyua.tar . ; \
fi
RUN tar --extract --file /kyua.tar
RUN ldconfig
......@@ -39,6 +39,16 @@ RUN dnf -y install \
libatf-sh-devel \
lutok-devel \
sqlite-devel
RUN curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src
RUN cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && CXXFLAGS="-Wno-error=deprecated-declarations" ./configure --prefix /usr --libdir /usr/lib64 && make && make install && cd .. && rm -rf /usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}"
COPY kyua.tar /
RUN if [ ! -s /kyua.tar ]; then \
curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
CXXFLAGS="-Wno-error=deprecated-declarations" ./configure --prefix /usr --libdir /usr/lib64 && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
tar --directory /tmp/kyua-cache-root --create --file /kyua.tar . ; \
fi
RUN tar --extract --file /kyua.tar
RUN ldconfig
......@@ -38,12 +38,32 @@ RUN zypper -n install \
sqlite3-devel \
system-user-nobody \
timezone
RUN curl -sSL https://github.com/jmmv/atf/releases/download/atf-$ATF_VERSION/atf-$ATF_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/atf-$ATF_VERSION && ./configure --prefix /usr --libdir /usr/lib64 && make && make install && cd .. && rm -rf /usr/tests /usr/src/atf-$ATF_VERSION
RUN ldconfig
RUN curl -sSL https://github.com/jmmv/lutok/releases/download/lutok-$LUTOK_VERSION/lutok-$LUTOK_VERSION.tar.gz | tar -xz -C /usr/src
RUN cd /usr/src/lutok-$LUTOK_VERSION && ./configure --prefix /usr --libdir /usr/lib64 && make && make install && cd .. && rm -rf /usr/tests /usr/src/lutok-$LUTOK_VERSION
RUN ldconfig
RUN curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src
RUN cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && ./configure --prefix /usr --libdir /usr/lib64 && make && make install && cd .. && rm -rf /usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}"
COPY kyua.tar /
RUN if [ ! -s /kyua.tar ]; then \
curl -sSL "https://github.com/jmmv/atf/releases/download/atf-${ATF_VERSION}/atf-${ATF_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/atf-${ATF_VERSION}" && \
./configure --prefix /usr --libdir /usr/lib64 && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/atf-${ATF_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/jmmv/lutok/releases/download/lutok-${LUTOK_VERSION}/lutok-${LUTOK_VERSION}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/lutok-${LUTOK_VERSION}" && \
./configure --prefix /usr --libdir /usr/lib64 && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/lutok-${LUTOK_VERSION}" && \
ldconfig && \
curl -sSL "https://github.com/Mno-hime/kyua/archive/${KYUA_GIT_COMMIT}.tar.gz" | tar -xz -C /usr/src && \
cd "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
./configure --prefix /usr --libdir /usr/lib64 && \
make && \
make install && \
make install DESTDIR=/tmp/kyua-cache-root && \
cd .. && rm -rf /tmp/kyua-cache-root/usr/tests "/usr/src/kyua-${KYUA_GIT_COMMIT}" && \
tar --directory /tmp/kyua-cache-root --create --file /kyua.tar . ; \
fi
RUN tar --extract --file /kyua.tar
RUN ldconfig
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment