generated from gCubeCI/Pipeline-Docker-Template
add input parameters in order to launch the pipeline manually; add new stage dedicated to the manually execution
This commit is contained in:
parent
3028ffc459
commit
4f2aeb5920
|
@ -25,6 +25,15 @@ if (params.deployFile) {
|
|||
}
|
||||
backupList = agent_root_folder+'/'+agent_deploy_backup_filename;
|
||||
|
||||
//locate the targetHost file
|
||||
//String targetHostURL = "https://code-repo.d4science.org/gCubeCI/gCubeDeployer/raw/branch/master/open/gcube-${gCube_release_version}.yaml"
|
||||
//if (verbose)
|
||||
// println "Querying ${targetHostURL}"
|
||||
//load the release file
|
||||
//def text = targetHostURL.toURL().getText()
|
||||
|
||||
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
label 'CD'
|
||||
|
@ -50,7 +59,23 @@ pipeline {
|
|||
TRIGGER_HOST="${params.TRIGGER_HOST}"
|
||||
TRIGGER_CD="${params.TRIGGER_CD}"
|
||||
}
|
||||
|
||||
|
||||
parameters {
|
||||
string(name: 'TRIGGER_JOB',
|
||||
defaultValue: '',
|
||||
description: 'Name of the service or job to deploy')
|
||||
string(name: 'TRIGGER_VERSION',
|
||||
defaultValue: '',
|
||||
description: 'service version to deploy')
|
||||
string(name: 'TRIGGER_HOST',
|
||||
defaultValue: '',
|
||||
description: 'Target Host / Host group where deploy the service')
|
||||
booleanParam(name: 'TRIGGER_CD',
|
||||
defaultValue: true,
|
||||
description: 'Set to false to avoid current deploy')
|
||||
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Initialize environment') {
|
||||
steps {
|
||||
|
@ -71,7 +96,7 @@ pipeline {
|
|||
echo 'Cron build enabled. Deploy from system ongoing'
|
||||
script {
|
||||
// parse the report and extract the data
|
||||
def components = gettComponentsFromCSV(deployList)
|
||||
def components = getComponentsFromCSV(deployList)
|
||||
if (components.size() > 0) {
|
||||
for (component in components) {
|
||||
stage(component){
|
||||
|
@ -147,6 +172,24 @@ pipeline {
|
|||
|
||||
}
|
||||
}
|
||||
stage('Deploy manually ') {
|
||||
when{
|
||||
allOf{
|
||||
environment name: 'IS_CRON', value: 'False';
|
||||
triggeredBy 'UserIdCause'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
echo "Cron build disabled. Pipeline executed Manually. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing"
|
||||
ansiColor("xterm") {
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
|
||||
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
Loading…
Reference in New Issue