Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
global-jenkinsfile
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
global-jenkinsfile
Commits
c252c4ca
Commit
c252c4ca
authored
Jan 05, 2018
by
daidekun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ansi color
parent
ff1c784e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
13 deletions
+45
-13
Utils.groovy
src/org/qg/docker/Utils.groovy
+35
-2
qgDockerPipeline.groovy
vars/qgDockerPipeline.groovy
+10
-11
No files found.
src/org/qg/docker/Utils.groovy
View file @
c252c4ca
...
@@ -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
()
{
...
...
vars/qgDockerPipeline.groovy
View file @
c252c4ca
...
@@ -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
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment