From fa696e729a2ee79c3195fbda7eb79616c6752cff Mon Sep 17 00:00:00 2001 From: Will Plaut Date: Tue, 20 Oct 2020 10:42:05 -0400 Subject: [PATCH] initial jenkinsfile with bare bones functionality --- Jenkinsfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ebd4251 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,34 @@ +node() { + def checkoutInfo + def dockerjanusImage + def dockerTagName + + stage('Checkout') { + checkoutInfo = checkout scm + env.GIT_COMMIT = "${checkoutInfo.GIT_COMMIT}" + } + + if (env.TAG_NAME == null) { + dockerTagName = env.GIT_COMMIT.take(6) + } else { + dockerTagName = env.TAG_NAME + } + + gitlabBuilds(builds: ["Build", "Tag/Push"]) { + stage("Build") { + gitlabCommitStatus("Build") { + dockerjanusImage = docker.build("endpoint/docker-janus") + } + } + stage("Tag/Push") { + gitlabCommitStatus("Tag/Push") { + docker.withRegistry('https://registry.hub.docker.com', 'ep_dockerhub_creds') { + dockerjanusImage.push("${dockerTagName}") + if (env.BRANCH_NAME == 'master') { + dockerjanusImage.push('latest') + } + } + } + } + } +}