update jenkinsfile
This commit is contained in:
parent
37b5eca152
commit
3ca1df03ec
47
ansible/Jenkinsfile
vendored
47
ansible/Jenkinsfile
vendored
@ -13,22 +13,22 @@ pipeline {
|
|||||||
parameters {
|
parameters {
|
||||||
choice(
|
choice(
|
||||||
name: 'DEPLOY_TARGET',
|
name: 'DEPLOY_TARGET',
|
||||||
choices: ['SiteA', 'SiteB', 'All'],
|
choices: ['SiteA', 'SiteB', 'proxy', 'SiteA&proxy', 'SiteB&proxy', 'All'],
|
||||||
description: 'Выберите сайты для развертывания'
|
description: 'Выберите цели для развертывания'
|
||||||
)
|
)
|
||||||
|
|
||||||
string(name: 'ADDITIONAL_CONTENT_SITEA_H2', defaultValue: 'Новое сообщение для SiteA', description: 'Дополнительный <h2> контент для SiteA')
|
string(
|
||||||
string(name: 'ADDITIONAL_CONTENT_SITEA_P', defaultValue: 'Дополнительный параграф для SiteA', description: 'Дополнительный <p> контент для SiteA')
|
name: 'ADDITIONAL_CONTENT',
|
||||||
|
defaultValue: 'Новое сообщение',
|
||||||
string(name: 'ADDITIONAL_CONTENT_SITEB_H2', defaultValue: 'Новое сообщение для SiteB', description: 'Дополнительный <h2> контент для SiteB')
|
description: 'Дополнительный параграф'
|
||||||
string(name: 'ADDITIONAL_CONTENT_SITEB_P', defaultValue: 'Дополнительный параграф для SiteB', description: 'Дополнительный <p> контент для SiteB')
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Decrypt SSH Key') {
|
stage('Decrypt SSH Key') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def tempDir = '/tmp/' + UUID.randomUUID().toString()
|
def tempDir = "/tmp/${UUID.randomUUID().toString()}"
|
||||||
env.TEMP_DIR = tempDir
|
env.TEMP_DIR = tempDir
|
||||||
sh "mkdir -p ${tempDir}"
|
sh "mkdir -p ${tempDir}"
|
||||||
|
|
||||||
@ -56,21 +56,34 @@ pipeline {
|
|||||||
|
|
||||||
switch(params.DEPLOY_TARGET) {
|
switch(params.DEPLOY_TARGET) {
|
||||||
case 'SiteA':
|
case 'SiteA':
|
||||||
selectedHosts = 'SiteA,proxy'
|
selectedHosts = 'SiteA'
|
||||||
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_SITEA_H2
|
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT
|
||||||
extraVars.siteA_p = params.ADDITIONAL_CONTENT_SITEA_P
|
extraVars.siteA_p = params.ADDITIONAL_CONTENT
|
||||||
break
|
break
|
||||||
case 'SiteB':
|
case 'SiteB':
|
||||||
|
selectedHosts = 'SiteB'
|
||||||
|
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT
|
||||||
|
extraVars.siteB_p = params.ADDITIONAL_CONTENT
|
||||||
|
break
|
||||||
|
case 'proxy':
|
||||||
|
selectedHosts = 'proxy'
|
||||||
|
break
|
||||||
|
case 'SiteA&proxy':
|
||||||
|
selectedHosts = 'SiteA,proxy'
|
||||||
|
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT
|
||||||
|
extraVars.siteA_p = params.ADDITIONAL_CONTENT
|
||||||
|
break
|
||||||
|
case 'SiteB&proxy':
|
||||||
selectedHosts = 'SiteB,proxy'
|
selectedHosts = 'SiteB,proxy'
|
||||||
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_SITEB_H2
|
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT
|
||||||
extraVars.siteB_p = params.ADDITIONAL_CONTENT_SITEB_P
|
extraVars.siteB_p = params.ADDITIONAL_CONTENT
|
||||||
break
|
break
|
||||||
case 'All':
|
case 'All':
|
||||||
selectedHosts = 'SiteA,SiteB,proxy'
|
selectedHosts = 'SiteA,SiteB,proxy'
|
||||||
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT_SITEA_H2
|
extraVars.siteA_h2 = params.ADDITIONAL_CONTENT
|
||||||
extraVars.siteA_p = params.ADDITIONAL_CONTENT_SITEA_P
|
extraVars.siteA_p = params.ADDITIONAL_CONTENT
|
||||||
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT_SITEB_H2
|
extraVars.siteB_h2 = params.ADDITIONAL_CONTENT
|
||||||
extraVars.siteB_p = params.ADDITIONAL_CONTENT_SITEB_P
|
extraVars.siteB_p = params.ADDITIONAL_CONTENT
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
error "Неизвестный DEPLOY_TARGET: ${params.DEPLOY_TARGET}"
|
error "Неизвестный DEPLOY_TARGET: ${params.DEPLOY_TARGET}"
|
||||||
|
Loading…
Reference in New Issue
Block a user