Skip to content

Commit

Permalink
Add Candlepin pipeline to run puppet-candlepin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Jan 16, 2024
1 parent eb8318d commit 08dc077
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pipelines/candlepin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- import_playbook: candlepin/01-boxes.yml
- import_playbook: candlepin/02-install.yml
- import_playbook: candlepin/03-tests.yml
8 changes: 8 additions & 0 deletions pipelines/candlepin/01-boxes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: create vagrant boxes
hosts: localhost
become: False
vars_files:
- ../vars/forklift_candlepin.yml
roles:
- forklift
11 changes: 11 additions & 0 deletions pipelines/candlepin/02-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Setup git repo
become: True
hosts:
- "{{ forklift_name }}"
vars_files:
- ../vars/forklift_candlepin.yml
vars:
beaker_puppet_module: "puppet-candlepin"
roles:
- beaker
17 changes: 17 additions & 0 deletions pipelines/candlepin/03-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: run tests
become: True
hosts:
- "{{ forklift_name }}"
vars_files:
- ../vars/forklift_candlepin.yml
tasks:
- name: Run acceptance tests
ansible.builtin.include_role:
name: beaker
tasks_from: test
vars:
beaker_puppet_module: "puppet-candlepin"
beaker_os: "{{ pipeline_os.replace('-stream', '') }}"
beaker_environment:
BEAKER_FACTER_CANDLEPIN_BASEURL: "https://stagingyum.theforeman.org/candlepin/{{ pipeline_version }}/el{{ ansible_distribution_major_version }}/x86_64"
8 changes: 8 additions & 0 deletions pipelines/vars/forklift_candlepin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
forklift_name: "pipe-candlepin-{{ pipeline_version }}-{{ pipeline_os }}"

server_box:
box: "{{ pipeline_os }}"
memory: 4680

forklift_boxes:
"{{ {forklift_name: server_box} }}"
7 changes: 7 additions & 0 deletions roles/beaker/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
beaker_base_environment:
BEAKER_HYPERVISOR: "docker"
BEAKER_provision: "yes"
BEAKER_setfile: "{{ beaker_os }}-64{hostname={{ beaker_os }}-64.example.com}"
BEAKER_destroy: "no"
beaker_environment: {}
beaker_puppet_module_path: "/src/{{ beaker_puppet_module }}"
50 changes: 50 additions & 0 deletions roles/beaker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: Install podman-docker
package:
name: podman-docker
state: installed

- name: Start podman
service:
name: podman
state: started

- name: Install git
package:
name: git
state: installed

- name: Enable ruby 2.7 module
command: dnf module enable -y ruby:2.7
when: ansible_distribution_major_version == "8"

- name: enable powertools
command: dnf config-manager --set-enabled powertools
when: ansible_distribution_major_version == "8"

- name: enable CRB
command: dnf config-manager --set-enabled crb
when: ansible_distribution_major_version == "9"

- name: Install Ruby
package:
state: installed
name:
- ruby
- ruby-devel
- rubygem-bundler
- gcc-c++
- make
- redhat-rpm-config
- libyaml-devel

- name: Clone puppet module
ansible.builtin.git:
repo: "https://github.com/theforeman/{{ beaker_puppet_module }}.git"
dest: "{{ beaker_puppet_module_path }}"
version: "{{ beaker_puppet_module_version | default(omit) }}"

- name: Bundle install
command: bundle install
args:
chdir: "{{ beaker_puppet_module_path }}"
5 changes: 5 additions & 0 deletions roles/beaker/tasks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Run acceptance tests
command: bundle exec rake beaker
args:
chdir: "{{ beaker_puppet_module_path }}"
environment: "{{ beaker_base_environment | ansible.builtin.combine(beaker_environment) }}"

0 comments on commit 08dc077

Please sign in to comment.