Commit c252c4ca authored by daidekun's avatar daidekun

ansi color

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