Commit c181824b authored by daidekun's avatar daidekun

推送完毕后清理镜像

parent 34afabfa
...@@ -100,7 +100,8 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) { ...@@ -100,7 +100,8 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) {
} }
} }
def clean(contextDir) { def clean(contextDir, imageTag) {
sh "docker rmi -f $(docker images -q ${imageTag})"
sh "rm -rf ${contextDir}" sh "rm -rf ${contextDir}"
} }
......
...@@ -88,9 +88,12 @@ def call(body) { ...@@ -88,9 +88,12 @@ def call(body) {
} }
stage("Clean") { stage("Clean") {
_stage.clean(contextDir) _stage.clean(contextDir, imageTag)
} }
} catch (err) { } catch (err) {
if (imageTag) {
_stage.clean(contextDir, 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