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
45385ac2
Commit
45385ac2
authored
Mar 13, 2018
by
kalvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加cluster参数,用于区分生产镜像和测试开发镜像
parent
3aefae0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
StageBucket.groovy
src/org/qg/docker/StageBucket.groovy
+2
-2
qgDockerPipeline.groovy
vars/qgDockerPipeline.groovy
+2
-1
No files found.
src/org/qg/docker/StageBucket.groovy
View file @
45385ac2
...
@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) {
...
@@ -222,7 +222,7 @@ def build_luaui(namespace, systemNames, contextDir) {
}
}
}
}
def
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
{
def
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
,
cluster
)
{
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
k8sSystemName
=
systemName
.
replaceAll
(
"_"
,
"-"
)
k8sSystemName
=
systemName
.
replaceAll
(
"_"
,
"-"
)
...
@@ -234,7 +234,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
...
@@ -234,7 +234,7 @@ def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemNa
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_TIME=${timeNow} --build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${defaultSystemName} ${contextDir}"
)
def
image
=
docker
.
build
(
imageTag
,
"--build-arg
CLUSTER=${cluster} --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=${defaultSystemName} ${contextDir}"
)
image
.
push
()
image
.
push
()
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
if
(
branchName
==
"master"
||
branchName
==
"master--master"
)
{
...
...
vars/qgDockerPipeline.groovy
View file @
45385ac2
...
@@ -16,6 +16,7 @@ def call(body) {
...
@@ -16,6 +16,7 @@ def call(body) {
def
namespace
=
env
.
NAMESPACE
def
namespace
=
env
.
NAMESPACE
def
isDeploy
=
env
.
IS_DEPLOY
def
isDeploy
=
env
.
IS_DEPLOY
def
buildNumber
=
env
.
BUILD_NUMBER
def
buildNumber
=
env
.
BUILD_NUMBER
def
cluster
=
env
.
CLUSTER
t
=
gitRepo
.
split
(
"/"
)
t
=
gitRepo
.
split
(
"/"
)
def
gitGroup
=
t
[
0
]
def
gitGroup
=
t
[
0
]
...
@@ -110,7 +111,7 @@ def call(body) {
...
@@ -110,7 +111,7 @@ def call(body) {
_stage
.
copy_files_java
(
systemName
,
contextDir
)
_stage
.
copy_files_java
(
systemName
,
contextDir
)
}
}
imageTag
=
_stage
.
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
)
imageTag
=
_stage
.
dockerbuild_and_push
(
timeNow
,
buildNumber
,
branchName
,
harborGroup
,
systemName
,
contextDir
,
cluster
)
}
}
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