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
2f640224
Commit
2f640224
authored
Nov 14, 2017
by
daidekun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbugs
parent
2929c906
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
26 deletions
+5
-26
stage.groovy
src/libs/stage.groovy
+5
-26
No files found.
src/libs/stage.groovy
View file @
2f640224
...
...
@@ -2,36 +2,17 @@
package
libs
;
import
libs.utils
;
/*def branchName = env.BRANCH_NAME
def gitRepo = env.GIT_REPO
def namespace = env.NAMESPACE
def isDeploy = env.IS_DEPLOY
t = gitRepo.split("/")
def gitGroup = t[0]
def systemName = t[1]
def harborGroup = "library"
def workspace = "/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def buildNumber
def imageTag
def utils = new libs.utils()
def contextDir = utils.contextDir()
*/
def
checkout
()
{
def
checkout
(
contextDir
,
gitRepo
)
{
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"
sh
"git pull origin master"
}
def
build
()
{
def
build
(
namespace
,
systemName
,
contextDir
)
{
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
,
safeSystemName
,
contextDir
)
{
buildNumber
=
env
.
BUILD_NUMBER
/*分支名中非法字符统一替换为下划线*/
...
...
@@ -39,8 +20,6 @@ def docker_build_and_push() {
safeBranchName
=
branchName
.
replaceAll
(
regex
,
"_"
)
safeSystemName
=
"project"
imageTag
=
"192.168.4.36/${harborGroup}/${systemName}:${safeBranchName}-${buildNumber}"
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
withDockerRegistry
([
credentialsId:
'harbor-qajenkins'
,
url:
"http://192.168.4.36"
])
{
def
image
=
docker
.
build
(
imageTag
,
"--build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${safeSystemName} ${contextDir}"
)
...
...
@@ -53,7 +32,7 @@ def docker_build_and_push() {
echo
"========================================="
}
def
deploy
()
{
def
deploy
(
namespace
,
systemName
,
imageTag
)
{
if
(
isDeploy
)
{
echo
(
"将镜像更新到到Namespace:"
+
namespace
)
build
job:
'deployer.Updater'
,
parameters:
[
...
...
@@ -67,7 +46,7 @@ def deploy() {
}
}
def
clean
()
{
def
clean
(
contextDir
)
{
sh
"rm -rf ./${contextDir}"
}
...
...
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