Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
springboot-k8s-example
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
demo
springboot-k8s-example
Commits
a7f89b4d
Commit
a7f89b4d
authored
Jul 23, 2019
by
卢浩元
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Jenkinsfile
parent
270c78d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
Jenkinsfile
jenkins/Jenkinsfile
+10
-10
No files found.
jenkins/Jenkinsfile
View file @
a7f89b4d
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
def
projectProperties
=
[
def
projectProperties
=
[
[
$class
:
'BuildDiscarderProperty'
,
strategy:
[
$class
:
'LogRotator'
,
numToKeepStr:
'5'
]],
[
$class
:
'BuildDiscarderProperty'
,
strategy:
[
$class
:
'LogRotator'
,
numToKeepStr:
'5'
]],
parameters
([
parameters
([
string
(
name:
'DOCKER_USER'
,
defaultValue:
''
,
description:
'docker用户名'
),
string
(
name:
'DOCKER_USER'
,
defaultValue:
'
admin
'
,
description:
'docker用户名'
),
string
(
name:
'DOCKER_PASSWORD'
,
defaultValue:
''
,
description:
'docker用户密码'
),
string
(
name:
'DOCKER_PASSWORD'
,
defaultValue:
'
K2pass!!
'
,
description:
'docker用户密码'
),
string
(
name:
'REGISTRY_URL'
,
defaultValue:
'
docker.io
'
,
description:
'docker仓库地址'
)
string
(
name:
'REGISTRY_URL'
,
defaultValue:
'
harbor.dev.k2paas.com
'
,
description:
'docker仓库地址'
)
])
])
]
]
...
@@ -14,9 +14,9 @@ properties(projectProperties)
...
@@ -14,9 +14,9 @@ properties(projectProperties)
def
label
=
"mypod-${UUID.randomUUID().toString()}"
def
label
=
"mypod-${UUID.randomUUID().toString()}"
podTemplate
(
label:
label
,
cloud:
'kubernetes'
,
containers:
[
podTemplate
(
label:
label
,
cloud:
'kubernetes'
,
containers:
[
containerTemplate
(
name:
'maven'
,
image:
'
maven:3.6.0-jdk-8
'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'maven'
,
image:
'
harbor.dev.k2paas.com/build/maven:3-jdk-8-alpine
'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'docker'
,
image:
'
docker
'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'docker'
,
image:
'
harbor.dev.k2paas.com/build/docker:latest
'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'kubectl'
,
image:
'
lachlanevenson/k8s-kubectl:v1.10.2
'
,
command:
'cat'
,
ttyEnabled:
true
)
containerTemplate
(
name:
'kubectl'
,
image:
'
harbor.dev.k2paas.com/build/k8s-kubectl:v1.14.0
'
,
command:
'cat'
,
ttyEnabled:
true
)
],
],
volumes:
[
volumes:
[
hostPathVolume
(
hostPath:
'/var/run/docker.sock'
,
mountPath:
'/var/run/docker.sock'
),
hostPathVolume
(
hostPath:
'/var/run/docker.sock'
,
mountPath:
'/var/run/docker.sock'
),
...
@@ -65,15 +65,15 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
...
@@ -65,15 +65,15 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
}
}
stage
(
'docker-build'
)
{
stage
(
'docker-build'
)
{
sh
"docker build . -t ${params.REGISTRY_URL}/
lusyoe
/k8s-example:${shortGitCommit}"
sh
"docker build . -t ${params.REGISTRY_URL}/
demo
/k8s-example:${shortGitCommit}"
}
}
stage
(
'docker-push'
)
{
stage
(
'docker-push'
)
{
sh
"docker push ${params.REGISTRY_URL}/
lusyoe
/k8s-example:${shortGitCommit}"
sh
"docker push ${params.REGISTRY_URL}/
demo
/k8s-example:${shortGitCommit}"
}
}
stage
(
'docker-remove'
)
{
stage
(
'docker-remove'
)
{
sh
"docker rmi ${params.REGISTRY_URL}/
lusyoe
/k8s-example:${shortGitCommit}"
sh
"docker rmi ${params.REGISTRY_URL}/
demo
/k8s-example:${shortGitCommit}"
}
}
}
}
...
@@ -81,7 +81,7 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
...
@@ -81,7 +81,7 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
container
(
'kubectl'
)
{
container
(
'kubectl'
)
{
stage
(
'k8s deploy'
)
{
stage
(
'k8s deploy'
)
{
sh
"sed -i \"s/lusyoe\\/k8s-example/${params.REGISTRY_URL}\\/
lusyoe
\\/k8s-example:${shortGitCommit}/g\" k8s-example.yaml"
sh
"sed -i \"s/lusyoe\\/k8s-example/${params.REGISTRY_URL}\\/
demo
\\/k8s-example:${shortGitCommit}/g\" k8s-example.yaml"
sh
"kubectl --kubeconfig=/root/.kube/config apply -f k8s-example.yaml"
sh
"kubectl --kubeconfig=/root/.kube/config apply -f k8s-example.yaml"
}
}
}
}
...
...
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