Make Container Versions Configurable 40/7140/2
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Wed, 18 Oct 2017 05:51:28 +0000 (22:51 -0700)
committerTrevor Bramwell <tbramwell@linuxfoundation.org>
Wed, 1 Nov 2017 18:43:08 +0000 (11:43 -0700)
There is a global 'environment' file for docker-compose called '.env'
which sits in the same directory as the yaml file[1]. Besides a shell
environment, This is where default values passed to the docker-compose
command line can be stored.

By having container specific versions listed here users of
ci-management will have an eaiser time bringing up a matrix of
different infrastructure configurations.

[1] https://docs.docker.com/compose/environment-variables/#the-env-file

Change-Id: Ie2bd92376fa817b13f4eb1d123f9fca8e10b99a5
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
.env [new file with mode: 0644]
docker-compose.yml
jenkins/Dockerfile

diff --git a/.env b/.env
new file mode 100644 (file)
index 0000000..6aca8ce
--- /dev/null
+++ b/.env
@@ -0,0 +1,6 @@
+##
+# Global Options
+##
+JENKINS_CONTAINER_VERSION=lts
+GERRIT_CONTAINER_VERSION=latest
+OPENLDAP_CONTAINER_VERSION=latest
index 88049dd..c893129 100644 (file)
@@ -1,3 +1,4 @@
+# Container Versions stored in '.env'
 ---
 version: '3'
 services:
@@ -11,7 +12,7 @@ services:
             - jenkins
             - gerrit
     ldap:
-        image: osixia/openldap:latest
+        image: "osixia/openldap:$OPENLDAP_CONTAINER_VERSION"
         container_name: releng-ldap
         env_file: config.env
         command: "--loglevel debug --copy-service"
@@ -20,7 +21,10 @@ services:
         ports:
             - "636:636"
     jenkins:
-        build: ./jenkins
+        build:
+            context: ./jenkins
+            args:
+                - JENKINS_VERSION=$JENKINS_CONTAINER_VERSION
         container_name: releng-jenkins
         env_file: config.env
         environment:
@@ -45,7 +49,7 @@ services:
         environment:
             - JENKINS_SLAVE_SSH_PUBKEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUX11sDBXacCE/LBdcXO4E27OZbWtjNadXPGIRTN1leUFWJlnljlZT31Wbml8fvp+5BKbVRHP/W9IWj/PlBTxrxOPMN2Rch40tarPU1PxWJYM203n6Ac+GWKcfSPiikmfXiJ+pJHs+0E1MVhpLe08pb3qVdvwAGdQXVC53dg9ebrb5KirbLvWdEMewfVlxdB2ru2p358QN5Y7HHsAqW1sMr18G1/O5bVJl7g1JbnQ+/YjVaJRo7cDuonTOeatlEMfZZXzlermgXCcVFSIo/oKuKbtilZ2ye17ax9kN4rfVAAXIeOAUZWeCad32EdQEO7xL956ZftXyV+jlw03CndD5
     gerrit:
-        image: openfrontier/gerrit:latest
+        image: "openfrontier/gerrit:$GERRIT_CONTAINER_VERSION"
         container_name: releng-gerrit
         env_file: config.env
         environment:
index 139c7be..48808e1 100644 (file)
@@ -7,7 +7,9 @@
 # which accompanies this distribution, and is available at
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
-FROM jenkins/jenkins:lts
+ARG JENKINS_VERSION=lts
+
+FROM jenkins/jenkins:${JENKINS_VERSION}
 
 # Disable upgrade wizard
 RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state