Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
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
zhiwei
searchhotcrawler
Commits
c263ec99
Commit
c263ec99
authored
Dec 17, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Jenkinsfile
parent
5bb24aa2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
Jenkinsfile
+35
-8
No files found.
Jenkinsfile
View file @
c263ec99
...
@@ -15,6 +15,30 @@ pipeline {
...
@@ -15,6 +15,30 @@ pipeline {
)
)
}
}
stages
{
stages
{
stage
(
'Static code inspection'
)
{
steps
{
echo
"starting codeAnalyze with SonarQube......"
withSonarQubeEnv
(
'sonarqube'
)
{
sh
"/apache-maven-3.6.3/bin/mvn clean sonar:sonar"
}
script
{
timeout
(
1
)
{
waitForQualityGate
abortPipeline:
true
}
}
}
post
{
success
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 马黎滨 -c 'Code check passed'"
}
failure
{
sh
"/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 马黎滨 -c 'Code check failed, please log in http://sonar.zhiweidata.com to view check information'"
}
}
}
stage
(
'build'
)
{
stage
(
'build'
)
{
when
{
branch
'master'
}
when
{
branch
'master'
}
steps
{
steps
{
...
@@ -32,13 +56,14 @@ pipeline {
...
@@ -32,13 +56,14 @@ pipeline {
}
}
}
}
}
}
stage
(
'build image'
)
{
stage
(
'build image'
)
{
when
{
branch
'master'
}
when
{
branch
'master'
}
steps
{
steps
{
withCredentials
([
usernamePassword
(
credentialsId:
'docker
hub'
,
passwordVariable:
'dockerhubPassword'
,
usernameVariable:
'dockerh
ubUser'
)])
{
withCredentials
([
usernamePassword
(
credentialsId:
'docker
Hub'
,
passwordVariable:
'dockerHubPassword'
,
usernameVariable:
'dockerH
ubUser'
)])
{
sh
"docker login -
-username ${dockerhubUser} --password ${dockerhubPassword} harbor.docker.zhiweireach.com"
sh
"docker login -
u ${dockerHubUser} -p ${dockerHubPassword} harbor.docker.zhiweireach.com"
sh
"
docker build -t harbor.docker.zhiweireach.com/crawler/searchhot-crawler
:${env.BUILD_NUMBER} . "
sh
"
docker build -t harbor.docker.zhiweireach.com/daemon/${env.JOB_NAME}
:${env.BUILD_NUMBER} . "
}
}
}
}
post
{
post
{
success
{
success
{
...
@@ -49,8 +74,11 @@ stage('build image') {
...
@@ -49,8 +74,11 @@ stage('build image') {
stage
(
'push image'
)
{
stage
(
'push image'
)
{
when
{
branch
'master'
}
when
{
branch
'master'
}
steps
{
steps
{
sh
" docker login --username admin --password JinxiaoZhang...701 harbor.docker.zhiweireach.com"
withCredentials
([
usernamePassword
(
credentialsId:
'dockerHub'
,
passwordVariable:
'dockerHubPassword'
,
usernameVariable:
'dockerHubUser'
)])
{
sh
" docker push harbor.docker.zhiweireach.com/crawler/searchhot-crawler:${env.BUILD_NUMBER}"
sh
"docker login -u ${dockerHubUser} -p ${dockerHubPassword} harbor.docker.zhiweireach.com"
sh
"docker push harbor.docker.zhiweireach.com/daemon/${env.JOB_NAME}:${env.BUILD_NUMBER}"
}
}
}
post
{
post
{
success
{
success
{
...
@@ -61,8 +89,7 @@ stage('build image') {
...
@@ -61,8 +89,7 @@ stage('build image') {
stage
(
'deploy'
)
{
stage
(
'deploy'
)
{
when
{
branch
'master'
}
when
{
branch
'master'
}
steps
{
steps
{
sh
"kubectl version"
sh
"kubectl -n daemon set image deployment/searchhotcrawler searchhotcrawler=harbor.docker.zhiweireach.com/daemon/${env.JOB_NAME}:${env.BUILD_NUMBER} --record"
sh
"kubectl -n default set image deployment/searchhot-crawler searchhot-crawler=harbor.docker.zhiweireach.com/crawler/searchhot-crawler:${env.BUILD_NUMBER} --record"
}
}
post
{
post
{
success
{
success
{
...
...
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