From 22da26525adb5fdac2e09b379a8c094cdb7104cd Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Tue, 17 Oct 2017 22:51:28 -0700 Subject: [PATCH] Make Container Versions Configurable 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 --- .env | 6 ++++++ docker-compose.yml | 10 +++++++--- jenkins/Dockerfile | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 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 diff --git a/docker-compose.yml b/docker-compose.yml index 88049dd..c893129 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index 139c7be..48808e1 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -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 -- 2.16.6