diff --git a/Dockerfile b/Dockerfile index 74fcd3d..db5c7f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,10 @@ ENV RABBITMQ_LOGS=- RABBITMQ_SASL_LOGS=- RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_tracing RUN sed -i s/'%% {load_definitions, .*"},'/'{load_definitions, "\/etc\/rabbitmq\/rabbitmq.json"}'/ /etc/rabbitmq/rabbitmq.config -ENV JAVA_VERSION=8u162 -ENV BUILD_VERSION=b12 -ENV JAVA_BUNDLE_ID=0da788060d494f5095bf8624735fa2f1 + +ENV JAVA_VERSION=8u171 +ENV BUILD_VERSION=b11 +ENV JAVA_BUNDLE_ID=512cd62ec5174c3487ac17c61aaa89e8 # ==> By uncommenting these next 6 lines, you agree to the Oracle Binary Code License Agreement for Java SE (http://www.oracle.com/technetwork/java/javase/terms/license/index.html) RUN wget -nv --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/$JAVA_BUNDLE_ID/jdk-$JAVA_VERSION-linux-x64.rpm" -O /tmp/jdk-$JAVA_VERSION-$BUILD_VERSION-linux-x64.rpm && \ yum -y install /tmp/jdk-$JAVA_VERSION-$BUILD_VERSION-linux-x64.rpm && \ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..1369868 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,77 @@ + +pipeline { + agent any + environment { + maintainer = "t" + imagename = 'r' + tag = 'l' + } + stages { + stage('Setting build context') { + steps { + script { + maintainer = maintain() + imagename = imagename() + if(env.BRANCH_NAME == "master") { + tag = "latest" + } else { + tag = env.BRANCH_NAME + } + if(!imagename){ + echo "You must define an imagename in common.bash" + currentBuild.result = 'FAILURE' + } + } + } + } + stage('Build') { + steps { + echo 'step 2' + } + } + stage('Push') { + steps { + script { + docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { + def baseImg = docker.build("$maintainer/$imagename", "--no-cache .") + baseImg.push("$tag") + } + } + } + } + stage('Notify') { + steps{ + echo "$maintainer" + slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub" + } + } + } + post { + always { + echo 'Post process.' + } + failure { + // slackSend color: 'good', message: "Build failed" + handleError("BUILD ERROR: There was a problem building ${maintainer}/${imagename}:${tag}.") + } + } +} + + +def maintain() { + def matcher = readFile('common.bash') =~ 'maintainer="(.+)"' + matcher ? matcher[0][1] : 'tier' +} + +def imagename() { + def matcher = readFile('common.bash') =~ 'imagename="(.+)"' + matcher ? matcher[0][1] : null +} + +def handleError(String message){ + echo "${message}" + currentBuild.setResult("FAILED") + slackSend color: 'danger', message: "${message}" + //step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chubing@internet2.edu', sendToIndividuals: true]) + sh 'exit 1' +} diff --git a/common.bash b/common.bash new file mode 100644 index 0000000..a8c5bcc --- /dev/null +++ b/common.bash @@ -0,0 +1,2 @@ +maintainer="tier" +imagename="rabbitmq"