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
b08919c6
Commit
b08919c6
authored
Nov 14, 2017
by
daidekun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbug
parent
c00c8e59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
54 deletions
+52
-54
stage.groovy
src/libs/stage.groovy
+51
-53
standardPipeline.groovy
vars/standardPipeline.groovy
+1
-1
No files found.
src/libs/stage.groovy
View file @
b08919c6
...
@@ -2,36 +2,35 @@
...
@@ -2,36 +2,35 @@
package
libs
;
package
libs
;
import
libs.utils
;
import
libs.utils
;
class
Stage
{
def
branchName
=
env
.
BRANCH_NAME
def
branchName
=
env
.
BRANCH_NAME
def
gitRepo
=
env
.
GIT_REPO
def
gitRepo
=
env
.
GIT_REPO
def
namespace
=
env
.
NAMESPACE
def
namespace
=
env
.
NAMESPACE
def
isDeploy
=
env
.
IS_DEPLOY
def
isDeploy
=
env
.
IS_DEPLOY
t
=
gitRepo
.
split
(
"/"
)
t
=
gitRepo
.
split
(
"/"
)
def
gitGroup
=
t
[
0
]
def
gitGroup
=
t
[
0
]
def
systemName
=
t
[
1
]
def
systemName
=
t
[
1
]
def
harborGroup
=
"library"
def
harborGroup
=
"library"
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def
buildNumber
def
buildNumber
def
imageTag
def
imageTag
def
utils
=
new
libs
.
utils
()
def
utils
=
new
libs
.
utils
()
def
contextDir
=
utils
.
contextDir
()
def
contextDir
=
utils
.
contextDir
()
def
checkout
()
{
def
checkout
()
{
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/ui ${contextDir}"
sh
"cp -r /home/quant_group/qg-dockerfiles/templates/ui ${contextDir}"
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
"git@gitabc.xyqb.com:${gitRepo}.git"
git
branch:
branchName
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
"git@gitabc.xyqb.com:${gitRepo}.git"
sh
"git pull origin master"
sh
"git pull origin master"
}
}
def
build
()
{
def
build
()
{
sh
"ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv"
sh
"ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv"
}
}
def
docker_build_and_push
()
{
def
docker_build_and_push
()
{
buildNumber
=
env
.
BUILD_NUMBER
buildNumber
=
env
.
BUILD_NUMBER
/*分支名中非法字符统一替换为下划线*/
/*分支名中非法字符统一替换为下划线*/
...
@@ -51,9 +50,9 @@ class Stage {
...
@@ -51,9 +50,9 @@ class Stage {
echo
"=================镜像地址================="
echo
"=================镜像地址================="
echo
imageTag
echo
imageTag
echo
"========================================="
echo
"========================================="
}
}
def
deploy
()
{
def
deploy
()
{
if
(
isDeploy
)
{
if
(
isDeploy
)
{
echo
(
"将镜像更新到到Namespace:"
+
namespace
)
echo
(
"将镜像更新到到Namespace:"
+
namespace
)
build
job:
'deployer.Updater'
,
parameters:
[
build
job:
'deployer.Updater'
,
parameters:
[
...
@@ -65,11 +64,10 @@ class Stage {
...
@@ -65,11 +64,10 @@ class Stage {
echo
"namespace不存在,不执行deploy"
echo
"namespace不存在,不执行deploy"
echo
namespace
echo
namespace
}
}
}
}
def
clean
()
{
def
clean
()
{
sh
"rm -rf ./${contextDir}"
sh
"rm -rf ./${contextDir}"
}
}
}
...
...
vars/standardPipeline.groovy
View file @
b08919c6
...
@@ -3,7 +3,7 @@ import libs.stage;
...
@@ -3,7 +3,7 @@ import libs.stage;
def
call
(
body
)
{
def
call
(
body
)
{
def
config
=
[:]
def
config
=
[:]
def
stage
=
new
libs
.
stage
.
Stage
()
def
stage
=
new
libs
.
stage
()
body
.
resolveStrategy
=
Closure
.
DELEGATE_FIRST
body
.
resolveStrategy
=
Closure
.
DELEGATE_FIRST
body
.
delegate
=
config
body
.
delegate
=
config
...
...
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