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
a95bee41
Commit
a95bee41
authored
Jun 13, 2018
by
wentao.suo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加 ci docker image 构建脚本
parent
5fb4b2a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
101 deletions
+93
-101
qgCiDockerImageMaker.groovy
vars/qgCiDockerImageMaker.groovy
+81
-0
qgCiPipeline.groovy
vars/qgCiPipeline.groovy
+0
-99
qgCiSonar.groovy
vars/qgCiSonar.groovy
+4
-0
qgDockerPipeline.groovy
vars/qgDockerPipeline.groovy
+4
-0
qgDockerPiplineWithDockerSlave.groovy
vars/qgDockerPiplineWithDockerSlave.groovy
+4
-2
No files found.
vars/qgCiDockerImageMaker.groovy
0 → 100644
View file @
a95bee41
/*
docker make pipeline for pipes
*/
def
call
(
body
)
{
ansiColor
(
'xterm'
)
{
def
_stage
=
new
org
.
qg
.
docker_new
.
StageBucket
()
def
_utils
=
new
org
.
qg
.
docker_new
.
Utils
()
//def timeStemp = new Date().format("yyyyMMddHHmmss")
def
env
=
body
.
env
def
gitRepo
=
env
.
GIT_REPO
def
systemName
=
env
.
GIT_REPO_NAME
def
branchName
=
env
.
BRANCH_NAME
.
replaceAll
(
"refs/heads/"
,
""
)
def
buildType
=
env
.
BUILD_TYPE
/* def namespace = env.NAMESPACE*/
/* def isDeploy = env.IS_DEPLOY*/
def
buildNumber
=
env
.
BUILD_NUMBER
//
def
cluster
=
env
.
CLUSTER
// dev
def
imageTag
=
env
.
IMAGE_TAG
// Library/xyqb:master-1213123
def
harborHost
=
env
.
HARBOR_HOST
//192.168.4.4
def
contextDir
=
_stage
.
contextMkdir
(
"${gitRepo}-${timeStemp}"
)
def
timeStemp
=
env
.
TIMESTEMP
def
branchHashCode
def
imageTagInfo
=[]
node
{
try
{
/* 1 */
stage
(
'Init'
)
{
_utils
.
beautyEcho
(
"Init"
,
"stage"
)
_stage
.
init_dependency
()
_stage
.
init_image_dependency
(
buildType
,
originSystemName
,
contextDir
)
}
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
_utils
.
beautyEcho
(
"checkout & build < ${systemName} : ${branchName} >"
,
"stage"
)
branchHashCode
=
_stage
.
check_and_build
(
buildType
,
systemName
,
branchName
,
contextDir
)
_utils
.
beautyEcho
(
"build over"
,
"info"
)
}
/* 3 */
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
_utils
.
beautyEcho
(
"make docker image"
,
"stage"
)
def
imageTagInfo
=[
harborHost:
"http://${harborHost}"
,
imageTag:
"${harborHost}/${imageTag}"
]
_stage
.
dockerbuild_and_push
(
imageTag
,
buildNumber
,
systemName
,
branchName
,
cluster
,
timeStemp
,
contextDir
,
branchHashCode
)
}
/* 4 */
stage
(
'Clean'
){
_utils
.
beautyEcho
(
"Clear Cache Tmp"
,
"stage"
)
_stage
.
clean_images
(
imageTagInfo
[
"imageTag"
],
contextDir
)
}
}
catch
(
err
)
{
_utils
.
beautyEcho
(
err
,
"fail"
)
if
(
imageTagInfos
!=
null
){
_stage
.
clean_images
(
imageTagInfo
[
"imageTag"
],
contextDir
)
}
throw
err
}
}
}
}
vars/qgCiPipeline.groovy
deleted
100644 → 0
View file @
5fb4b2a8
def
call
(
body
)
{
def
timeStemp
=
new
Date
().
format
(
"yyyyMMddHHmmss"
)
def
env
=
body
.
env
def
cluster
=
env
.
CLUSTER
def
gitRepo
=
env
.
GIT_REPO
def
originBranchName
=
env
.
BRANCH_NAME
def
buildType
=
env
.
BUILD_TYPE
def
tier
=
env
.
TIER
def
buildNumber
=
env
.
BUILD_NUMBER
// QG/XXX or QG--QG/systemName--systemName
t
=
gitRepo
.
split
(
"/"
)
def
gitGroup
=
t
[
0
]
// systemName or systemName--systemName
def
originSystemName
=
t
[
1
]
// ["",""]
def
systemNames
=
originSystemName
.
split
(
"--"
)
def
branchNames
=
originBranchName
.
split
(
"--"
)
def
contextDir
def
imageTag
def
harborGroup
=
"library"
def
_stage
=
new
org
.
qg
.
docker_new
.
StageBucket
()
def
_utils
=
new
org
.
qg
.
docker_new
.
Utils
()
System
.
out
.
println
(
"++++++++++"
)
_utils
.
beautyEcho
(
"[CLUSTER:${CLUSTER}] [GIT_REPO:${GIT_REPO}] [BRANCH_NAME:${BRANCH_NAME}] [BUILD_TYPE:${BUILD_TYPE}] [TIER:${TIER}]"
,
"info"
)
node
{
try
{
/* 1 */
stage
(
'Init'
)
{
_utils
.
beautyEcho
(
"Init"
,
"stage"
)
contextDir
=
_stage
.
contextMkdir
(
"${originSystemName}-${timeStemp}"
)
_stage
.
before_prepare
()
}
/* 2 */
withDockerServer
([
uri:
"tcp://192.168.4.96:2375/"
])
{
_utils
.
beautyEcho
(
"checkout & build < ${originSystemName} : ${originBranchName} >"
,
"stage"
)
for
(
def
i
=
0
;
i
<
systemNames
.
length
;
i
++){
dir
(
systemNames
[
i
]){
_stage
.
check_and_build
(
buildType
,
systemNames
[
i
],
branchNames
[
i
],
contextDir
)
}
}
_utils
.
beautyEcho
(
"build over"
,
"info"
)
}
/* 3 */
/*withDockerServer([uri: "tcp://192.168.4.96:2375/"]) {
_utils.beautyEcho("make docker image", "stage")
def regex = "[`,./;\\[\\]&<>?:\"()|-]+"
def k8sSystemName = originSystemName.replaceAll("_","-")
def safeBranchName = originBranchName.replaceAll(regex,"_")
imageTag = _stage.imageTag(harborGroup,k8sSystemName,safeBranchName,timeStemp)
def _systemName = originSystemName.toLowerCase()
_stage.dockerbuild_and_push(imageTag,buildNumber,_systemName,originBranchName ,cluster,timeStemp)
}*/
/* 4 */
stage
(
'Clean'
){
_utils
.
beautyEcho
(
"Clear Cache Tmp"
,
"stage"
)
_stage
.
clean_images
(
imageTag
,
contextDir
)
}
}
catch
(
err
)
{
_utils
.
beautyEcho
(
err
,
"fail"
)
_stage
.
clean_images
(
imageTag
,
contextDir
)
throw
err
}
}
}
vars/qgCiSonar.groovy
View file @
a95bee41
/*
sonar check pipeline for pipes
*/
def
call
(
body
)
{
def
_stage
=
new
org
.
qg
.
ci
.
SonarStageBucket
()
def
_utils
=
new
org
.
qg
.
docker_new
.
Utils
()
...
...
vars/qgDockerPipeline.groovy
View file @
a95bee41
import
org.qg.docker.*
import
java.time.*
/*
old
*/
def
getTime
(){
LocalDateTime
t
=
LocalDateTime
.
now
();
return
t
as
String
...
...
vars/qgDockerPiplineWithDockerSlave.groovy
View file @
a95bee41
/*
make docker image for test
*/
def
call
(
body
)
{
...
...
@@ -64,8 +67,7 @@ def call(body) {
for
(
def
i
=
0
;
i
<
systemNames
.
length
;
i
++){
dir
(
systemNames
[
i
]){
branchHashCode
=
_stage
.
check_and_build
(
config
.
buildType
,
systemNames
[
i
],
branchNames
[
i
],
contextDir
)
branchHashCode
=
_stage
.
check_and_build
(
config
.
buildType
,
systemNames
[
i
],
branchNames
[
i
],
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