summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2015-12-11 14:38:10 -0500
committerPaul Belanger <pabelanger@redhat.com>2015-12-11 20:19:39 -0500
commit2eaf536e4cb3fe244712f78ce18e58a8a0ed42d5 (patch)
tree51306a0776005ec0d2ff62a4edd56be11316a631
parentcc889939dc147d015a398ef5d25c51b66714b3a1 (diff)
Add jenkins_jobs.ini template
Change-Id: I887b2b9715ab31dd6db8b68c20f01b70a18d81c7 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Paul Belanger <pabelanger@redhat.com> Workflow+1: Paul Belanger <pabelanger@redhat.com> Submitted-by: Jenkins Submitted-at: Sat, 12 Dec 2015 01:36:34 +0000 Reviewed-on: https://review.openstack.org/256639 Project: openstack/ansible-role-jenkins-job-builder Branch: refs/heads/master
-rw-r--r--defaults/main.yaml14
-rw-r--r--tasks/config.yaml9
-rw-r--r--templates/etc/jenkins_jobs/jenkins_jobs.ini.j214
-rw-r--r--tests/files/etc/jenkins_jobs/jenkins_jobs.ini14
-rw-r--r--tests/test.yaml38
5 files changed, 89 insertions, 0 deletions
diff --git a/defaults/main.yaml b/defaults/main.yaml
index 9769b26..feddefd 100644
--- a/defaults/main.yaml
+++ b/defaults/main.yaml
@@ -17,6 +17,20 @@ jenkins_job_builder_user_name: root
17jenkins_job_builder_user_group: "{{ jenkins_job_builder_user_name }}" 17jenkins_job_builder_user_group: "{{ jenkins_job_builder_user_name }}"
18jenkins_job_builder_user_home: /var/lib/jenkins_job_builder 18jenkins_job_builder_user_home: /var/lib/jenkins_job_builder
19 19
20jenkins_job_builder_config_job_builder_allow_duplicates: False
21jenkins_job_builder_config_job_builder_ignore_cache: True
22jenkins_job_builder_config_job_builder_keep_descriptions: False
23jenkins_job_builder_config_job_builder_recursive: False
24
25jenkins_job_builder_config_jenkins_user: jenkins
26jenkins_job_builder_config_jenkins_password: ""
27jenkins_job_builder_config_jenkins_url: http://localhost:8008
28jenkins_job_builder_config_jenkins_query_plugins_info: False
29
30jenkins_job_builder_template_jenkins_jobs_ini_dest: /etc/jenkins_jobs/jenkins_jobs.ini
31jenkins_job_builder_template_jenkins_jobs_ini_mode: "0440"
32jenkins_job_builder_template_jenkins_jobs_ini_src: etc/jenkins_jobs/jenkins_jobs.ini.j2
33
20# tasks/install.yaml 34# tasks/install.yaml
21jenkins_job_builder_git_dest: /opt/ansible-role-jenkins-job-builder/git/openstack-infra/jenkins-job-builder 35jenkins_job_builder_git_dest: /opt/ansible-role-jenkins-job-builder/git/openstack-infra/jenkins-job-builder
22jenkins_job_builder_git_uri: https://git.openstack.org/openstack-infra/jenkins-job-builder 36jenkins_job_builder_git_uri: https://git.openstack.org/openstack-infra/jenkins-job-builder
diff --git a/tasks/config.yaml b/tasks/config.yaml
index 9e51ebf..ade7d0a 100644
--- a/tasks/config.yaml
+++ b/tasks/config.yaml
@@ -19,4 +19,13 @@
19 path: "{{ item }}" 19 path: "{{ item }}"
20 state: directory 20 state: directory
21 with_items: 21 with_items:
22 - /etc/jenkins_jobs
22 - "{{ jenkins_job_builder_user_home }}" 23 - "{{ jenkins_job_builder_user_home }}"
24
25- name: Template jenkins_jobs.ini file.
26 template:
27 dest: "{{ jenkins_job_builder_template_jenkins_jobs_ini_dest }}"
28 group: "{{ jenkins_job_builder_user_group }}"
29 mode: "{{ jenkins_job_builder_template_jenkins_jobs_ini_mode }}"
30 owner: "{{ jenkins_job_builder_user_name }}"
31 src: "{{ jenkins_job_builder_template_jenkins_jobs_ini_src }}"
diff --git a/templates/etc/jenkins_jobs/jenkins_jobs.ini.j2 b/templates/etc/jenkins_jobs/jenkins_jobs.ini.j2
new file mode 100644
index 0000000..136b4ef
--- /dev/null
+++ b/templates/etc/jenkins_jobs/jenkins_jobs.ini.j2
@@ -0,0 +1,14 @@
1# This file is generated by Ansible
2# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
3#
4[job_builder]
5allow_duplicates = {{ jenkins_job_builder_config_job_builder_allow_duplicates }}
6keep_descriptions = {{ jenkins_job_builder_config_job_builder_keep_descriptions }}
7ignore_cache = {{ jenkins_job_builder_config_job_builder_ignore_cache }}
8recursive = {{ jenkins_job_builder_config_job_builder_recursive }}
9
10[jenkins]
11password = {{ jenkins_job_builder_config_jenkins_password }}
12query_plugins_info = {{ jenkins_job_builder_config_jenkins_query_plugins_info }}
13url = {{ jenkins_job_builder_config_jenkins_url }}
14user = {{ jenkins_job_builder_config_jenkins_user }}
diff --git a/tests/files/etc/jenkins_jobs/jenkins_jobs.ini b/tests/files/etc/jenkins_jobs/jenkins_jobs.ini
new file mode 100644
index 0000000..c9a8615
--- /dev/null
+++ b/tests/files/etc/jenkins_jobs/jenkins_jobs.ini
@@ -0,0 +1,14 @@
1# This file is generated by Ansible
2# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
3#
4[job_builder]
5allow_duplicates = False
6keep_descriptions = False
7ignore_cache = True
8recursive = False
9
10[jenkins]
11password =
12query_plugins_info = False
13url = http://localhost:8008
14user = jenkins
diff --git a/tests/test.yaml b/tests/test.yaml
index 98be0ec..68bc31d 100644
--- a/tests/test.yaml
+++ b/tests/test.yaml
@@ -40,3 +40,41 @@
40 - jenkins_job_builder_user_home_stat.stat.pw_name == 'root' 40 - jenkins_job_builder_user_home_stat.stat.pw_name == 'root'
41 - jenkins_job_builder_user_home_stat.stat.gr_name == 'root' 41 - jenkins_job_builder_user_home_stat.stat.gr_name == 'root'
42 - jenkins_job_builder_user_home_stat.stat.mode == '0755' 42 - jenkins_job_builder_user_home_stat.stat.mode == '0755'
43
44 - name: Register /etc/jenkins_jobs.
45 stat:
46 path: /etc/jenkins_jobs
47 register: jenkins_jobs_stat
48
49 - name: Assert /etc/jenkins_jobs tests.
50 assert:
51 that:
52 - jenkins_jobs_stat.stat.exists
53 - jenkins_jobs_stat.stat.isdir
54 - jenkins_jobs_stat.stat.pw_name == 'root'
55 - jenkins_jobs_stat.stat.gr_name == 'root'
56 - jenkins_jobs_stat.stat.mode == '0755'
57
58 - name: Register jenkins_jobs.ini.
59 stat:
60 path: /etc/jenkins_jobs/jenkins_jobs.ini
61 register: jenkins_jobs_ini_stat
62
63 - name: Assert /etc/jenkins_jobs tests.
64 assert:
65 that:
66 - jenkins_jobs_ini_stat.stat.exists
67 - jenkins_jobs_ini_stat.stat.isreg
68 - jenkins_jobs_ini_stat.stat.pw_name == 'root'
69 - jenkins_jobs_ini_stat.stat.gr_name == 'root'
70 - jenkins_jobs_ini_stat.stat.mode == '0440'
71
72 - name: Ensure jenkins_jobs.ini was templated.
73 copy:
74 dest: /etc/jenkins_jobs/jenkins_jobs.ini
75 src: files/etc/jenkins_jobs/jenkins_jobs.ini
76 register: jenkins_jobs_ini
77
78 - name: Assert jenkins_jobs.ini did not change.
79 assert:
80 that: "{{ jenkins_jobs_ini.changed | bool }} == False"