blob: 207edadf191a831f2489551be908ad4c2e78406c [file] [log] [blame]
Hung-Wei Chiu80dc18d2020-10-20 23:56:46 +00001---
2# jenkins molecule/default/verify.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: Verify
8 hosts: all
9 vars:
10 jenkins_localhost: "127.0.0.1:8080"
11 jenkins_admin_username: "admin"
12 jenkins_admin_password: "changeme"
13 jenkins_job_builder_conf: "/tmp/jenkins.conf"
14 tasks:
15 - name: Check Jenkins instance accessibility
16 uri:
17 url: "http://{{ jenkins_localhost }}/cli/"
18 method: GET
19 return_content: "yes"
20 timeout: 5
21 body_format: raw
22 follow_redirects: "no"
23 status_code: 200,403
24 register: result
25 until: (result.status == 403 or result.status == 200)
26 and (result.content.find("Please wait while") == -1)
27 retries: 60
28 delay: 5
29 - name: Install pip
30 apt:
31 name: python3-pip
32 - name: Install jenkins job builder
33 pip:
34 name: jenkins-job-builder
35 - name: Create file with Jenkins conf for JJB
36 copy:
37 dest: "{{ jenkins_job_builder_conf }}"
38 mode: 0400
39 content: |
40 [jenkins]
41 user={{ jenkins_admin_username }}
42 password={{ jenkins_admin_password }}
43 url=http://localhost:8080
44
45 - name: List jobs via JJB tools
46 command: "jenkins-jobs --conf {{ jenkins_job_builder_conf }} list"
47 register: plugins_contents
48 changed_when: false
49
50 - name: Assert we are able to access Jenkins with admin username and password.
51 assert:
52 that:
53 - "'INFO:root:Matching jobs: 0' in plugins_contents.stderr"