blob: 207edadf191a831f2489551be908ad4c2e78406c [file] [log] [blame]
---
# jenkins molecule/default/verify.yml
#
# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: Verify
hosts: all
vars:
jenkins_localhost: "127.0.0.1:8080"
jenkins_admin_username: "admin"
jenkins_admin_password: "changeme"
jenkins_job_builder_conf: "/tmp/jenkins.conf"
tasks:
- name: Check Jenkins instance accessibility
uri:
url: "http://{{ jenkins_localhost }}/cli/"
method: GET
return_content: "yes"
timeout: 5
body_format: raw
follow_redirects: "no"
status_code: 200,403
register: result
until: (result.status == 403 or result.status == 200)
and (result.content.find("Please wait while") == -1)
retries: 60
delay: 5
- name: Install pip
apt:
name: python3-pip
- name: Install jenkins job builder
pip:
name: jenkins-job-builder
- name: Create file with Jenkins conf for JJB
copy:
dest: "{{ jenkins_job_builder_conf }}"
mode: 0400
content: |
[jenkins]
user={{ jenkins_admin_username }}
password={{ jenkins_admin_password }}
url=http://localhost:8080
- name: List jobs via JJB tools
command: "jenkins-jobs --conf {{ jenkins_job_builder_conf }} list"
register: plugins_contents
changed_when: false
- name: Assert we are able to access Jenkins with admin username and password.
assert:
that:
- "'INFO:root:Matching jobs: 0' in plugins_contents.stderr"