提交 9b0b4d23 编写于 作者: Administrator's avatar Administrator

Add new file

上级 2f7707d1
// User-defined Variables:
def ip = "192.168.140.111"
// Git Repository
def repoUrl = "$git"
// Email Address:
//def emailTo = "siyuan.zhang@picahealth.com"
// -------------------------------------------------------------------------------------
// Public Variables
def CREDENTIALSID = "cd54b3b5-9773-4fac-8272-f783a4fc24ff"
// Sonar
def SONAR_HOST_URL = "http://192.168.140.201:9000"
// vue 环境变量
def ENV_MAP = ["dev": "dev", "test": "testing", "itest":"pre","pre": "pre","prod": "production","release": "production"]
def vueAppEnv = ENV_MAP."${envProfile}"
// Set default variable IMAGE_TAG
def IMAGE_TAG = "1.0.0" //for dev
pipeline{
agent any
parameters{
gitParameter branchFilter: 'origin/(master|hotfix.*|feature.*|dev.*|.*est|testing.*|release.*|pre|prod)', defaultValue: 'release', name: 'refVar', type: 'PT_BRANCH',useRepository: "$repoUrl"
choice(name: 'tagType', choices: ['Patch', 'Minor', 'Major'], description: 'Tag Type')
choice(name: 'envProfile',choices: ['dev','test','uat', 'prod'],description: 'Environment Type')
}
// Skip Declarative: Checkout SCM stage
options {
skipDefaultCheckout true
}
stages{
stage("print variables"){
steps{
sh """
echo refVar: $refVar
echo tagType: $tagType
echo profile: ${envProfile}
printenv
"""
}
}
stage("checkout scm"){
steps{
checkout([
$class: "GitSCM",
branches: [[name: "$refVar"]],
userRemoteConfigs: [[url: "$repoUrl", credentialsId: "${CREDENTIALSID}"]]])
}
}
stage('npm install') {
parallel {
stage('install') {
steps {
nodejs('nodejs-12.22.0') {
sh """
npm config ls -l
npm i yarn -g
yarn config set registry http://192.168.110.93:4873/
yarn install --verbose
"""
}
}
}
}
}
stage('npm build') {
steps {
nodejs('nodejs-12.22.0') {
sh """
npm run build
"""
}
}
}
// Update app
stage('deploy'){
when { expression { envProfile ==~ /dev|test/ }}
steps{
sh label: '', script: """
rsync -av $WORKSPACE/dist/* root@$ip:/usr/share/nginx/html/DEV/ka/$JOB_NAME/
"""
}
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册