From 0eae5af5219172a326bc0e4489c343114c2a9408 Mon Sep 17 00:00:00 2001 From: franciscoRdiaz Date: Thu, 4 Jan 2018 12:43:12 +0100 Subject: [PATCH] Add info labels to the ElasTest docker images. These labels provide the version info about ElasTest and its componentes for the users and developers - Label for the commit id - Label for the commit date - Label for component version --- Jenkinsfile | 30 ++++++++++++++++++++++-------- alluxio/Dockerfile | 10 ++++++++++ cerebro/Dockerfile | 9 +++++++++ elasticsearch/Dockerfile | 10 ++++++++++ hadoop/Dockerfile | 10 ++++++++++ kibana/Dockerfile | 10 ++++++++++ mysql/Dockerfile | 10 ++++++++++ rest-java/Dockerfile | 10 ++++++++++ 8 files changed, 91 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index da491f6..36ef91a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,7 +30,9 @@ node('docker'){ stage "Build Rest Java API image - Package" echo ("building..") // def rest_api_image = docker.build("elastest/edm:0.5","./rest-java") - def rest_api_image = docker.build("elastest/edm:latest","./rest-java") + //def rest_api_image = docker.build("elastest/edm:latest","./rest-java") + sh 'cd rest-java; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm:latest' + def rest_api_image = docker.image('elastest/edm:latest') // stage "Build Rest API image - Package" // echo ("building..") @@ -40,31 +42,43 @@ node('docker'){ echo ("building..") sh 'chmod +x alluxio/entrypoint.sh' // def alluxio_image = docker.build("elastest/edm-alluxio:0.1","./alluxio") - def alluxio_image = docker.build("elastest/edm-alluxio:latest","./alluxio") + //def alluxio_image = docker.build("elastest/edm-alluxio:latest","./alluxio") + sh 'cd alluxio; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-alluxio:latest' + def alluxio_image = docker.image('elastest/edm-alluxio:latest') stage "Build Hadoop image - Package" echo ("building..") // def hadoop_image = docker.build("elastest/edm-hadoop:0.1","./hadoop") - def hadoop_image = docker.build("elastest/edm-hadoop:latest","./hadoop") + // def hadoop_image = docker.build("elastest/edm-hadoop:latest","./hadoop") + sh 'cd hadoop; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-hadoop:latest' + def hadoop_image = docker.image('elastest/edm-hadoop:latest') stage "Build Elasticsearch image - Package" echo ("building..") // def elasticsearch_image = docker.build("elastest/edm-elasticsearch:0.1","./elasticsearch") - def elasticsearch_image = docker.build("elastest/edm-elasticsearch:latest","./elasticsearch") + //def elasticsearch_image = docker.build("elastest/edm-elasticsearch:latest","./elasticsearch") + sh 'cd elasticsearch; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-elasticsearch:latest' + def elasticsearch_image = docker.image('elastest/edm-elasticsearch:latest') stage "Build Kibana image - Package" echo ("building..") // def kibana_image = docker.build("elastest/edm-kibana:0.1","./kibana") - def kibana_image = docker.build("elastest/edm-kibana:latest","./kibana") + //def kibana_image = docker.build("elastest/edm-kibana:latest","./kibana") + sh 'cd kibana; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-kibana:latest' + def kibana_image = docker.image('elastest/edm-kibana:latest') stage "Build Cerebro image - Package" echo ("building..") // def cerebro_image = docker.build("elastest/edm-cerebro:0.1","./cerebro") - def cerebro_image = docker.build("elastest/edm-cerebro:latest","./cerebro") + //def cerebro_image = docker.build("elastest/edm-cerebro:latest","./cerebro") + sh 'cd cerebro; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-cerebro:latest' + def cerebro_image = docker.image('elastest/edm-cerebro:latest') stage "Build MySQL image - Package" - echo ("building..") - def mysql_image = docker.build("elastest/edm-mysql:latest","./mysql") + echo ("building..") + //def mysql_image = docker.build("elastest/edm-mysql:latest","./mysql") + sh 'cd mysql; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-mysql:latest' + def mysql_image = docker.image('elastest/edm-mysql:latest') // stage "Run EDM docker-compose" // sh 'chmod +x bin/* && bin/teardown-ci.sh && bin/startup-ci.sh' diff --git a/alluxio/Dockerfile b/alluxio/Dockerfile index ff78fcc..83500e3 100644 --- a/alluxio/Dockerfile +++ b/alluxio/Dockerfile @@ -11,6 +11,16 @@ FROM openjdk:7-jdk-alpine +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + RUN apk add --update bash && \ # apk add --update git && \ # apk add --update mvn && \ diff --git a/cerebro/Dockerfile b/cerebro/Dockerfile index a84627c..75f430a 100644 --- a/cerebro/Dockerfile +++ b/cerebro/Dockerfile @@ -1,5 +1,14 @@ FROM openjdk:8-jre +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION # grab gosu for easy step-down from root # ENV GOSU_VERSION 1.7 # RUN set -x \ diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 9f06626..2d89915 100644 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -1,6 +1,16 @@ # https://github.com/elastic/elasticsearch-docker FROM docker.elastic.co/elasticsearch/elasticsearch:5.4.1 +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + # Add your elasticsearch plugins setup here # Example: RUN elasticsearch-plugin install analysis-icu RUN elasticsearch-plugin remove x-pack diff --git a/hadoop/Dockerfile b/hadoop/Dockerfile index 24f9e54..1113336 100644 --- a/hadoop/Dockerfile +++ b/hadoop/Dockerfile @@ -1,5 +1,15 @@ FROM ubuntu:14.04 +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + #################### # JAVA diff --git a/kibana/Dockerfile b/kibana/Dockerfile index 34eb454..737c1f2 100644 --- a/kibana/Dockerfile +++ b/kibana/Dockerfile @@ -1,6 +1,16 @@ # https://github.com/elastic/kibana-docker FROM docker.elastic.co/kibana/kibana:5.4.1 +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + # Add your kibana plugins setup here # Example: RUN kibana-plugin install #RUN kibana-plugin install x-pack diff --git a/mysql/Dockerfile b/mysql/Dockerfile index 327ce00..b8c67dc 100644 --- a/mysql/Dockerfile +++ b/mysql/Dockerfile @@ -1,5 +1,15 @@ FROM mysql:5.7 +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + ADD init /docker-entrypoint-initdb.d/ ADD config/* /etc/mysql/conf.d/ diff --git a/rest-java/Dockerfile b/rest-java/Dockerfile index c4d4b88..a4b9744 100644 --- a/rest-java/Dockerfile +++ b/rest-java/Dockerfile @@ -1,6 +1,16 @@ FROM tomcat:8.5-jre8 MAINTAINER Savas Gioldasis (s.gioldasis@gmail.com) +# Set Image Labels +ARG GIT_COMMIT=unspecified +LABEL git_commit=$GIT_COMMIT + +ARG COMMIT_DATE=unspecified +LABEL commit_date=$COMMIT_DATE + +ARG VERSION=unspecified +LABEL version=$VERSION + # RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"] # COPY ./target/your-webapp-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war