You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by iv...@apache.org on 2018/02/14 15:13:27 UTC

[bookkeeper] branch master updated: Split all versions images into released and latest

This is an automated email from the ASF dual-hosted git repository.

ivank pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b3c79b  Split all versions images into released and latest
7b3c79b is described below

commit 7b3c79bcda4db92fc45fc40dfa3e9a96bf411011
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Wed Feb 14 16:13:21 2018 +0100

    Split all versions images into released and latest
    
    The released tarballs rarely change, while the latest changes every
    build. This patch splits the all version image into a base images with
    the released tarballs, and a image which includes all released and the
    very latest tarball.
    
    This allows the released image to be cached/pushed to dockerhub, which
    will in turn allow us to speed up our CI builds that use the all
    version image.
    
    Author: Ivan Kelly <iv...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #1131 from ivankelly/image-split
---
 .../all-released-versions-image}/Dockerfile        | 14 ++++---
 .../conf/supervisord.conf}                         | 46 ---------------------
 .../all-released-versions-image}/pom.xml           | 42 +++----------------
 .../scripts/install-all-tarballs.sh                | 31 ++++++++++++++
 .../scripts/install-tarball.sh                     | 47 ++++++++++++++++++++++
 .../scripts/update-conf-and-boot.sh                |  0
 tests/docker-images/all-versions-image/Dockerfile  | 31 ++++++++++++++
 .../all-versions-image}/pom.xml                    | 15 +++++--
 .../scripts/install-all-tarballs.sh                |  0
 .../scripts/update-conf-and-boot.sh                |  0
 tests/{ => docker-images}/pom.xml                  | 29 +++----------
 tests/pom.xml                                      |  2 +-
 12 files changed, 142 insertions(+), 115 deletions(-)

diff --git a/tests/docker-all-versions-image/Dockerfile b/tests/docker-images/all-released-versions-image/Dockerfile
similarity index 85%
rename from tests/docker-all-versions-image/Dockerfile
rename to tests/docker-images/all-released-versions-image/Dockerfile
index c389d2d..b0ac480 100644
--- a/tests/docker-all-versions-image/Dockerfile
+++ b/tests/docker-images/all-released-versions-image/Dockerfile
@@ -17,16 +17,16 @@
 # under the License.
 #
 
-FROM centos:7
+FROM openjdk:8-jdk
 MAINTAINER Apache BookKeeper <de...@bookkeeper.apache.org>
 
-ARG BK_TARBALL=DOESNOTEXIST
 ENV BK_JOURNALDIR=/opt/bookkeeper/data/journal
 ENV BK_LEDGERDIR=/opt/bookkeeper/data/ledgers
 ENV BK_ZKCONNECTSTRING=zookeeper1,zookeeper2,zookeeper3
 
-RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-RUN yum install -y java-1.8.0-openjdk-headless wget bash python sudo supervisor which
+RUN apt-get update && apt-get install -qy wget supervisor bash \
+    && echo "dash dash/sh boolean false" | debconf-set-selections \
+    && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
 
 RUN mkdir /tarballs
 WORKDIR /tarballs
@@ -45,14 +45,16 @@ RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.4.0/bookkee
 RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.5.0/bookkeeper-server-4.5.0-bin.tar.gz{,.sha1,.md5,.asc}
 RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.5.1/bookkeeper-server-4.5.1-bin.tar.gz{,.sha1,.md5,.asc}
 RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.6.0/bookkeeper-server-4.6.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.6.1/bookkeeper-server-4.6.1-bin.tar.gz{,.sha1,.md5,.asc}
 RUN wget -nv https://dist.apache.org/repos/dist/release/bookkeeper/KEYS
 RUN wget -nv http://svn.apache.org/repos/asf/zookeeper/bookkeeper/dist/KEYS?p=1620552 -O KEYS.old
-COPY ${BK_TARBALL} /tarballs/
 
+RUN mkdir -p /etc/supervisord/conf.d && mkdir -p /var/run/supervisor && mkdir -p /var/log/bookkeeper
+ADD conf/supervisord.conf /etc/supervisord.conf
 ADD scripts/install-all-tarballs.sh /install-all-tarballs.sh
+ADD scripts/install-tarball.sh /install-tarball.sh
 RUN bash /install-all-tarballs.sh && rm -rf /tarballs
 
 WORKDIR /
 ADD scripts/update-conf-and-boot.sh /update-conf-and-boot.sh
-RUN chmod +x /update-conf-and-boot.sh
 CMD ["/update-conf-and-boot.sh"]
\ No newline at end of file
diff --git a/tests/docker-all-versions-image/scripts/install-all-tarballs.sh b/tests/docker-images/all-released-versions-image/conf/supervisord.conf
similarity index 57%
copy from tests/docker-all-versions-image/scripts/install-all-tarballs.sh
copy to tests/docker-images/all-released-versions-image/conf/supervisord.conf
index 261bf7b..da124af 100644
--- a/tests/docker-all-versions-image/scripts/install-all-tarballs.sh
+++ b/tests/docker-images/all-released-versions-image/conf/supervisord.conf
@@ -1,5 +1,3 @@
-#!/usr/bin/env bash
-#
 #/**
 # * Licensed to the Apache Software Foundation (ASF) under one
 # * or more contributor license agreements.  See the NOTICE file
@@ -17,13 +15,6 @@
 # * See the License for the specific language governing permissions and
 # * limitations under the License.
 # */
-
-set -e
-
-BK_LOGDIR=/var/log/bookkeeper
-
-mkdir -p /etc/supervisord/conf.d
-cat > /etc/supervisord.conf <<EOF
 [supervisord]
 nodaemon=true
 logfile=/var/log/supervisord.log
@@ -45,40 +36,3 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
 
 [include]
 files = /etc/supervisord/conf.d/*.conf
-EOF
-
-set -x
-
-gpg --import KEYS
-gpg --import KEYS.old
-
-mkdir -p /opt/bookkeeper
-mkdir -p $BK_LOGDIR
-
-for T in bookkeeper-{,dist-}server-*-bin.tar.gz; do
-    if [ -f $T.sha1 ]; then
-        sha1sum --check $T.sha1 > /dev/null
-    fi
-    if [ -f $T.md5 ]; then
-        md5sum --check $T.md5 > /dev/null
-    fi
-    if [ -f $T.asc ]; then
-        gpg --verify $T.asc
-    fi
-
-    VERSION=$(echo $T | sed -nE 's!^bookkeeper-(dist-)?server-([^-]*(-SNAPSHOT)?)-bin.tar.gz$!\2!p')
-
-    tar -zxf $T
-    mv bookkeeper-server-$VERSION /opt/bookkeeper/$VERSION
-
-    cat > /etc/supervisord/conf.d/bookkeeper-$VERSION.conf <<EOF
-[program:bookkeeper-$VERSION]
-autostart=false
-redirect_stderr=true
-stdout_logfile=$BK_LOGDIR/stdout-$VERSION.log
-directory=/opt/bookkeeper/$VERSION
-command=/opt/bookkeeper/$VERSION/bin/bookkeeper bookie
-EOF
-
-done
-
diff --git a/tests/docker-all-versions-image/pom.xml b/tests/docker-images/all-released-versions-image/pom.xml
similarity index 59%
copy from tests/docker-all-versions-image/pom.xml
copy to tests/docker-images/all-released-versions-image/pom.xml
index 001199a..3e629cf 100644
--- a/tests/docker-all-versions-image/pom.xml
+++ b/tests/docker-images/all-released-versions-image/pom.xml
@@ -19,24 +19,14 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
     <groupId>org.apache.bookkeeper.tests</groupId>
-    <artifactId>tests-parent</artifactId>
+    <artifactId>docker-images</artifactId>
     <version>4.7.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.bookkeeper.tests</groupId>
-  <artifactId>docker-all-versions-image</artifactId>
-  <name>Apache BookKeeper :: Tests :: Docker All Versions Image</name>
+  <artifactId>all-released-versions-image</artifactId>
+  <name>Apache BookKeeper :: Tests :: Docker Images :: All Released Versions</name>
   <packaging>pom</packaging>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.bookkeeper</groupId>
-      <artifactId>bookkeeper-dist-server</artifactId>
-      <version>${project.parent.version}</version>
-      <classifier>bin</classifier>
-      <type>tar.gz</type>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
   <profiles>
     <profile>
       <id>docker</id>
@@ -64,37 +54,17 @@
                   <goal>tag</goal>
                 </goals>
                 <configuration>
-                  <repository>apachebookkeeper/bookkeeper-all-versions</repository>
+                  <repository>apachebookkeeper/bookkeeper-all-released-versions</repository>
                   <tag>latest</tag>
                 </configuration>
               </execution>
             </executions>
             <configuration>
-              <repository>apachebookkeeper/bookkeeper-all-versions</repository>
+              <repository>apachebookkeeper/bookkeeper-all-released-versions</repository>
               <tag>${project.version}</tag>
-              <buildArgs>
-                <BK_TARBALL>target/bookkeeper-dist-server-${project.version}-bin.tar.gz</BK_TARBALL>
-              </buildArgs>
+              <pullNewerImage>false</pullNewerImage>
             </configuration>
           </plugin>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-dependency-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>copy-tarball</id>
-                <goals>
-                  <goal>copy-dependencies</goal>
-                </goals>
-                <phase>generate-resources</phase>
-                <configuration>
-                  <outputDirectory>${project.build.directory}/</outputDirectory>
-                  <includeArtifactIds>bookkeeper-dist-server</includeArtifactIds>
-                  <excludeTransitive>true</excludeTransitive>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
         </plugins>
       </build>
     </profile>
diff --git a/tests/docker-images/all-released-versions-image/scripts/install-all-tarballs.sh b/tests/docker-images/all-released-versions-image/scripts/install-all-tarballs.sh
new file mode 100755
index 0000000..fca7bbc
--- /dev/null
+++ b/tests/docker-images/all-released-versions-image/scripts/install-all-tarballs.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+set -e
+
+gpg --import KEYS
+gpg --import KEYS.old
+
+mkdir -p /opt/bookkeeper
+
+for T in bookkeeper-server-*-bin.tar.gz; do
+    /install-tarball.sh $T
+done
+
diff --git a/tests/docker-images/all-released-versions-image/scripts/install-tarball.sh b/tests/docker-images/all-released-versions-image/scripts/install-tarball.sh
new file mode 100755
index 0000000..d4cfb59
--- /dev/null
+++ b/tests/docker-images/all-released-versions-image/scripts/install-tarball.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+set -e
+
+TARBALL=$1
+
+if [ -f $TARBALL.sha1 ]; then
+    sha1sum --check $TARBALL.sha1 > /dev/null
+fi
+if [ -f $T.md5 ]; then
+    md5sum --check $TARBALL.md5 > /dev/null
+fi
+if [ -f $T.asc ]; then
+    gpg --verify $TARBALL.asc
+fi
+
+VERSION=$(echo $TARBALL | sed -nE 's!^bookkeeper-(dist-)?server-([^-]*(-SNAPSHOT)?)-bin.tar.gz$!\2!p')
+
+tar -zxf $TARBALL
+mv bookkeeper-server-$VERSION /opt/bookkeeper/$VERSION
+
+cat > /etc/supervisord/conf.d/bookkeeper-$VERSION.conf <<EOF
+[program:bookkeeper-$VERSION]
+autostart=false
+redirect_stderr=true
+stdout_logfile=/var/log/bookkeeper/stdout-$VERSION.log
+directory=/opt/bookkeeper/$VERSION
+command=/opt/bookkeeper/$VERSION/bin/bookkeeper bookie
+EOF
diff --git a/tests/docker-all-versions-image/scripts/update-conf-and-boot.sh b/tests/docker-images/all-released-versions-image/scripts/update-conf-and-boot.sh
old mode 100644
new mode 100755
similarity index 100%
copy from tests/docker-all-versions-image/scripts/update-conf-and-boot.sh
copy to tests/docker-images/all-released-versions-image/scripts/update-conf-and-boot.sh
diff --git a/tests/docker-images/all-versions-image/Dockerfile b/tests/docker-images/all-versions-image/Dockerfile
new file mode 100644
index 0000000..8869ddf
--- /dev/null
+++ b/tests/docker-images/all-versions-image/Dockerfile
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+FROM apachebookkeeper/bookkeeper-all-released-versions:latest
+MAINTAINER Apache BookKeeper <de...@bookkeeper.apache.org>
+
+ARG BK_TARBALL=DOESNOTEXIST
+
+RUN mkdir /tarballs
+WORKDIR /tarballs
+COPY ${BK_TARBALL} /tarballs/
+
+RUN /install-tarball.sh *.tar.gz && rm -rf /tarballs
+
+WORKDIR /
+CMD ["/update-conf-and-boot.sh"]
\ No newline at end of file
diff --git a/tests/docker-all-versions-image/pom.xml b/tests/docker-images/all-versions-image/pom.xml
similarity index 88%
rename from tests/docker-all-versions-image/pom.xml
rename to tests/docker-images/all-versions-image/pom.xml
index 001199a..8839b0a 100644
--- a/tests/docker-all-versions-image/pom.xml
+++ b/tests/docker-images/all-versions-image/pom.xml
@@ -19,16 +19,23 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
     <groupId>org.apache.bookkeeper.tests</groupId>
-    <artifactId>tests-parent</artifactId>
+    <artifactId>docker-images</artifactId>
     <version>4.7.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.bookkeeper.tests</groupId>
-  <artifactId>docker-all-versions-image</artifactId>
-  <name>Apache BookKeeper :: Tests :: Docker All Versions Image</name>
+  <artifactId>all-versions-image</artifactId>
+  <name>Apache BookKeeper :: Tests :: Docker Images :: All Versions</name>
   <packaging>pom</packaging>
   <dependencies>
     <dependency>
+      <groupId>org.apache.bookkeeper.tests</groupId>
+      <artifactId>all-released-versions-image</artifactId>
+      <version>${project.parent.version}</version>
+      <type>pom</type>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-dist-server</artifactId>
       <version>${project.parent.version}</version>
@@ -72,6 +79,8 @@
             <configuration>
               <repository>apachebookkeeper/bookkeeper-all-versions</repository>
               <tag>${project.version}</tag>
+              <pullNewerImage>false</pullNewerImage>
+              <noCache>true</noCache>
               <buildArgs>
                 <BK_TARBALL>target/bookkeeper-dist-server-${project.version}-bin.tar.gz</BK_TARBALL>
               </buildArgs>
diff --git a/tests/docker-all-versions-image/scripts/install-all-tarballs.sh b/tests/docker-images/all-versions-image/scripts/install-all-tarballs.sh
similarity index 100%
rename from tests/docker-all-versions-image/scripts/install-all-tarballs.sh
rename to tests/docker-images/all-versions-image/scripts/install-all-tarballs.sh
diff --git a/tests/docker-all-versions-image/scripts/update-conf-and-boot.sh b/tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh
similarity index 100%
rename from tests/docker-all-versions-image/scripts/update-conf-and-boot.sh
rename to tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh
diff --git a/tests/pom.xml b/tests/docker-images/pom.xml
similarity index 61%
copy from tests/pom.xml
copy to tests/docker-images/pom.xml
index 550b9aa..18ea116 100644
--- a/tests/pom.xml
+++ b/tests/docker-images/pom.xml
@@ -20,32 +20,15 @@
   <packaging>pom</packaging>
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <groupId>org.apache.bookkeeper</groupId>
-    <artifactId>bookkeeper</artifactId>
+    <groupId>org.apache.bookkeeper.tests</groupId>
+    <artifactId>tests-parent</artifactId>
     <version>4.7.0-SNAPSHOT</version>
   </parent>
   <groupId>org.apache.bookkeeper.tests</groupId>
-  <artifactId>tests-parent</artifactId>
-  <name>Apache BookKeeper :: Tests</name>
+  <artifactId>docker-images</artifactId>
+  <name>Apache BookKeeper :: Tests :: Docker Images</name>
   <modules>
-    <module>shaded</module>
-    <module>docker-all-versions-image</module>
-    <module>integration-tests-base</module>
-    <module>integration-tests-base-groovy</module>
-    <module>integration-tests-utils</module>
-    <module>integration-tests-topologies</module>
-    <module>backward-compat</module>
+    <module>all-released-versions-image</module>
+    <module>all-versions-image</module>
   </modules>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-deploy-plugin</artifactId>
-        <version>${maven-deploy-plugin.version}</version>
-        <configuration>
-          <skip>true</skip>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
diff --git a/tests/pom.xml b/tests/pom.xml
index 550b9aa..f2e1d85 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -29,7 +29,7 @@
   <name>Apache BookKeeper :: Tests</name>
   <modules>
     <module>shaded</module>
-    <module>docker-all-versions-image</module>
+    <module>docker-images</module>
     <module>integration-tests-base</module>
     <module>integration-tests-base-groovy</module>
     <module>integration-tests-utils</module>

-- 
To stop receiving notification emails like this one, please contact
ivank@apache.org.