I'm using this Jenkins pipeline to create parameters from a list of directories in a Gitlab repository. New folders are constantly being uploaded to this repository, but i forced to execute this Pipeline each time that commit is executed (I want execute Jenkins pipeline manually and select an specific directory). How can I update parameters list without run pipeline job?
node {
checkout scm
def backups = sh(returnStdout: true, script: "ls $WORKSPACE")
backups.split().each {
backupArray << it
}
}
pipeline {
parameters { choice(name: 'BACKUP', choices: backupArray, description: 'Selecciona el backup para realizar el Rollback') }
agent any
stages {
stage('Realizando el Rollback con el Backup seleccionado') {
steps {
script {
sh "echo Se realiza el Rollback con el Backup $params.BACKUP"
withCredentials([string(credentialsId: 'ID', variable: 'VARIABLE')]) {
sh "script.sh $params.BACKUP"
}
}
}
}
}
post {
always {
script {
sh 'rm -rf *'
}
}
}
}