dave-hagedorn / jenkins-runner

VS Code plugin to develop and run Jenkins Pipeline scripts
MIT License
30 stars 8 forks source link

Cannot run twice a pipeline with parameters #34

Open fredericminatchy opened 3 years ago

fredericminatchy commented 3 years ago

Hi,

I am trying to deploy a pipeline with parameters twice. The first run, everything goes well. On Jenkins server I have a build with beautiful interactives components. Unfortunatly on the second runI have a log error telling me that he cannot connect to the server. Nonetheless, as a workaround, after the first run, I can go in the configuration form on the Jenkins server and remove all the nearly created components. Is there a way to run the pipeline script several time without having to clear the form first?

There is the pipeline script :

pipeline {
    agent any
    stages {
        stage('Setup parameters') {
            steps {
                script { 
                    properties([
                        parameters([
                            choice(
                                choices: ['ONE', 'TWO'], 
                                name: 'PARAMETER_01'
                            ),
                            booleanParam(
                                defaultValue: true, 
                                description: '', 
                                name: 'BOOLEAN'
                            ),
                            text(
                                defaultValue: '''
                                this is a multi-line 
                                string parameter example
                                ''', 
                                 name: 'MULTI-LINE-STRING'
                            ),
                            string(
                                defaultValue: 'scriptcrunch', 
                                name: 'STRING-PARAMETER', 
                                trim: true
                            )
                        ])
                    ])
                }
            }
        }
    }   
}

There is the first run :

"Started by user admin Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /appl/.jenkins/workspace/Sylx/Selector [Pipeline] { [Pipeline] stage [Pipeline] { (Setup parameters) [Pipeline] script [Pipeline] { [Pipeline] properties [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS"

The second run :

"[2020-11-21 11:20:29.256] [Jenkins] [info] Creating Jenkins instance @url=http://ca1dapp02:8081, with user=admin, password=**** [2020-11-21 11:20:29.257] [Jenkins] [info] Creating pipeline build using job SylX/Selector @http://ca1dapp02:8081, with params undefined [2020-11-21 11:20:29.257] [Jenkins] [info] Fetching remote XML config for job SylX/Selector @http://ca1dapp02:8081 [2020-11-21 11:20:29.383] [Jenkins] [info] Parsing and updating XML with new pipeline script [2020-11-21 11:20:29.383] [Jenkins] [info] Environment for job: undefined [2020-11-21 11:20:29.383] [Jenkins] [info] Pushing remote XML config for job SylX/Selector @http://ca1dapp02:8081 [2020-11-21 11:20:29.634] [Jenkins] [info] Fetching next job number job SylX/Selector @http://ca1dapp02:8081 [2020-11-21 11:20:29.774] [Jenkins] [info] Next job number: 25 [2020-11-21 11:20:29.774] [Jenkins] [info] Starting build #25 of job SylX/Selector @http://ca1dapp02:8081 [2020-11-21 11:20:29.774] [Jenkins] [info] Parameters: undefined [2020-11-21 11:20:30.016] [Jenkins] [error] Error starting job SylX/Selector #25 @http://ca1dapp02:8081}: Error: jenkins: job.build: bad request" [2020-11-21 11:20:30.016] [Jenkins] [error]

Error 400 Nothing is submitted

HTTP ERROR 400 Nothing is submitted

URI:/job/SylX/job/Selector/build
STATUS:400
MESSAGE:Nothing is submitted
SERVLET:Stapler

Powered by Jetty:// 9.4.30.v20200611

"[2020-11-21 11:20:33.872] [Jenkins] [info] Stopping job SylX/Selector #25 @http://ca1dapp02:8081 [2020-11-21 11:20:33.872] [Jenkins] [info] Stopping job SylX/Selector #25 @http://ca1dapp02:8081"

Thanks a bunch for this very impresive VS extension !

atkrv commented 3 years ago

I have the same issue. @dave-hagedorn could you please assist!