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
3290bf66
Commit
3290bf66
authored
Sep 27, 2019
by
梦良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改Jenkins、chart
parent
d7bc3128
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
69 additions
and
73 deletions
+69
-73
job.go
controllers/job.go
+1
-1
Chart.yaml
devops-chart/Chart.yaml
+1
-1
NOTES.txt
devops-chart/templates/NOTES.txt
+4
-4
_helpers.tpl
devops-chart/templates/_helpers.tpl
+3
-3
deployment.yaml
devops-chart/templates/deployment.yaml
+3
-3
ingress.yaml
devops-chart/templates/ingress.yaml
+4
-4
service.yaml
devops-chart/templates/service.yaml
+3
-3
values-dev.yaml
devops-chart/values-dev.yaml
+5
-5
values-test.yaml
devops-chart/values-test.yaml
+5
-5
values.yaml
devops-chart/values.yaml
+5
-5
Jenkinsfile-dev
jenkins/Jenkinsfile-dev
+12
-12
Jenkinsfile-prod
jenkins/Jenkinsfile-prod
+11
-13
Jenkinsfile-test
jenkins/Jenkinsfile-test
+12
-14
No files found.
controllers/job.go
View file @
3290bf66
...
...
@@ -996,7 +996,7 @@ func (c *JobController) StartRunPipelineJob() {
infoLogger
.
Printf
(
"启动运行job:%s成功"
,
jobName
)
responseDto
.
Status
=
200
responseDto
.
Message
=
"成功"
responseDto
.
Message
=
"
启动运行
成功"
c
.
Data
[
"json"
]
=
responseDto
c
.
ServeJSON
()
}
...
...
devops-chart/Chart.yaml
View file @
3290bf66
apiVersion
:
v1
appVersion
:
"
2.0"
description
:
A Helm chart for Kubernetes
name
:
k8s-
console
name
:
k8s-
devops
version
:
2.0
devops-chart/templates/NOTES.txt
View file @
3290bf66
...
...
@@ -4,16 +4,16 @@
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "k8s-
console
.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "k8s-
devops
.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "k8s-
console
.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "k8s-
console
.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
You can watch the status of by running 'kubectl get svc -w {{ include "k8s-
devops
.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "k8s-
devops
.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "k8s-
console
.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "k8s-
devops
.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
devops-chart/templates/_helpers.tpl
View file @
3290bf66
...
...
@@ -2,7 +2,7 @@
{
{
/*
Expand
the
name
of
the
chart
.
*/
}
}
{{- define "k8s-
console
.name" -}}
{{- define "k8s-
devops
.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
...
...
@@ -11,7 +11,7 @@ Create a default fully qualified app name.
We
truncate
at
63
chars
because
some
Kubernetes
name
fields
are
limited
to
this
(
by
the
DNS
naming
spec
).
If
release
name
contains
chart
name
it
will
be
used
as
a
full
name
.
*/
}
}
{{- define "k8s-
console
.fullname" -}}
{{- define "k8s-
devops
.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
...
...
@@ -27,6 +27,6 @@ If release name contains chart name it will be used as a full name.
{
{
/*
Create
chart
name
and
version
as
used
by
the
chart
label
.
*/
}
}
{{- define "k8s-
console
.chart" -}}
{{- define "k8s-
devops
.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
devops-chart/templates/deployment.yaml
View file @
3290bf66
...
...
@@ -3,16 +3,16 @@ kind: Deployment
metadata
:
name
:
{{
.Release.Name
}}
labels
:
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
spec
:
replicas
:
{{
.Values.replicaCount
}}
selector
:
matchLabels
:
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
template
:
metadata
:
labels
:
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
spec
:
# volumes:
# - name: tz-config
...
...
devops-chart/templates/ingress.yaml
View file @
3290bf66
{{
- if .Values.ingress.enabled -
}}
{{
- $fullName
:
= include "k8s-
console
.fullname" . -
}}
{{
- $fullName
:
= include "k8s-
devops
.fullname" . -
}}
{{
- $ingressPath
:
= .Values.ingress.path -
}}
apiVersion
:
extensions/v1beta1
kind
:
Ingress
metadata
:
name
:
{{
$fullName
}}
labels
:
app.kubernetes.io/name
:
{{
include "k8s-
console
.name" .
}}
helm.sh/chart
:
{{
include "k8s-
console
.chart" .
}}
app.kubernetes.io/name
:
{{
include "k8s-
devops
.name" .
}}
helm.sh/chart
:
{{
include "k8s-
devops
.chart" .
}}
app.kubernetes.io/instance
:
{{
.Release.Name
}}
app.kubernetes.io/managed-by
:
{{
.Release.Service
}}
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
{{
- with .Values.ingress.annotations
}}
annotations
:
{{
toYaml . | indent 4
}}
...
...
devops-chart/templates/service.yaml
View file @
3290bf66
{{
- $fullName
:
= include "k8s-
console
.fullname" . -
}}
{{
- $fullName
:
= include "k8s-
devops
.fullname" . -
}}
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
{{
$fullName
}}
labels
:
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
spec
:
type
:
{{
.Values.service.type
}}
ports
:
...
...
@@ -13,4 +13,4 @@ spec:
protocol
:
TCP
name
:
http
selector
:
app
:
{{
include "k8s-
console
.name" .
}}
app
:
{{
include "k8s-
devops
.name" .
}}
devops-chart/values-dev.yaml
View file @
3290bf66
...
...
@@ -6,16 +6,16 @@ replicaCount: 1
global
:
hub
:
harbor.dev.k2paas.com/paas-dev
image
:
repository
:
paas-
k8s-console
repository
:
paas-
devops
tag
:
dev
pullPolicy
:
IfNotPresent
nameOverride
:
"
k8s-console
"
fullnameOverride
:
"
k8s-console
"
nameOverride
:
"
devops
"
fullnameOverride
:
"
devops
"
service
:
type
:
ClusterIP
port
:
80
2
0
port
:
80
8
0
ingress
:
enabled
:
true
...
...
@@ -34,7 +34,7 @@ ingress:
#kubernetes.io/tls-acme: "true"
path
:
/
web
:
host
:
console
.dev.k2paas.com
host
:
devops
.dev.k2paas.com
port
:
http
tls
:
[]
# - secretName: k8s-console-server-tls
...
...
devops-chart/values-test.yaml
View file @
3290bf66
...
...
@@ -6,16 +6,16 @@ replicaCount: 1
global
:
hub
:
harbor.test.k2paas.com/paas-test
image
:
repository
:
paas-
k8s-console
repository
:
paas-
devops
tag
:
test
pullPolicy
:
IfNotPresent
nameOverride
:
"
k8s-console
"
fullnameOverride
:
"
k8s-console
"
nameOverride
:
"
devops
"
fullnameOverride
:
"
devops
"
service
:
type
:
ClusterIP
port
:
80
2
0
port
:
80
8
0
ingress
:
enabled
:
true
...
...
@@ -34,7 +34,7 @@ ingress:
# nginx.ingress.kubernetes.io/ssl-redirect: "true"
path
:
/
web
:
host
:
console
.test.k2paas.com
host
:
devops
.test.k2paas.com
port
:
http
tls
:
[]
...
...
devops-chart/values.yaml
View file @
3290bf66
...
...
@@ -6,16 +6,16 @@ replicaCount: 1
global
:
hub
:
harbor.k2software.com.cn/library
image
:
repository
:
paas-
k8s-console
repository
:
paas-
devops
tag
:
prod
pullPolicy
:
IfNotPresent
nameOverride
:
"
k8s-console
"
fullnameOverride
:
"
k8s-console
"
nameOverride
:
"
devops
"
fullnameOverride
:
"
devops
"
service
:
type
:
ClusterIP
port
:
80
2
0
port
:
80
8
0
ingress
:
enabled
:
true
...
...
@@ -34,7 +34,7 @@ ingress:
# nginx.ingress.kubernetes.io/ssl-redirect: "true"
path
:
/
web
:
host
:
console
.k2software.com.cn
host
:
devops
.k2software.com.cn
port
:
http
tls
:
[]
# - secretName: k8s-console-server-tls
...
...
jenkins/Jenkinsfile-dev
View file @
3290bf66
...
...
@@ -49,7 +49,7 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
])
{
node
(
label
)
{
def
version
=
"v
5.1
"
def
version
=
"v
6.0
"
stage
(
'checkout'
)
{
checkout
scm
...
...
@@ -60,17 +60,17 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
stage
(
'build'
)
{
sh
'ls -al'
// 生成静态链接所有的库
sh
'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -mod vendor -o
k8s-console
'
sh
'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -mod vendor -o
devops
'
}
stage
(
'copy-front'
)
{
def
dist_dir
=
"/mnt/k8s/online/${version}/front/
k8s_console
_front/dist"
def
dist_dir
=
"/mnt/k8s/online/${version}/front/
devops
_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"
//def tarName = "/mnt/k8s/online/${version}/images/paas-
devops
_dev-${env.BUILD_ID}.tar"
stage
(
'docker-login'
)
{
//REGISTRY_URL私有仓库地址,也可使用官方地址:docker.io
...
...
@@ -78,33 +78,33 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
}
stage
(
'docker-build'
)
{
sh
"docker build . -t ${params.REGISTRY_URL}/paas-dev/paas-
k8s-console
:dev-${env.BUILD_ID}"
sh
"docker build . -t ${params.REGISTRY_URL}/paas-dev/paas-
devops
:dev-${env.BUILD_ID}"
}
stage
(
'docker-push'
)
{
sh
"docker push ${params.REGISTRY_URL}/paas-dev/paas-
k8s-console
:dev-${env.BUILD_ID}"
sh
"docker push ${params.REGISTRY_URL}/paas-dev/paas-
devops
: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"
// sh "rm -rf /mnt/k8s/online/${version}/images/paas-
devops
_*.tar"
// sh "docker save ${params.REGISTRY_URL}/paas-dev/paas-
devops
:dev-${env.BUILD_ID} > $tarName"
// }
stage
(
'docker-rmi'
)
{
sh
"docker rmi ${params.REGISTRY_URL}/paas-dev/paas-
k8s-console
:dev-${env.BUILD_ID}"
sh
"docker rmi ${params.REGISTRY_URL}/paas-dev/paas-
devops
: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"
sh
"sed -i \"s/tag: dev/tag: dev-${env.BUILD_ID}/g\"
devops
-chart/values-dev.yaml"
//sh "helm upgrade --install devops --namespace paas devops-chart/ -f devops
-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}/"
sh
"cp -r
devops
-chart ${previewTarget}/"
}
}
}
...
...
jenkins/Jenkinsfile-prod
View file @
3290bf66
...
...
@@ -28,7 +28,7 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
])
{
node
(
label
)
{
def
version
=
"v
5.1
"
def
version
=
"v
6.0
"
stage
(
'checkout'
)
{
checkout
scm
...
...
@@ -38,20 +38,18 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
container
(
'golang'
)
{
stage
(
'build'
)
{
sh
'ls -al'
sh
"sed -i 's#appstore-server-url = http://appstore.dev.k2paas.com#appstore-server-url = https://apps.k2software.com.cn#g' conf/app.conf"
sh
"sed -i 's#http://tenant.dev.k2paas.com#https://tenant.k2software.com.cn#g' conf/app.conf"
// 生成静态链接所有的库
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"
def
dist_dir
=
"/mnt/k8s/online/${version}/front/
devops
_front/dist"
sh
"cp -r $dist_dir frontend/"
}
}
container
(
'docker'
)
{
//def tarName = "/mnt/k8s/online/${version}/images/paas-
k8s-console
_${version}-${env.BUILD_ID}.tar"
//def tarName = "/mnt/k8s/online/${version}/images/paas-
devops
_${version}-${env.BUILD_ID}.tar"
stage
(
'docker-login'
)
{
//REGISTRY_URL私有仓库地址,也可使用官方地址:docker.io
...
...
@@ -59,33 +57,33 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
}
stage
(
'docker-build'
)
{
sh
"docker build . -t ${params.REGISTRY_URL}/library/paas-
k8s-console
:${version}-${env.BUILD_ID}"
sh
"docker build . -t ${params.REGISTRY_URL}/library/paas-
devops
:${version}-${env.BUILD_ID}"
}
stage
(
'docker-push'
)
{
sh
"docker push ${params.REGISTRY_URL}/library/paas-
k8s-console
:${version}-${env.BUILD_ID}"
sh
"docker push ${params.REGISTRY_URL}/library/paas-
devops
:${version}-${env.BUILD_ID}"
}
//stage('docker-save') {
// sh "rm -rf /mnt/k8s/online/${version}/images/paas-
k8s-console
_*.tar"
// sh "docker save ${params.REGISTRY_URL}/library/paas-k8s-
console
:${version}-${env.BUILD_ID} > $tarName"
// sh "rm -rf /mnt/k8s/online/${version}/images/paas-
devops
_*.tar"
// sh "docker save ${params.REGISTRY_URL}/library/paas-k8s-
devops
:${version}-${env.BUILD_ID} > $tarName"
//}
stage
(
'docker-rmi'
)
{
sh
"docker rmi ${params.REGISTRY_URL}/library/paas-k8s-
console
:${version}-${env.BUILD_ID}"
sh
"docker rmi ${params.REGISTRY_URL}/library/paas-k8s-
devops
:${version}-${env.BUILD_ID}"
}
}
container
(
'helm'
)
{
stage
(
'helm deploy'
)
{
sh
"sed -i \"s/tag: prod/tag: ${version}-${env.BUILD_ID}/g\"
k8s-console
-chart/values.yaml"
//sh "helm upgrade --install k8s-
console --namespace paas k8s-console
-chart/"
sh
"sed -i \"s/tag: prod/tag: ${version}-${env.BUILD_ID}/g\"
devops
-chart/values.yaml"
//sh "helm upgrade --install k8s-
devops --namespace paas devops
-chart/"
def
previewTarget
=
"/mnt/k8s/online/${version}/charts"
if
(!
fileExists
(
"${previewTarget}"
))
{
sh
"mkdir -p ${previewTarget}"
}
sh
"cp -r
k8s-console
-chart ${previewTarget}/"
sh
"cp -r
devops
-chart ${previewTarget}/"
}
}
...
...
jenkins/Jenkinsfile-test
View file @
3290bf66
...
...
@@ -28,7 +28,7 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
])
{
node
(
label
)
{
def
version
=
"v
5.1
"
def
version
=
"v
6.0
"
stage
(
'checkout'
)
{
checkout
scm
...
...
@@ -38,20 +38,18 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
container
(
'golang'
)
{
stage
(
'build'
)
{
sh
'ls -al'
sh
"sed -i 's#appstore-server-url = http://appstore.dev.k2paas.com#appstore-server-url = http://apps.test.k2paas.com#g' conf/app.conf"
sh
"sed -i 's#http://tenant.dev.k2paas.com#http://tenant.test.k2paas.com#g' conf/app.conf"
// 生成静态链接所有的库
sh
'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -mod vendor -o
k8s-console
'
sh
'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -mod vendor -o
devops
'
}
stage
(
'copy-front'
)
{
def
dist_dir
=
"/mnt/k8s/online/${version}/front/
k8s_console
_front/dist"
def
dist_dir
=
"/mnt/k8s/online/${version}/front/
devops
_front/dist"
sh
"cp -r $dist_dir frontend/"
}
}
container
(
'docker'
)
{
//def tarName = "/mnt/k8s/online/${version}/images/paas-
k8s-console
_test-${env.BUILD_ID}.tar"
//def tarName = "/mnt/k8s/online/${version}/images/paas-
devops
_test-${env.BUILD_ID}.tar"
stage
(
'docker-login'
)
{
//REGISTRY_URL私有仓库地址,也可使用官方地址:docker.io
...
...
@@ -59,33 +57,33 @@ podTemplate(label: label, cloud: 'kubernetes', containers: [
}
stage
(
'docker-build'
)
{
sh
"docker build . -t ${params.REGISTRY_URL}/paas-test/paas-
k8s-console
:test-${env.BUILD_ID}"
sh
"docker build . -t ${params.REGISTRY_URL}/paas-test/paas-
devops
:test-${env.BUILD_ID}"
}
stage
(
'docker-push'
)
{
sh
"docker push ${params.REGISTRY_URL}/paas-test/paas-
k8s-console
:test-${env.BUILD_ID}"
sh
"docker push ${params.REGISTRY_URL}/paas-test/paas-
devops
:test-${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-test/paas-
k8s-console
:test-${env.BUILD_ID} > $tarName"
// sh "rm -rf /mnt/k8s/online/${version}/images/paas-
devops
_*.tar"
// sh "docker save ${params.REGISTRY_URL}/paas-test/paas-
devops
:test-${env.BUILD_ID} > $tarName"
//}
stage
(
'docker-rmi'
)
{
sh
"docker rmi ${params.REGISTRY_URL}/paas-test/paas-
k8s-console
:test-${env.BUILD_ID}"
sh
"docker rmi ${params.REGISTRY_URL}/paas-test/paas-
devops
:test-${env.BUILD_ID}"
}
}
container
(
'helm'
)
{
stage
(
'helm deploy'
)
{
sh
"sed -i \"s/tag: test/tag: test-${env.BUILD_ID}/g\"
k8s-console
-chart/values-test.yaml"
sh
"helm upgrade --install k8s-console --namespace paas k8s-console-chart/ -f k8s-console
-chart/values-test.yaml"
sh
"sed -i \"s/tag: test/tag: test-${env.BUILD_ID}/g\"
devops
-chart/values-test.yaml"
//sh "helm upgrade --install devops --namespace paas devops-chart/ -f devops
-chart/values-test.yaml"
def
previewTarget
=
"/mnt/k8s/online/${version}/charts"
if
(!
fileExists
(
"${previewTarget}"
))
{
sh
"mkdir -p ${previewTarget}"
}
sh
"cp -r
k8s-console
-chart ${previewTarget}/"
sh
"cp -r
devops
-chart ${previewTarget}/"
}
}
}
...
...
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