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
7dab6b08
Commit
7dab6b08
authored
Apr 04, 2018
by
wentao.suo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fffff
parent
5bfa4100
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
52 deletions
+85
-52
StageBucket.groovy
src/org/qg/docker_new/StageBucket.groovy
+81
-44
qgDockerPiplineWithDockerSlave.groovy
vars/qgDockerPiplineWithDockerSlave.groovy
+4
-8
No files found.
src/org/qg/docker_new/StageBucket.groovy
View file @
7dab6b08
...
@@ -83,20 +83,43 @@ def prepare_python(systemName, contextDir) {
...
@@ -83,20 +83,43 @@ def prepare_python(systemName, contextDir) {
sh
"cp -rf /home/quant_group/config_repository/python/${systemName}.ini ${contextDir}/config.ini"
sh
"cp -rf /home/quant_group/config_repository/python/${systemName}.ini ${contextDir}/config.ini"
}
}
def
checkout
(
git_path
,
branchName
)
{
def
checkout
(
buildType
,
systemName
,
branchName
)
{
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git_path
def
projectAttr
=
project_attr
(
systemName
)
def
gitPath
=
projectAttr
[
"gitPath"
]
switch
(
buildType
){
case
"java"
:
build_java
(
gitPath
,
branchName
)
break
case
"nodejs"
:
build_nodejs
(
gitPath
,
branchName
)
break
case
"python"
:
build_python
(
gitPath
,
branchName
)
break
case
"lua-ui"
:
build_luaui
(
gitPath
,
branchName
)
break
default:
echo
"未知的buildType: ${config.buildType}"
break
}
}
def
checkout_java
(
gitPath
,
branchName
)
{
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
gitPath
}
}
def
checkout_nodejs
(
branchName
,
systemName
)
{
git_path
=
project_attr
(
systemName
)[
"gitPath"
]
def
checkout_nodejs
(
gitPth
,
branchName
)
{
currentPath
=
sh
(
currentPath
=
sh
(
script:
'pwd'
,
script:
'pwd'
,
returnStdout:
true
returnStdout:
true
).
trim
()
).
trim
()
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
if
(
!
folder
.
exists
()
)
{
if
(
!
folder
.
exists
()
)
{
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
def
bowerFile
=
fileExists
'./bower.json'
def
bowerFile
=
fileExists
'./bower.json'
...
@@ -108,13 +131,13 @@ def checkout_nodejs(branchName, systemName) {
...
@@ -108,13 +131,13 @@ def checkout_nodejs(branchName, systemName) {
sh
"cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"chmod +x .git/hooks/post-merge"
sh
"chmod +x .git/hooks/post-merge"
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
}
}
}
}
def
checkout_lua_ui
(
branchName
,
gitRepo
)
{
def
checkout_lua_ui
(
gitPaths
,
branchName
)
{
if
(
git
Repo
.
contains
(
"--"
)){
if
(
git
Paths
.
contains
(
"--"
)){
t1
=
git
Repo
.
split
(
"/"
)
t1
=
git
Pths
.
split
(
"/"
)
groups
=
t1
[
0
].
split
(
"--"
)
groups
=
t1
[
0
].
split
(
"--"
)
projects
=
t1
[
1
].
split
(
"--"
)
projects
=
t1
[
1
].
split
(
"--"
)
branches
=
branchName
.
split
(
"--"
)
branches
=
branchName
.
split
(
"--"
)
...
@@ -122,8 +145,8 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -122,8 +145,8 @@ def checkout_lua_ui(branchName, gitRepo) {
t1
.
size
().
times
{
t1
.
size
().
times
{
dir
(
projects
[
it
])
{
dir
(
projects
[
it
])
{
project
_a
ttr
=
project_attr
(
projects
[
it
])
project
A
ttr
=
project_attr
(
projects
[
it
])
git
_path
=
project_a
ttr
[
"gitPath"
]
git
Path
=
projectA
ttr
[
"gitPath"
]
currentPath
=
sh
(
currentPath
=
sh
(
script:
'pwd'
,
script:
'pwd'
,
...
@@ -132,7 +155,7 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -132,7 +155,7 @@ def checkout_lua_ui(branchName, gitRepo) {
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
if
(
!
folder
.
exists
()
)
{
if
(
!
folder
.
exists
()
)
{
git
branch:
branches
[
it
],
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branches
[
it
],
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
def
bowerFile
=
fileExists
'./bower.json'
def
bowerFile
=
fileExists
'./bower.json'
...
@@ -143,7 +166,7 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -143,7 +166,7 @@ def checkout_lua_ui(branchName, gitRepo) {
}
else
{
}
else
{
sh
"\\cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"\\cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"chmod +x .git/hooks/post-merge"
sh
"chmod +x .git/hooks/post-merge"
git
branch:
branches
[
it
],
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branches
[
it
],
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
}
}
}
}
}
}
...
@@ -153,8 +176,8 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -153,8 +176,8 @@ def checkout_lua_ui(branchName, gitRepo) {
project
=
t1
[
1
]
project
=
t1
[
1
]
dir
(
project
)
{
dir
(
project
)
{
project
_a
ttr
=
project_attr
(
project
)
project
A
ttr
=
project_attr
(
project
)
git
_path
=
project_a
ttr
[
"gitPath"
]
git
Path
=
projectA
ttr
[
"gitPath"
]
currentPath
=
sh
(
currentPath
=
sh
(
script:
'pwd'
,
script:
'pwd'
,
...
@@ -164,7 +187,7 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -164,7 +187,7 @@ def checkout_lua_ui(branchName, gitRepo) {
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
def
folder
=
new
File
(
"${currentPath}/.git/hooks"
)
if
(
!
folder
.
exists
()
)
{
if
(
!
folder
.
exists
()
)
{
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
def
bowerFile
=
fileExists
'./bower.json'
def
bowerFile
=
fileExists
'./bower.json'
if
(
bowerFile
)
{
if
(
bowerFile
)
{
...
@@ -175,31 +198,45 @@ def checkout_lua_ui(branchName, gitRepo) {
...
@@ -175,31 +198,45 @@ def checkout_lua_ui(branchName, gitRepo) {
sh
"cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"cp -rf /home/quant_group/config_repository/lua-ui/hook/post-merge .git/hooks/"
sh
"chmod +x .git/hooks/post-merge"
sh
"chmod +x .git/hooks/post-merge"
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
_p
ath
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
git
P
ath
}
}
}
}
}
}
}
}
def
build_java
(
namespace
,
systemName
,
contextDir
)
{
def
build
(
buildType
,
systemName
,
contextDir
){
sh
'/usr/share/maven/bin/mvn clean package -P test -D maven.test.skip=true'
}
def
copy_files
(
buildType
,
target
,
contextDir
){
switch
(
buildType
){
switch
(
buildType
){
case
"java"
:
case
"java"
:
copy_files_java
(
target
,
contextDir
)
build_java
(
systemName
,
contextDir
)
break
case
"nodejs"
:
build_nodejs
(
systemName
,
contextDir
)
break
case
"python"
:
build_python
(
systemName
,
contextDir
)
break
case
"lua-ui"
:
build_luaui
(
systemName
,
contextDir
)
break
break
default:
default:
echo
"%{buildType} not copy...."
echo
"未知的buildType: ${config.buildType}"
}
break
}
}
def
copy_files_java
(
target
,
contextDir
)
{
sh
"cp ${target}/*.jar ${contextDir}/app.jar"
def
build_java
(
systemName
,
contextDir
)
{
def
res_json
=
project_attr
(
systemName
)
buildCmd
=
res_json
[
"buildCmd"
]
jarFilePath
=
project_attr
[
"jarFilePath"
]
sh
"${buildCmd}"
sh
"cp ${jarFilePath}/*.jar ${contextDir}/app.jar"
}
}
def
build_nodejs
(
namespace
,
systemName
,
contextDir
)
{
def
build_nodejs
(
systemName
,
contextDir
)
{
def
res_json
=
project_attr
(
systemName
)
def
res_json
=
project_attr
(
systemName
)
configPath
=
res_json
[
"configPath"
]
configPath
=
res_json
[
"configPath"
]
...
@@ -211,14 +248,14 @@ def build_nodejs(namespace, systemName, contextDir) {
...
@@ -211,14 +248,14 @@ def build_nodejs(namespace, systemName, contextDir) {
sh
"mv dist.tgz ${contextDir}"
sh
"mv dist.tgz ${contextDir}"
}
}
def
build_python
(
namespace
,
systemName
,
contextDir
)
{
def
build_python
(
systemName
,
contextDir
)
{
sh
"cp -rf ${contextDir}/config.ini server/config/release/config.ini"
sh
"cp -rf ${contextDir}/config.ini server/config/release/config.ini"
sh
"cp -rf ${contextDir}/config.ini server/config/beta/config.ini"
sh
"cp -rf ${contextDir}/config.ini server/config/beta/config.ini"
sh
'tar zcf dist.tgz server/'
sh
'tar zcf dist.tgz server/'
sh
"mv dist.tgz ${contextDir}"
sh
"mv dist.tgz ${contextDir}"
}
}
def
build_luaui
(
namespace
,
systemNames
,
contextDir
)
{
def
build_luaui
(
systemNames
,
contextDir
)
{
arrSystem
=
systemNames
.
split
(
"--"
)
arrSystem
=
systemNames
.
split
(
"--"
)
for
(
systemName
in
arrSystem
)
{
for
(
systemName
in
arrSystem
)
{
dir
(
systemName
)
{
dir
(
systemName
)
{
...
@@ -344,7 +381,7 @@ def getDocketPackageImage(buildType){
...
@@ -344,7 +381,7 @@ def getDocketPackageImage(buildType){
args
+=
"-v /home/quant_group/config_repository:/home/quant_group/config_repository "
args
+=
"-v /home/quant_group/config_repository:/home/quant_group/config_repository "
args
+=
"-v /home/quant_group/pacakge/:/home/quant_group/pacakge/ "
args
+=
"-v /home/quant_group/pacakge/:/home/quant_group/pacakge/ "
packageImageInfo
[
"image"
]
=
"192.168.4.36/baseimg/jenkins-node-slave:2018040401"
packageImageInfo
[
"image"
]
=
"192.168.4.36/baseimg/jenkins-node-slave:2018040401"
packageImageInfo
[
"args"
]
=
""
packageImageInfo
[
"args"
]
=
args
break
break
default:
default:
echo
""
echo
""
...
...
vars/qgDockerPiplineWithDockerSlave.groovy
View file @
7dab6b08
...
@@ -61,20 +61,16 @@ def call(body) {
...
@@ -61,20 +61,16 @@ def call(body) {
/*checkout code*/
/*checkout code*/
_utils
.
beautyEcho
(
"checkout"
,
"info"
)
_utils
.
beautyEcho
(
"checkout"
,
"info"
)
_stage
.
checkout
(
gitPath
,
branchName
)
_stage
.
checkout
(
config
.
buildType
,
systemName
,
branchName
)
/*prepare config*/
/*prepare config*/
_utils
.
beautyEcho
(
"prepare config"
,
"info"
)
_utils
.
beautyEcho
(
"prepare config"
,
"info"
)
_stage
.
prepare_config
(
config
.
buildType
,
systemName
,
contextDir
)
_stage
.
prepare_config
(
config
.
buildType
,
systemName
,
contextDir
)
/*build*/
/*build*/
_utils
.
beautyEcho
(
"build"
,
"info"
)
_utils
.
beautyEcho
(
"build"
,
"info"
)
def
buildCmd
=
project_attr
[
"buildCmd"
]
_stage
.
build
(
config
.
buildType
,
systemName
,
contextDir
)
sh
"${buildCmd}"
/*copy files*/
_utils
.
beautyEcho
(
"copy files"
,
"info"
)
_stage
.
copy_files
(
config
.
buildType
,
project_attr
[
"jarFilePath"
],
contextDir
)
}
}
}
}
_utils
.
beautyEcho
(
"build over"
,
"info"
)
_utils
.
beautyEcho
(
"build over"
,
"info"
)
...
...
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