Create Jenkins Docker Image with pre configured jobs

前端 未结 3 380
渐次进展
渐次进展 2021-02-05 23:11

I have created a bunch of Local deployment pipeline jobs, these jobs do things like remove an existing container, build a service locally, build a docker image, run the containe

3条回答
  •  无人及你
    2021-02-05 23:36

    Jobs need to bootstrapped while the Jenkins starts can be copied to /usr/share/jenkins/ref/jobs/ folder.

    But keep in mind that if the jobs(or any) already exist in Jenkins home folder, updates from /usr/share/jenkins/ref/jobs/ folder won't have any effect unless you end the files with *.override name. https://github.com/jenkinsci/docker/blob/master/jenkins-support#L110

    Dockerfile

    # First time building of jenkins with the preconfigured job
    COPY job_name/config.xml /usr/share/jenkins/ref/jobs/job_name/config.xml
    
    # But if jobs need to be updated, suffix the file names with '.override'.
    COPY job_name/config.xml.override /usr/share/jenkins/ref/jobs/job_name/config.xml.override
    

提交回复
热议问题