Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangdongdong
test
Commits
27880a1a
Commit
27880a1a
authored
Mar 31, 2021
by
zhangdd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore:chore jenkinsfile
Signed-off-by:
zhangdd
<
86431843@qq.com
>
parent
b173a219
Pipeline
#126
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
28 deletions
+1
-28
Jenkinsfile
Jenkinsfile
+1
-28
No files found.
Jenkinsfile
View file @
27880a1a
node
{
stage
(
'Git Checkout'
){
checkout
([
$class
:
'GitSCM'
,
branches:
[[
name:
'$Branches'
]],
doGenerateSubmoduleConfigurations:
false
,
extensions:
[],
gitTool:
'Default'
,
submoduleCfg:
[],
userRemoteConfigs:
[[
credentialsId:
'a97e0ce1-814b-4e7d-832a-4ac3eed72506'
,
url:
'git@gitlab.schbrain.com:
schbrain/backend/kp/kp-datav
.git'
]]])
checkout
([
$class
:
'GitSCM'
,
branches:
[[
name:
'$Branches'
]],
doGenerateSubmoduleConfigurations:
false
,
extensions:
[],
gitTool:
'Default'
,
submoduleCfg:
[],
userRemoteConfigs:
[[
credentialsId:
'a97e0ce1-814b-4e7d-832a-4ac3eed72506'
,
url:
'git@gitlab.schbrain.com:
zhangdongdong/test
.git'
]]])
}
stage
(
'Maven Build'
){
sh
"/var/jenkins_home/tools/apache-maven-3.6.3/bin/mvn clean -U package -Dversion=${version} -Dmaven.test.skip=true -P${profiles}"
}
stage
(
'Build & Push Image'
){
sh
'''
Registry=registry-vpc.cn-hangzhou.aliyuncs.com
ProjectName=$Registry/schbrain/kp-datav
docker build -t $ProjectName:${version} --build-arg APP_NAME_SRC=kp-datav-web-${version}.jar -f Dockerfile .
docker push $ProjectName:${version}
docker rmi $ProjectName:${version}
'''
}
stage
(
'Deploy to K8S'
){
if
(
profiles
==
'dev'
)
{
echo
'接下来进行开发环境下项目的发布...'
sh
'''
sed -i "/image/{s/latest/${version}/}" b-k8s-deploy-dev.yaml
sed -i "/profiles/{s/profiles/${profiles}/}" b-k8s-deploy-dev.yaml
kubectl apply -f b-k8s-deploy-dev.yaml
'''
}
if
(
profiles
==
'prod'
)
{
echo
'接下来进行生产环境下项目的发布...'
sh
'''
sed -i "/image/{s/latest/${version}/}" b-k8s-deploy-prod.yaml
sed -i "/profiles/{s/profiles/${profiles}/}" b-k8s-deploy-prod.yaml
~/kubectl --kubeconfig ~/.kube/config.prod apply -f b-k8s-deploy-${profiles}.yaml
'''
}
}
stage
(
'Post-Build'
)
{
script
{
currentBuild
.
description
=
"${version} - ${Branches}"
...
...
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