Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
maven_test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
郭灿峰
maven_test
Commits
beca583a
Commit
beca583a
authored
Jul 08, 2020
by
郭灿峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Jenkinsfile
parent
507b617a
Pipeline
#10
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Jenkinsfile
Jenkinsfile
+8
-3
No files found.
Jenkinsfile
View file @
beca583a
pipeline
{
pipeline
{
agent
any
agent
any
stages
{
stages
{
stage
(
'init'
)
{
script
{
env
.
imageTag
=
sh
(
script:
'git rev-parse --short HEAD ${GIT_COMMIT}'
,
returnStdout:
true
).
trim
()
}
}
stage
(
'Build'
)
{
stage
(
'Build'
)
{
steps
{
steps
{
sh
'/var/jenkins_home/plugins/apache-maven-3.6.3/bin/mvn clean package'
sh
'/var/jenkins_home/plugins/apache-maven-3.6.3/bin/mvn clean package'
...
@@ -8,13 +13,13 @@ pipeline {
...
@@ -8,13 +13,13 @@ pipeline {
}
}
stage
(
'Build image'
)
{
stage
(
'Build image'
)
{
steps
{
steps
{
sh
'docker build -t registry.lizhi.co/registry/pybbs:${
BUILD_NUMBER
} .'
sh
'docker build -t registry.lizhi.co/registry/pybbs:${
imageTag
} .'
sh
'docker push registry.lizhi.co/registry/pybbs:${
BUILD_NUMBER
}'
sh
'docker push registry.lizhi.co/registry/pybbs:${
imageTag
}'
}
}
}
}
stage
(
'deploy'
)
{
stage
(
'deploy'
)
{
steps
{
steps
{
sh
'sed -i "s#registry/pybbs#registry/pybbs:${
BUILD_NUMBER
}#g" docker-compose.yml'
sh
'sed -i "s#registry/pybbs#registry/pybbs:${
imageTag
}#g" docker-compose.yml'
sh
'scp ./docker-compose.yml 10.10.10.115:/app'
sh
'scp ./docker-compose.yml 10.10.10.115:/app'
sh
'ssh 10.10.10.115 "cd /app ; docker-compose down && docker-compose up -d "'
sh
'ssh 10.10.10.115 "cd /app ; docker-compose down && docker-compose up -d "'
}
}
...
...
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