Add handler to check if jenkins is alive

Change-Id: I63c14ab98a0acc8813a76ff71a9c29a8942e356b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-12-23 16:33:24 -05:00
parent 745ed2c9db
commit 5ab08b0266
3 changed files with 14 additions and 1 deletions

View File

@ -47,3 +47,7 @@ jenkins_job_builder_install_method: git
jenkins_job_builder_pip_name: jenkins-job-builder
jenkins_job_builder_pip_version:
# handlers/main.yaml
jenkins_job_builder_handler_check_delay: 10
jenkins_job_builder_handler_check_retries: 3

View File

@ -12,6 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Check jenkins
delay: " {{ jenkins_job_builder_handler_check_delay }}"
shell: "curl --head --silent {{ jenkins_job_builder_config_jenkins_url }}"
register: result
retries: "{{ jenkins_job_builder_handler_check_retries }}"
until: result.stdout.find('200 OK') != -1
- name: Reload jenkins-jobs
shell: "jenkins-jobs --conf {{ jenkins_job_builder_template_jenkins_jobs_ini_dest }} update {{ jenkins_job_builder_file_jobs_dest }} --delete-old"
sudo: yes

View File

@ -45,4 +45,6 @@
perms: yes
src: "{{ jenkins_job_builder_file_jobs_src }}"
when: jenkins_job_builder_file_jobs_src != ""
notify: Reload jenkins-jobs
notify:
- Check jenkins
- Reload jenkins-jobs