Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
node {
stage('Checkout') {
cleanWs()
sh 'git lfs install'
checkout scm
}

String version = '7.2' // platform version
String project = 'project-name' // e.g. "customer-name"
String registry = 'harbor.delivery.iqgeo.cloud'

def shortCommit = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
String buildTag = (new Date()).format('yyyyMMdd').concat("-${shortCommit}")

stage ('Build: Build Image') {
String name = "${registry}/${project}/platform-build"
String options = "-f ./deployment/dockerfile.build --pull ."

buildImage = docker.build(name, options)

docker.withRegistry("https://${registry}/", 'harbor-jenkins') {
buildImage.push("latest") // not recommended but necessary w/o local caching
buildImage.push("${version}")
buildImage.push("${version}-${buildTag}")
Comment on lines +22 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is NOT the "right" way to do this. This should be done using Tags, but, for fantastically frustrating and still unknown reasons to me, (whether it's the docker plugin version on our delivery or something about our configuration/server setup, I can't determine) the image.tagsString just doesn't seem to do what I'd expect it to.

}
}

stage('Build: Appserver - Build & Push Docker Image') {
String name = "${registry}/${project}/platform-appserver"
String options = '-f ./deployment/dockerfile.appserver --pull deployment/'

appserverImage = docker.build(name, options)

docker.withRegistry("https://${registry}/", 'harbor-jenkins') {
// appserverImage.push("latest") // not recommended
appserverImage.push("${version}")
appserverImage.push("${version}-${buildTag}")
}
}

stage('Tools - Build Docker Image') {
String name = "${registry}/${project}/platform-tools"
String options = '-f ./deployment/dockerfile.tools --pull .'

toolsImage = docker.build(name, options)

docker.withRegistry("https://${registry}/", 'harbor-jenkins') {
// toolsImage.push('latest') // not recommended
toolsImage.push("${version}")
toolsImage.push("${version}-${buildTag}")
}
}

stage('Cleanup workspace') { cleanWs() }
}