-2

I have genrated jenkinsfile through python script. I want to integrate that jenkinsfile with JobDSL through code.

I want to integrate genrated jenkinsfile with JobDSL through code. how to do this?

1 Answers1

1

I guess you mean to integrate the generated Jenkinsfile in the dsl script of creating a pipeline job.
We have script like below in our project:

pipelineJob(<job_name>) {
    ...
    definition {
        cpsScm {
            ...
            scm {
                git {
                    branch("master")
                    remote {
                        url(<gerrit_repo_url>)
                        credentials(<credential_to_access_the_repo_if_any>)
                        ...
                    }
                }
                scriptPath("path/to/the/Jenkinsfile")
            }
        }
    }
}

It clones a git repo and uses a Jenkinsfile in the repo.

Andy Jiang
  • 38
  • 4