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
6bb14051
Commit
6bb14051
authored
Apr 02, 2018
by
wentao.suo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fff
parent
ca9c30c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
61 deletions
+142
-61
debugPipeline.groovy
vars/debugPipeline.groovy
+142
-61
No files found.
vars/debugPipeline.groovy
View file @
6bb14051
import
org.qg.docker.*
import
org.qg.docker.*
import
java.time.*
def
call
(
body
)
{
def
getTime
(){
def
config
=
[:]
LocalDateTime
t
=
LocalDateTime
.
now
();
return
t
as
String
def
env
=
body
.
env
}
def
branchName
=
env
.
BRANCH_NAME
def
call
(
body
)
{
def
gitRepo
=
env
.
GIT_REPO
def
namespace
=
env
.
NAMESPACE
def
config
=
[:]
def
isDeploy
=
env
.
IS_DEPLOY
def
buildNumber
=
env
.
BUILD_NUMBER
def
env
=
body
.
env
def
branchName
=
env
.
BRANCH_NAME
t
=
gitRepo
.
split
(
"/"
)
def
gitRepo
=
env
.
GIT_REPO
def
gitGroup
=
t
[
0
]
def
namespace
=
env
.
NAMESPACE
def
originSystemName
=
t
[
1
]
def
isDeploy
=
env
.
IS_DEPLOY
def
systemName
=
originSystemName
.
toLowerCase
()
def
buildNumber
=
env
.
BUILD_NUMBER
def
harborGroup
=
"library"
t
=
gitRepo
.
split
(
"/"
)
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def
gitGroup
=
t
[
0
]
def
originSystemName
=
t
[
1
]
def
imageTag
def
systemName
=
originSystemName
.
toLowerCase
()
def
contextDir
/*def _stage = new org.qg.docker.StageBucket()
def
harborGroup
=
"library"
def _utils = new org.qg.docker.Utils()*/
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
/* body.resolveStrategy = Closure.DELEGATE_FIRST
def
imageTag
body.delegate = config
def
timeNow
=
getTime
()
body()
def
contextDir
*/
def
_stage
=
new
org
.
qg
.
docker
.
StageBucket
()
/*pipeline {
def
_utils
=
new
org
.
qg
.
docker
.
Utils
()
agent {
body
.
resolveStrategy
=
Closure
.
DELEGATE_FIRST
docker { image '192.168.4.36/baseimg/jenkins-slave' }
body
.
delegate
=
config
}
body
()
stage('Test') {
node
{
sh 'java -version'
try
{
}
ansiColor
(
'xterm'
)
{
dir
(
systemName
)
{
timestamps
{
stage
(
'Init'
)
{
}*/
_utils
.
beautyEcho
(
"Init"
,
"stage"
)
}
/*node {
stage
(
'Checkout'
)
{
try {
_utils
.
beautyEcho
(
"Checkout"
,
"stage"
)
_utils
.
beautyEcho
(
"systemName:[${systemName}];branchName:[${branchName}]"
,
"info"
)
stage('Debug') {
switch
(
config
.
buildType
)
{
//_stage.debug()
case
"lua-ui"
:
echo "i'm in docker"
_stage
.
checkout_lua_ui
(
branchName
,
gitRepo
)
}
break
} catch (err) {
case
"nodejs"
:
if (imageTag) {
_stage
.
checkout_nodejs
(
branchName
,
systemName
)
_stage.clean_images(imageTag)
break
}
default:
currentBuild.result = 'FAILED'
_stage
.
checkout
(
branchName
,
systemName
)
throw err
break
}
}
}*/
}
}
\ No newline at end of file
stage
(
'Prepare'
)
{
_utils
.
beautyEcho
(
"Prepare"
,
"stage"
)
contextDir
=
_utils
.
contextDir
(
workspace
)
_stage
.
before_prepare
(
contextDir
)
switch
(
config
.
buildType
)
{
case
"java"
:
_stage
.
prepare_java
(
systemName
,
contextDir
)
break
case
"nodejs"
:
_stage
.
prepare_nodejs
(
systemName
,
contextDir
)
break
case
"python"
:
_stage
.
prepare_python
(
systemName
,
contextDir
)
break
case
"lua-ui"
:
_stage
.
prepare_luaui
(
systemName
,
contextDir
)
break
default:
echo
"未知的buildType: ${config.buildType}"
break
}
}
stage
(
'Build'
)
{
_utils
.
beautyEcho
(
"Build"
,
"stage"
)
switch
(
config
.
buildType
)
{
case
"java"
:
_stage
.
build_java
(
namespace
,
originSystemName
,
contextDir
)
break
case
"nodejs"
:
_stage
.
build_nodejs
(
namespace
,
originSystemName
,
contextDir
)
break
case
"python"
:
_stage
.
build_python
(
namespace
,
originSystemName
,
contextDir
)
break
case
"lua-ui"
:
_stage
.
build_luaui
(
namespace
,
originSystemName
,
contextDir
)
break
default:
echo
"未知的buildType: ${config.buildType}"
break
}
}
stage
(
'Docker Build And Push'
)
{
_utils
.
beautyEcho
(
"Docker Build And Push"
,
"stage"
)
if
(
config
.
buildType
==
"java"
)
{
_stage
.
copy_files_java
(
systemName
,
contextDir
)
}
imageTag
=
_stage
.
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
}
stage
(
'Deploy To K8s Cluster'
)
{
_utils
.
beautyEcho
(
"Deploy To K8s Cluster"
,
"stage"
)
def
deploy_log
deploy_log
=
_stage
.
deployV2
(
namespace
,
systemName
,
imageTag
,
config
.
tier
,
isDeploy
)
_utils
.
beautyEcho
(
deploy_log
,
"info"
)
}
stage
(
"Clean"
)
{
_utils
.
beautyEcho
(
"Clean"
,
"stage"
)
_stage
.
clean_images
(
imageTag
)
}
}
}
}
}
catch
(
err
)
{
ansiColor
(
'xterm'
)
{
if
(
imageTag
)
{
_stage
.
clean_images
(
imageTag
)
}
currentBuild
.
result
=
'FAILED'
_utils
.
beautyEcho
(
err
,
"fail"
)
throw
err
}
}
}
}
\ No newline at end of file
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