0

In Jenkins I want to set a field in the parameters section depending on the value on a parameters set in properties folder.

Each time I try to use withFolderProperties outside stages sections, I've an error. so I ask the next question...

Can I use it for my need ?

here my code :

pipeline {
    agent {
         label "xxx.yyy" 
    }

    parameters {
        /* it doen't work*/
        withFolderProperties{
                    choice(name: 'Projet', choices: [${cicdListeProjets}], description: 'Projet concerne')
        }
    }

    tools {
        jdk 'openjdk-8'
    }

    options {
        buildDiscarder(logRotator(numToKeepStr: '5'))
        disableConcurrentBuilds()
    }

    stages {
       
        stage('Checkout') {
            steps {
                checkout(...)
            }
        }

        stage('Build') {
             steps {    
                sh """
                    echo "$Projet"
                """
            }
        }
    }
}

thanks

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
Michel
  • 1

1 Answers1

0

According to the documentation, withFolderProperties is a Pipeline Step. Steps must be put in a steps section of your Declarative Pipeline.

jayhendren
  • 1,014
  • 5
  • 12