Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
devops-dev
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
devops-dev
Commits
d7bc3128
Commit
d7bc3128
authored
Sep 27, 2019
by
梦良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
e72c8a67
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
112 deletions
+0
-112
job.go
controllers/job.go
+0
-0
Jenkinsfile
jenkins/Jenkinsfile
+0
-112
No files found.
controllers/job.go
View file @
d7bc3128
This diff is collapsed.
Click to expand it.
jenkins/Jenkinsfile
deleted
100644 → 0
View file @
e72c8a67
#
!
/usr/
bin
/
env
groovy
def
projectProperties
=
[
[
$class
:
'BuildDiscarderProperty'
,
strategy:
[
$class
:
'LogRotator'
,
numToKeepStr:
'5'
]],
parameters
([
string
(
name:
'DOCKER_USER'
,
defaultValue:
'admin'
,
description:
'docker用户名'
),
string
(
name:
'DOCKER_PASSWORD'
,
defaultValue:
'K2pass!!'
,
description:
'docker用户密码'
),
string
(
name:
'REGISTRY_URL'
,
defaultValue:
'harbor.dev.k2paas.com'
,
description:
'docker仓库地址'
)
]),
pipelineTriggers
([
[
$class
:
'GitLabPushTrigger'
,
branchFilterType:
'All'
,
triggerOnPush:
false
,
triggerOnMergeRequest:
false
,
triggerOpenMergeRequestOnPush:
"never"
,
triggerOnNoteRequest:
false
,
triggerOnAcceptedMergeRequest:
true
,
noteRegex:
"Jenkins please retry a build"
,
skipWorkInProgressMergeRequest:
true
,
ciSkip:
true
,
setBuildDescription:
true
,
addNoteOnMergeRequest:
true
,
addCiMessage:
true
,
addVoteOnMergeRequest:
true
,
acceptMergeRequestOnSuccess:
true
,
]
])
]
properties
(
projectProperties
)
def
label
=
"mypod-${UUID.randomUUID().toString()}"
podTemplate
(
label:
label
,
cloud:
'kubernetes'
,
containers:
[
containerTemplate
(
name:
'golang'
,
image:
'harbor.k2software.com.cn/library/golang:1.12-alpine'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'docker'
,
image:
'harbor.k2software.com.cn/build/docker:latest'
,
command:
'cat'
,
ttyEnabled:
true
),
containerTemplate
(
name:
'helm'
,
image:
'harbor.k2software.com.cn/build/helm:v2.11.0'
,
command:
'cat'
,
ttyEnabled:
true
,
envVars:
[
envVar
(
key:
'KUBECONFIG'
,
value:
'/root/.kube/config'
)])
],
volumes:
[
hostPathVolume
(
hostPath:
'/var/run/docker.sock'
,
mountPath:
'/var/run/docker.sock'
),
hostPathVolume
(
hostPath:
'/root/.kube'
,
mountPath:
'/root/.kube'
),
hostPathVolume
(
hostPath:
'/root/.m2'
,
mountPath:
'/root/.m2'
),
hostPathVolume
(
hostPath:
'/root/.helm'
,
mountPath:
'/home/jenkins/.helm'
)
])
{
node
(
label
)
{
def
version
=
"v6.0"
stage
(
'checkout'
)
{
checkout
scm
sh
'printenv'
}
container
(
'golang'
)
{
stage
(
'build'
)
{
sh
'ls -al'
// 生成静态链接所有的库
sh
'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -mod vendor -o k8s-console'
}
//stage('copy-front') {
// def dist_dir = "/mnt/k8s/online/${version}/front/k8s_console_front/dist"
// sh "cp -r $dist_dir frontend/"
//}
}
container
(
'docker'
)
{
//def tarName = "/mnt/k8s/online/${version}/images/paas-k8s-console_dev-${env.BUILD_ID}.tar"
stage
(
'docker-login'
)
{
//REGISTRY_URL私有仓库地址,也可使用官方地址:docker.io
sh
"docker login -u ${params.DOCKER_USER} -p ${params.DOCKER_PASSWORD} ${params.REGISTRY_URL}"
}
stage
(
'docker-build'
)
{
sh
"docker build . -t ${params.REGISTRY_URL}/paas-dev/paas-k8s-console:dev-${env.BUILD_ID}"
}
stage
(
'docker-push'
)
{
sh
"docker push ${params.REGISTRY_URL}/paas-dev/paas-k8s-console:dev-${env.BUILD_ID}"
}
// stage('docker-save') {
// sh "rm -rf /mnt/k8s/online/${version}/images/paas-k8s-console_*.tar"
// sh "docker save ${params.REGISTRY_URL}/paas-dev/paas-k8s-console:dev-${env.BUILD_ID} > $tarName"
// }
stage
(
'docker-rmi'
)
{
sh
"docker rmi ${params.REGISTRY_URL}/paas-dev/paas-k8s-console:dev-${env.BUILD_ID}"
}
}
//container('helm') {
// stage('helm deploy') {
// sh "sed -i \"s/tag: dev/tag: dev-${env.BUILD_ID}/g\" k8s-console-chart/values-dev.yaml"
// sh "helm upgrade --install k8s-console --namespace paas k8s-console-chart/ -f k8s-console-chart/values-dev.yaml"
//
// def previewTarget = "/mnt/k8s/online/${version}/charts"
// if(!fileExists("${previewTarget}")) {
// sh "mkdir -p ${previewTarget}"
// }
// sh "cp -r k8s-console-chart ${previewTarget}/"
// }
//}
}
}
// vim: ft=groovy
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