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
455fff73
Commit
455fff73
authored
Nov 15, 2017
by
daidekun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbugs
parent
64d1cb01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
15 deletions
+42
-15
StageBucket.groovy
src/org/qg/StageBucket.groovy
+40
-13
qgDockerPipeline.groovy
vars/qgDockerPipeline.groovy
+2
-2
No files found.
src/org/qg/StageBucket.groovy
View file @
455fff73
// src/org/foo/Stage.groovy
package
org.qg
;
def
checkout
(
branchName
,
contextDir
,
gitRepo
)
{
def
_prepare_java
(
systemName
,
contextDir
)
{
sh
"rm -rf ./tmp-docker-build-context"
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/java tmp-docker-build-context"
sh
"cp -r /home/quant_group/config_repository/java/${systemName}.properties ${contextDir}"
}
def
_prepare_nodejs
(
contextDir
)
{
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/nodejs ${contextDir}"
}
def
_prepare_ui
(
contextDir
)
{
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/ui ${contextDir}"
}
def
_prepare_python
(
contextDir
)
{
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/python ${contextDir}"
}
def
checkout
(
branchName
,
gitRepo
)
{
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
"git@gitabc.xyqb.com:${gitRepo}.git"
sh
"git pull origin master"
}
...
...
@@ -10,25 +27,35 @@ def checkout(branchName, contextDir, gitRepo) {
def
build
(
namespace
,
systemName
,
contextDir
,
buildType
)
{
switch
(
buildType
)
{
case
"java"
:
env
.
PATH
=
"${tool 'M3'}/bin:${env.PATH}"
sh
'mvn clean package -P test -D maven.test.skip=true'
break
_build_java
(
namespace
,
systemName
,
contextDir
)
case
"ui"
||
"nodejs"
:
sh
"ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv"
break
_build_node
(
namespace
,
systemName
,
contextDir
)
case
"python"
:
sh
"mv ${contextDir}/config.ini config.ini"
sh
"cp -f config.ini server/config/release/config.ini"
sh
"cp -f config.ini ${configPath}"
sh
'tar zcf dist.tgz server/'
break
_build_python
(
namespace
,
systemName
,
contextDir
)
default:
break
}
}
}
def
_build_java
(
namespace
,
systemName
,
contextDir
)
{
sh
'/usr/share/maven/bin/mvn clean package -P test -D maven.test.skip=true'
break
}
def
_build_node_and_ui
(
namespace
,
systemName
,
contextDir
)
{
sh
"ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv"
break
}
def
_build_python
(
namespace
,
systemName
,
contextDir
)
{
sh
"mv ${contextDir}/config.ini config.ini"
sh
"cp -f config.ini server/config/release/config.ini"
sh
"cp -f config.ini ${configPath}"
sh
'tar zcf dist.tgz server/'
break
}
def
docker_build_and_push
(
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
{
/*分支名中非法字符统一替换为下划线*/
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
safeBranchName
=
branchName
.
replaceAll
(
regex
,
"_"
)
safeSystemName
=
"project"
...
...
vars/qgDockerPipeline.groovy
View file @
455fff73
...
...
@@ -10,7 +10,7 @@ def call(body) {
def
namespace
=
env
.
NAMESPACE
def
isDeploy
=
env
.
IS_DEPLOY
def
buildNumber
=
env
.
BUILD_NUMBER
t
=
gitRepo
.
split
(
"/"
)
def
gitGroup
=
t
[
0
]
def
systemName
=
t
[
1
]
...
...
@@ -35,7 +35,7 @@ def call(body) {
}
stage
(
'Build'
)
{
_stage
.
build
(
namespace
,
systemName
,
contextDir
)
_stage
.
build
(
namespace
,
systemName
,
contextDir
,
)
}
stage
(
'Docker Build And Push'
)
{
...
...
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