Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
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
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
shenjunjie
brandkbs2
Commits
def158b2
Commit
def158b2
authored
Jun 28, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
722d4983
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
Jenkinsfile
+92
-0
No files found.
Jenkinsfile
0 → 100644
View file @
def158b2
def
projectName
=
'brandkbs2'
def
projectType
=
'application'
def
pmName
=
'沈君杰'
def
pmMail
=
'shenjunjie@zhiweidata.com'
def
opName
=
'张金晓'
def
opMail
=
'tom@zhiweidata.com'
pipeline
{
agent
{
label
'jenkins-jnlp'
}
triggers
{
GenericTrigger
(
genericVariables:
[
[
key:
'ref'
,
value:
'$.ref'
]
],
causeString:
'Triggered on $ref'
,
token:
"${projectName}"
,
printContributedVariables:
true
,
printPostContent:
true
,
silentResponse:
false
,
regexpFilterText:
'$ref'
,
regexpFilterExpression:
'refs/heads/'
+
BRANCH_NAME
)
}
stages
{
stage
(
'build'
)
{
when
{
branch
'dev'
}
steps
{
sh
'/apache-maven-3.6.3/bin/mvn clean package -Dmaven.test.skip=true -U'
}
post
{
success
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈君杰 -c 项目编译成功进行下一阶段"
}
failure
{
step
([
$class
:
'Mailer'
,
notifyEveryUnstableBuild:
true
,
recipients:
"shenjunjie@zhiweidata.com"
,
sendToIndividuals:
true
])
}
}
}
stage
(
'build image'
)
{
when
{
branch
'dev'
}
steps
{
withCredentials
([
usernamePassword
(
credentialsId:
'dockerHub'
,
passwordVariable:
'dockerHubPassword'
,
usernameVariable:
'dockerHubUser'
)])
{
sh
"docker login -u ${dockerHubUser} -p ${dockerHubPassword} harbor.docker.zhiweidata.top"
sh
"docker build -t harbor.docker.zhiweidata.top/${projectType}/${env.JOB_NAME}:${env.BUILD_NUMBER} ."
}
}
post
{
failure
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈君杰 -c 镜像构建失败请查看详细信息"
}
}
}
stage
(
'push image'
)
{
when
{
branch
'dev'
}
steps
{
withCredentials
([
usernamePassword
(
credentialsId:
'dockerHub'
,
passwordVariable:
'dockerHubPassword'
,
usernameVariable:
'dockerHubUser'
)])
{
sh
"docker login -u ${dockerHubUser} -p ${dockerHubPassword} harbor.docker.zhiweidata.top"
sh
"docker push harbor.docker.zhiweidata.top/${projectType}/${env.JOB_NAME}:${env.BUILD_NUMBER}"
}
}
post
{
failure
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈君杰 -c 镜像push成功进行下一阶段"
}
}
}
stage
(
'deploy'
)
{
when
{
branch
'dev'
}
steps
{
sh
"kubectl -n ${projectType}-test set image deployment/${projectName} ${projectName}=harbor.docker.zhiweidata.top/${projectType}/${env.JOB_NAME}:${env.BUILD_NUMBER} --record"
}
post
{
success
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈君杰 -c k8spod已部署更新成功"
}
failure
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈君杰 -c k8spod部署更新失败"
}
}
}
}
}
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