Commit 646d9efd authored by 谢宇轩's avatar 谢宇轩 😅

Merge branch 'editJenkins' into 'master'

Edit jenkins

See merge request !2
parents a13a3bda d0fb32c0
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 {
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 {
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'
}
}
}
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ class App extends Component {
<h1 className="App-title">Welcome to React</h1>
</header>
<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>
</div>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment