Prerequisites - plugins installed:
pipeline {
agent {
label {
label 'master'
customWorkspace "${JENKINS_HOME}/${BUILD_NUMBER}/"
}
}
environment {
Go111MODULE='on'
}
stages {
stage('Clone') {
steps {
git 'https://github.com/kodekloudhub/go-webapp-sample.git'
}
}
stage('Test') {
steps {
sh 'go test ./..'
}
}
stage('Build') {
steps {
script {
app = docker.build("adminturneddevops/go-webapp-sample")
}
}
}
stage('Run') {
steps {
sh "docker run -p 8090:8000 -d adminturneddevops/go-webapp-sample"
}
}
}
}