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
78a1fb02
Commit
78a1fb02
authored
Apr 09, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.quantgroup.cn/QA/global-jenkinsfile
parents
d3a46911
36e99251
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
152 deletions
+129
-152
StageBucket.groovy
src/org/qg/docker/StageBucket.groovy
+1
-1
StageBucket.groovy
src/org/qg/docker_new/StageBucket.groovy
+106
-111
qgDockerPiplineWithDockerSlave.groovy
vars/qgDockerPiplineWithDockerSlave.groovy
+22
-40
No files found.
src/org/qg/docker/StageBucket.groovy
View file @
78a1fb02
...
@@ -237,7 +237,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
...
@@ -237,7 +237,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
def
build_schema
=
"BUILD_TIME:${timeNow}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}"
def
build_schema
=
"BUILD_TIME:${timeNow}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}"
echo
build_schema
echo
build_schema
def
image
=
docker
.
build
(
imageTag
,
"--build-arg BUILD_SCHEMA=${build_schema} ${contextDir}"
)
def
image
=
docker
.
build
(
imageTag
,
"--build-arg
SYSTEM_NAME=${systemName} --build-arg
BUILD_SCHEMA=${build_schema} ${contextDir}"
)
image
.
push
()
image
.
push
()
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
...
...
src/org/qg/docker_new/StageBucket.groovy
View file @
78a1fb02
This diff is collapsed.
Click to expand it.
vars/qgDockerPiplineWithDockerSlave.groovy
View file @
78a1fb02
...
@@ -40,6 +40,7 @@ def call(body) {
...
@@ -40,6 +40,7 @@ def call(body) {
try
{
try
{
echo
config
.
buildType
echo
config
.
buildType
/* 1 */
stage
(
'prepare'
)
{
stage
(
'prepare'
)
{
_utils
.
beautyEcho
(
"Prepare"
,
"stage"
)
_utils
.
beautyEcho
(
"Prepare"
,
"stage"
)
contextDir
=
_stage
.
contextMkdir
(
"${systemName}-${timeStemp}"
)
contextDir
=
_stage
.
contextMkdir
(
"${systemName}-${timeStemp}"
)
...
@@ -47,57 +48,35 @@ def call(body) {
...
@@ -47,57 +48,35 @@ def call(body) {
}
}
/* 2 */
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
stage
(
'checkout & build'
)
{
stage
(
'checkout & build'
)
{
_utils
.
beautyEcho
(
"checkout & build"
,
"stage"
)
_utils
.
beautyEcho
(
"checkout & build"
,
"stage"
)
def
pacegeDockerInfo
=
_stage
.
getDocketPackageImage
(
config
.
buildType
)
arrSystem
=
systemName
.
split
(
"--"
)
docker
.
image
(
pacegeDockerInfo
[
"image"
]).
inside
(
pacegeDockerInfo
[
"args"
]){
for
(
systemNameSimple
in
arrSystem
)
{
_stage
.
checkAndBuild
(
config
.
buildType
,
systemNameSimple
,
branchName
,
contextDir
)
def
project_attr
=
_stage
.
project_attr
(
systemName
)
def
gitPath
=
project_attr
[
"gitPath"
]
/*checkout code*/
_utils
.
beautyEcho
(
"checkout"
,
"info"
)
_stage
.
checkout
(
config
.
buildType
,
systemName
,
branchName
)
/*prepare config*/
_utils
.
beautyEcho
(
"prepare config"
,
"info"
)
_stage
.
prepare_config
(
config
.
buildType
,
systemName
,
contextDir
)
/*build*/
_utils
.
beautyEcho
(
"build"
,
"info"
)
_stage
.
build
(
config
.
buildType
,
systemName
,
contextDir
)
}
}
_utils
.
beautyEcho
(
"build over"
,
"info"
)
}
}
_utils
.
beautyEcho
(
"build over"
,
"info"
)
}
/* 3 */
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
stage
(
'make docker image'
)
{
stage
(
'make docker image'
)
{
_utils
.
beautyEcho
(
"make docker image"
,
"stage"
)
_utils
.
beautyEcho
(
"make docker image"
,
"stage"
)
imageTag
=
_stage
.
imageTag
(
harborGroup
,
k8sSystemName
,
safeBranchName
,
timeStemp
)
imageTag
=
_stage
.
imageTag
(
harborGroup
,
k8sSystemName
,
safeBranchName
,
timeStemp
)
_stage
.
dockerMake
(
imageTag
,
buildNumber
,
systemName
,
branchName
,
cluster
,
timeStemp
)
withDockerRegistry
([
credentialsId:
'harbor-qajenkins'
,
url:
"http://192.168.4.36"
])
{
def
build_schema
=
"BUILD_TIME:${timeStemp}@BUILD_NUMBER:${buildNumber}@SYSTEM_NAME:${systemName}@BRANCH_NAME:${branchName}@CLUSTER:${cluster}"
echo
build_schema
def
image
=
docker
.
build
(
imageTag
,
"--build-arg BUILD_SCHEMA=${build_schema} ${contextDir}"
)
image
.
push
()
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
image
.
push
(
'latest'
)
}
}
}
}
stage
(
'Deploy To K8s Cluster'
){
stage
(
'Deploy To K8s Cluster'
){
_utils
.
beautyEcho
(
"Deploy To K8s Cluster"
,
"stage"
)
_utils
.
beautyEcho
(
"Deploy To K8s Cluster"
,
"stage"
)
_utils
.
beautyEcho
(
"Deploy image: ${imageTag} to:${namespace}"
,
"info"
)
_stage
.
deploy
(
namespace
,
systemName
,
imageTag
,
config
.
tier
,
isDeploy
)
_stage
.
deploy
(
namespace
,
systemName
,
imageTag
,
config
.
tier
,
isDeploy
)
}
}
...
@@ -108,11 +87,11 @@ def call(body) {
...
@@ -108,11 +87,11 @@ def call(body) {
}
catch
(
err
)
{
}
catch
(
err
)
{
_utils
.
beautyEcho
(
err
,
"fail"
)
_utils
.
beautyEcho
(
err
,
"fail"
)
/* sh "rm -rf ${contextDir}"*/
sh
"rm -rf ${contextDir}"
if
(
imageTag
){
if
(
imageTag
){
_stage
.
clean_images
(
imageTag
)
_stage
.
clean_images
(
imageTag
)
}
}
sleep
120
throw
err
throw
err
...
@@ -121,3 +100,6 @@ def call(body) {
...
@@ -121,3 +100,6 @@ def call(body) {
}
}
}
}
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