Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
B
building-a-multibranch-pipeline-project
Project
Project
Details
Activity
Releases
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
谢宇轩
building-a-multibranch-pipeline-project
Commits
646d9efd
Commit
646d9efd
authored
Jun 21, 2022
by
谢宇轩
😅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'editJenkins' into 'master'
Edit jenkins See merge request
!2
parents
a13a3bda
d0fb32c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
5 deletions
+77
-5
Jenkinsfile
Jenkinsfile
+76
-4
App.js
src/App.js
+1
-1
No files found.
Jenkinsfile
View file @
646d9efd
pipeline
{
pipeline
{
agent
any
agent
{
docker
{
image
'node:6-alpine'
args
'-p 3000:3000 -p 5000:5000'
}
}
environment
{
CI
=
'true'
}
parameters
{
choice
(
choices:
[
'Deploy'
,
'Rollback'
],
description:
'''Deploy:【发布】
Rollback:【回滚】'''
,
name:
'Deploy'
)
gitParameter
(
requiredParameter:
true
,
description:
'Version:【版本】'
,
name:
'DeployVersion'
,
selectedValue:
'TOP'
,
sortMode:
'DESCENDING_SMART'
,
type:
'PT_TAG'
)
}
stages
{
stages
{
stage
(
'Build'
)
{
stage
(
'Build dev'
)
{
when
{
branch
'developer'
}
steps
{
sh
'npm install'
}
}
stage
(
'Build master'
)
{
when
{
branch
'master'
}
steps
{
script
{
if
(
params
.
Deploy
==
"Rollback"
)
{
echo
"回滚到 $DeployVersion 版本"
sh
"git reset --hard $DeployVersion"
}
else
{
echo
"拉取 $DeployVersion 版本"
sh
"git checkout $DeployVersion"
}
}
sh
'npm install'
}
}
stage
(
'Test'
)
{
steps
{
sh
'echo "testing!"'
echo
"test complete!"
}
}
stage
(
'Deliver for development'
)
{
when
{
branch
'developer'
}
steps
{
sh
'./jenkins/scripts/deliver-for-development.sh'
input
message:
'Finished using the web site? (Click "Proceed" to continue)'
sh
'./jenkins/scripts/kill.sh'
}
}
stage
(
'Deploy for production'
)
{
when
{
branch
'master'
}
steps
{
steps
{
sh
'echo "Hello world!"'
sh
'./jenkins/scripts/deploy-for-production.sh'
input
message:
'Finished using the web site? (Click "Proceed" to continue)'
sh
'./jenkins/scripts/kill.sh'
}
}
}
}
}
}
...
...
src/App.js
View file @
646d9efd
...
@@ -11,7 +11,7 @@ class App extends Component {
...
@@ -11,7 +11,7 @@ class App extends Component {
<
h1
className
=
"App-title"
>
Welcome
to
React
<
/h1
>
<
h1
className
=
"App-title"
>
Welcome
to
React
<
/h1
>
<
/header
>
<
/header
>
<
p
className
=
"App-intro"
>
<
p
className
=
"App-intro"
>
To
get
started
,
edit
<
code
>
src
/
App
.
js
<
/code> and save to reload
.
To
get
started
,
edit
<
code
>
src
/
App
.
js
<
/code> and save to reload.
We are in master right now
!
<
/p
>
<
/p
>
<
/div
>
<
/div
>
);
);
...
...
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