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
893ea91a
Commit
893ea91a
authored
Feb 09, 2018
by
tong.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.quantgroup.cn:QA/global-jenkinsfile
parents
834d0eab
e29782fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
StageBucket.groovy
src/org/qg/docker/StageBucket.groovy
+2
-2
qgDockerPipeline.groovy
vars/qgDockerPipeline.groovy
+9
-1
No files found.
src/org/qg/docker/StageBucket.groovy
View file @
893ea91a
...
@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) {
...
@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) {
}
}
}
}
def
dockerbuild_and_push
(
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
{
def
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
{
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
safeBranchName
=
branchName
.
replaceAll
(
regex
,
"_"
)
safeBranchName
=
branchName
.
replaceAll
(
regex
,
"_"
)
safeSystemName
=
"project"
safeSystemName
=
"project"
...
@@ -231,7 +231,7 @@ def dockerbuild_and_push(buildNumber, branchName, harborGroup, systemName, conte
...
@@ -231,7 +231,7 @@ def dockerbuild_and_push(buildNumber, branchName, harborGroup, systemName, conte
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
withDockerRegistry
([
credentialsId:
'harbor-qajenkins'
,
url:
"http://192.168.4.36"
])
{
withDockerRegistry
([
credentialsId:
'harbor-qajenkins'
,
url:
"http://192.168.4.36"
])
{
def
image
=
docker
.
build
(
imageTag
,
"--build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${safeSystemName} ${contextDir}"
)
def
image
=
docker
.
build
(
imageTag
,
"--build-arg BUILD_
TIME=${timeNow} --build-arg BUILD_
NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${safeSystemName} ${contextDir}"
)
image
.
push
()
image
.
push
()
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
...
...
vars/qgDockerPipeline.groovy
View file @
893ea91a
import
org.qg.docker.*
import
org.qg.docker.*
import
java.time.*
def
getTime
(){
LocalDateTime
t
=
LocalDateTime
.
now
();
return
t
as
String
}
def
call
(
body
)
{
def
call
(
body
)
{
...
@@ -20,6 +26,7 @@ def call(body) {
...
@@ -20,6 +26,7 @@ def call(body) {
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def
workspace
=
"/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def
imageTag
def
imageTag
def
timeNow
=
getTime
()
def
contextDir
def
contextDir
def
_stage
=
new
org
.
qg
.
docker
.
StageBucket
()
def
_stage
=
new
org
.
qg
.
docker
.
StageBucket
()
def
_utils
=
new
org
.
qg
.
docker
.
Utils
()
def
_utils
=
new
org
.
qg
.
docker
.
Utils
()
...
@@ -102,7 +109,8 @@ def call(body) {
...
@@ -102,7 +109,8 @@ def call(body) {
if
(
config
.
buildType
==
"java"
)
{
if
(
config
.
buildType
==
"java"
)
{
_stage
.
copy_files_java
(
systemName
,
contextDir
)
_stage
.
copy_files_java
(
systemName
,
contextDir
)
}
}
imageTag
=
_stage
.
dockerbuild_and_push
(
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
imageTag
=
_stage
.
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
}
}
stage
(
'Deploy To K8s Cluster'
)
{
stage
(
'Deploy To K8s Cluster'
)
{
...
...
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