Commit 2bbf8781 authored by daidekun's avatar daidekun

qgDockerPipeline

parent 8af27d83
import org.qg.*
def call(body) {
def config = [:]
def env = body.env
def branchName = env.BRANCH_NAME
def gitRepo = env.GIT_REPO
def namespace = env.NAMESPACE
def isDeploy = env.IS_DEPLOY
def buildNumber = env.BUILD_NUMBER
t = gitRepo.split("/")
def gitGroup = t[0]
def systemName = t[1]
def harborGroup = "library"
def workspace = "/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def imageTag
def contextDir
def _stage = new org.foo.Stage()
def _utils = new org.foo.Utils()
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
node {
try {
stage('Checkout') {
contextDir = _utils.contextDir(workspace)
_stage.checkout(branchName, contextDir, gitRepo)
}
stage('Build') {
_stage.build(namespace, systemName, contextDir)
}
stage('Docker Build And Push') {
imageTag = _stage.docker_build_and_push(buildNumber, branchName, contextDir)
}
stage('Deploy') {
_stage.deploy(namespace, systemName, imageTag, isDeploy)
}
stage("Clean") {
_stage.clean(contextDir)
}
} catch (err) {
currentBuild.result = 'FAILED'
throw err
}
}
}
\ No newline at end of file
import org.qg.*
def call(body) {
def config = [:]
def branchName = body.env.BRANCH_NAME
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
node {
try {
stage ('Clone') {
print branchName
}
stage ('Build') {
sh "echo 'building ${config.projectName} ...'"
}
stage ('Tests') {
parallel 'static': {
sh "echo 'shell scripts to run static tests...'"
},
'unit': {
sh "echo 'shell scripts to run unit tests...'"
},
'integration': {
sh "echo 'shell scripts to run integration tests...'"
}
}
stage ('Deploy') {
sh "echo 'deploying to server ${config.serverDomain}...'"
}
} catch (err) {
currentBuild.result = 'FAILED'
throw err
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment