Skip to content

Commit b06a0ae

Browse files
committed
Add Candlepin pipeline to run puppet-candlepin tests
1 parent fa1384a commit b06a0ae

8 files changed

Lines changed: 109 additions & 0 deletions

File tree

pipelines/candlepin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- import_playbook: candlepin/01-boxes.yml
2+
- import_playbook: candlepin/02-install.yml
3+
- import_playbook: candlepin/03-tests.yml

pipelines/candlepin/01-boxes.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: create vagrant boxes
3+
hosts: localhost
4+
become: False
5+
vars_files:
6+
- ../vars/forklift_candlepin.yml
7+
roles:
8+
- forklift

pipelines/candlepin/02-install.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Setup git repo
3+
become: True
4+
hosts:
5+
- "{{ forklift_name }}"
6+
vars_files:
7+
- ../vars/forklift_candlepin.yml
8+
vars:
9+
beaker_puppet_module: "puppet-candlepin"
10+
roles:
11+
- beaker

pipelines/candlepin/03-tests.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: run tests
3+
become: True
4+
hosts:
5+
- "{{ forklift_name }}"
6+
vars_files:
7+
- ../vars/forklift_candlepin.yml
8+
tasks:
9+
- name: Run acceptance tests
10+
ansible.builtin.include_role:
11+
name: beaker
12+
tasks_from: test
13+
vars:
14+
beaker_puppet_module: "puppet-candlepin"
15+
beaker_os: "{{ pipeline_os.replace('-stream', '') }}"
16+
beaker_environment:
17+
BEAKER_FACTER_CANDLEPIN_BASEURL: "https://stagingyum.theforeman.org/candlepin/{{ pipeline_version }}/el{{ ansible_distribution_major_version }}/x86_64"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
forklift_name: "pipe-candlepin-{{ pipeline_version }}-{{ pipeline_os }}"
2+
3+
server_box:
4+
box: "{{ pipeline_os }}"
5+
memory: 4680
6+
7+
forklift_boxes:
8+
"{{ {forklift_name: server_box} }}"

roles/beaker/defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
beaker_base_environment:
2+
BEAKER_HYPERVISOR: "docker"
3+
BEAKER_provision: "yes"
4+
BEAKER_setfile: "{{ beaker_os }}-64{hostname={{ beaker_os }}-64.example.com}"
5+
BEAKER_destroy: "no"
6+
beaker_environment: {}
7+
beaker_puppet_module_path: "/src/{{ beaker_puppet_module }}"

roles/beaker/tasks/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
- name: Install podman-docker
3+
package:
4+
name: podman-docker
5+
state: installed
6+
7+
- name: Start podman
8+
service:
9+
name: podman
10+
state: started
11+
12+
- name: Install git
13+
package:
14+
name: git
15+
state: installed
16+
17+
- name: Enable ruby 2.7 module
18+
command: dnf module enable -y ruby:2.7
19+
when: ansible_distribution_major_version == "8"
20+
21+
- name: enable powertools
22+
command: dnf config-manager --set-enabled powertools
23+
when: ansible_distribution_major_version == "8"
24+
25+
- name: enable CRB
26+
command: dnf config-manager --set-enabled crb
27+
when: ansible_distribution_major_version == "9"
28+
29+
- name: Install Ruby
30+
package:
31+
state: installed
32+
name:
33+
- ruby
34+
- ruby-devel
35+
- rubygem-bundler
36+
- gcc-c++
37+
- make
38+
- redhat-rpm-config
39+
- libyaml-devel
40+
41+
- name: Clone puppet module
42+
ansible.builtin.git:
43+
repo: "https://github.com/theforeman/{{ beaker_puppet_module }}.git"
44+
dest: "{{ beaker_puppet_module_path }}"
45+
version: "{{ beaker_puppet_module_version | default(omit) }}"
46+
47+
- name: Bundle install
48+
command: bundle install
49+
args:
50+
chdir: "{{ beaker_puppet_module_path }}"

roles/beaker/tasks/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- name: Run acceptance tests
2+
command: bundle exec rake beaker
3+
args:
4+
chdir: "{{ beaker_puppet_module_path }}"
5+
environment: "{{ beaker_base_environment | ansible.builtin.combine(beaker_environment) }}"

0 commit comments

Comments
 (0)