Commit c252c4ca authored by daidekun's avatar daidekun

ansi color

parent ff1c784e
...@@ -7,8 +7,41 @@ def contextDir(workspace) { ...@@ -7,8 +7,41 @@ def contextDir(workspace) {
return contextDir return contextDir
} }
def beautyEcho(no, content) { def beautyEcho(content, type) {
echo "\033[35m===============Stage[${no}]==${content}===============\033[0m" red = "31"
green = "32"
blue = "34"
purple = "35"
darkgreen = "36"
result = ""
switch(type) {
case "info":
content = " ➢➢➢ ${content}"
result = "\033[${blue}m${content}\033[0m"
break
case "success":
content = " ✔✔✔ ${content}"
result = "\033[${green}m${content}\033[0m"
break
case "fail":
content = " ✘✘✘ ${content}"
result = "\033[${red}m${content}\033[0m"
break
case "stage":
content = " ✩✩✩✩✩✩✩✩✩✩ ${content} ✩✩✩✩✩✩✩✩✩✩"
result = "\033[${purple}m${content}\033[0m"
break
default:
result = content
break
}
return result
} }
def copyDockerFiles() { def copyDockerFiles() {
......
...@@ -33,12 +33,12 @@ def call(body) { ...@@ -33,12 +33,12 @@ def call(body) {
ansiColor('xterm') { ansiColor('xterm') {
dir (systemName) { dir (systemName) {
timestamps { timestamps {
stage('Clean') { stage('Init') {
_utils.beautyEcho(1, 'Clean') _utils.beautyEcho("Init", "stage")
} }
stage('Checkout') { stage('Checkout') {
_utils.beautyEcho(2, 'Checkout') _utils.beautyEcho("Checkout", "stage")
switch (config.buildType) { switch (config.buildType) {
case "lua-ui": case "lua-ui":
_stage.checkout_lua_ui(branchName, gitRepo) _stage.checkout_lua_ui(branchName, gitRepo)
...@@ -50,7 +50,7 @@ def call(body) { ...@@ -50,7 +50,7 @@ def call(body) {
} }
stage('Prepare') { stage('Prepare') {
_utils.beautyEcho(3, 'Prepare') _utils.beautyEcho("Prepare", "stage")
contextDir = _utils.contextDir(workspace) contextDir = _utils.contextDir(workspace)
_stage.before_prepare(contextDir) _stage.before_prepare(contextDir)
switch (config.buildType) { switch (config.buildType) {
...@@ -73,7 +73,7 @@ def call(body) { ...@@ -73,7 +73,7 @@ def call(body) {
} }
stage('Build') { stage('Build') {
_utils.beautyEcho(4, 'Build') _utils.beautyEcho("Build", "stage")
switch (config.buildType) { switch (config.buildType) {
case "java": case "java":
_stage.build_java(namespace, originSystemName, contextDir) _stage.build_java(namespace, originSystemName, contextDir)
...@@ -94,7 +94,7 @@ def call(body) { ...@@ -94,7 +94,7 @@ def call(body) {
} }
stage('Docker Build And Push') { stage('Docker Build And Push') {
_utils.beautyEcho(5, 'Docker Build And Push') _utils.beautyEcho("Docker Build And Push", "stage")
if (config.buildType == "java") { if (config.buildType == "java") {
_stage.copy_files_java(systemName, contextDir) _stage.copy_files_java(systemName, contextDir)
} }
...@@ -102,14 +102,13 @@ def call(body) { ...@@ -102,14 +102,13 @@ def call(body) {
} }
stage('Deploy') { stage('Deploy') {
def deploy_log _utils.beautyEcho("Docker Build And Push", "stage")
_utils.beautyEcho(6, 'Docker Build And Push') def deploy_log = _stage.deploy(namespace, systemName, imageTag, config.tier, isDeploy)
deploy_log = _stage.deploy(namespace, systemName, imageTag, config.tier, isDeploy) _utils.beautyEcho(deploy_log, "blue")
echo deploy_log
} }
stage("Clean") { stage("Clean") {
_utils.beautyEcho(7, 'Clean') _utils.beautyEcho("Clean", "stage")
_stage.clean_images(imageTag) _stage.clean_images(imageTag)
} }
} }
......
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