You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.0 KiB

pipeline {
agent any
environment {
VERSION = '1.0.0'
}
stages {
stage('Build') {
steps {
echo 'Building..'
echo '编译环境....'
sh 'printenv'
echo 'mvn版本信息..'
sh 'npm --version'
sh 'npm config set registry https://registry.npm.taobao.org'
echo '编译工程....'
}
}
stage('Test') {
steps {
echo 'Testing..'
echo '单元测试....'
}
}
stage('Deploy') {
steps {
echo '------------------- 安装依赖包 -------------------'
sh 'npm rebuild node-sass'
sh 'cnpm install'
echo '------------------- 编译测试环境 ------------------'
sh 'npm run build:show'
sh 'cat package.json |jq .build_test | xargs docker build . -t'
echo '------------------- 推送测试版本镜像 -------------------'
sh 'cat package.json |jq .build_test | xargs docker push'
echo '------------------- 编译正式环境环境 -------------------'
sh 'npm run build:prod'
sh 'cat package.json |jq .build_prod | xargs docker build . -t'
}
}
}
post {
always {
echo 'icharge--This will always run'
}
success {
echo 'icharge--This will run only if successful'
}
failure {
echo 'icharge--This will run only if failed'
}
unstable {
echo 'icharge--This will run only if the run was marked as unstable'
}
changed {
echo 'icharge--This will run only if the state of the Pipeline has changed'
echo 'icharge--For example, if the Pipeline was previously failing but is now successful'
}
}
}