how do I generate dynamic declarative pipeline post stage using JobDSL?

17 views
Skip to first unread message

Kalle Narinen

unread,
May 22, 2023, 8:15:48 AM5/22/23
to job-dsl-plugin
hi, I try to create post stage like this. Why is this not working for post definition?
This is the error I get: 
No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.post() is applicable for argument types: (seed_job$_createPipelineJob_closure7$_closure24) values: [seed_job$_createPipelineJob_closure7$_closure24]


def Job job = jobDslContext.pipelineJob("${projectName}/${jobName}")
    job.with {
        description("${jobDescription}")
    }
    job.with {
        definition {
            cps {
                script(jobDslContext.readFileFromWorkspace(templatePath)
                )
                sandbox()
            }
        }
    }
    job.with {
        post {
            always {
                println "always"
            }
        }
    }
Reply all
Reply to author
Forward
0 new messages