Commit 5a551e39 authored by daidekun's avatar daidekun

clean

parent f38b6eec
...@@ -104,11 +104,15 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) { ...@@ -104,11 +104,15 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) {
} }
} }
def clean(contextDir, imageTag) { def clean_images(imageTag) {
sh "docker rmi -f \$(docker images -q ${imageTag})" sh "docker rmi -f \$(docker images -q ${imageTag})"
}
def clean_dir(contextDir) {
sh "rm -rf ${contextDir}" sh "rm -rf ${contextDir}"
} }
...@@ -29,6 +29,14 @@ def call(body) { ...@@ -29,6 +29,14 @@ def call(body) {
node { node {
try { try {
stage('Clean') {
_stage.clean_dir(contextDir)
}
stage('Checkout') {
_stage.checkout(branchName, gitRepo)
}
stage('prepare') { stage('prepare') {
deleteDir() deleteDir()
echo "buildType is: ${config.buildType}" echo "buildType is: ${config.buildType}"
...@@ -52,10 +60,6 @@ def call(body) { ...@@ -52,10 +60,6 @@ def call(body) {
} }
} }
stage('Checkout') {
_stage.checkout(branchName, gitRepo)
}
stage('Build') { stage('Build') {
switch (config.buildType) { switch (config.buildType) {
case "java": case "java":
...@@ -88,11 +92,11 @@ def call(body) { ...@@ -88,11 +92,11 @@ def call(body) {
} }
stage("Clean") { stage("Clean") {
_stage.clean(contextDir, imageTag) _stage.clean_images(imageTag)
} }
} catch (err) { } catch (err) {
if (imageTag) { if (imageTag) {
_stage.clean(contextDir, imageTag) _stage.clean_images(imageTag)
} }
currentBuild.result = 'FAILED' currentBuild.result = 'FAILED'
throw err throw err
......
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