meierw.jenkins_job_dsl_exec

jenkins_job_dsl_exec

Build Status

This is an Ansible role that creates, runs, and then deletes a temporary Jenkins job that contains a Job DSL script.

Requirements

  • You need a Jenkins service with the Job DSL plugin installed.
  • You must be able to run jenkins_script on that Jenkins service.

Role Variables

jenkins_job_dsl_url: http://localhost:8080
jenkins_job_dsl_user: admin
jenkins_job_dsl_password: admin

These are the URL, username, and password for logging into Jenkins. They will be used to run jenkins_script.


jenkins_job_dsl_temp_job_name: C4lpe7GMX8S0pdZV6RWbKAkBfKWCPAOgAL9MGL03

This is the name of the temporary job for running the DSL script. It should be a complex string to avoid conflicts with real job names.


jenkins_job_dsl_content: |
    job('dsl-example-job') {
        steps {
            shell('echo Hello world!')
        }
    }

This is the DSL script that will be run. You can write it inline like in the example, or you can use something like jenkins_job_dsl_content: "{{ lookup('file', 'files/myDslScript.groovy') }}" for a cleaner playbook.


jenkins_job_dsl_temp_job_run: true

This determines if the new temporary job should be run. You can set this to false if you have a different plan for when or how to run it.


jenkins_job_dsl_temp_job_delete: true

This decides if the temporary job should be deleted after it runs. You might want to set this to false if you are having issues and need to check the build log in Jenkins. It does nothing if jenkins_job_dsl_temp_job_run is false.


jenkins_job_dsl_temp_job_running_checks: 10

This is how many times the role will check if the job has stopped running before deleting it. The checks happen every second, making this the total check time in seconds. It does nothing if jenkins_job_dsl_temp_job_delete is false.

Example Playbook

- hosts: servers
  roles:
    - { role: meierw.jenkins_job_dsl_exec }

License

MIT

Author Information

Informazioni sul progetto

Creates, executes and then deletes a temporary Jenkins job containing a Job DSL script.

Installa
ansible-galaxy install meierw.jenkins_job_dsl_exec
Licenza
mit
Download
149
Proprietario