Commit fb59b693 authored by 谢宇轩's avatar 谢宇轩

edit jenkins file

parent 7a7ea1b1
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'
}
}
}
......
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