From 32fee10fab2d3b325c7e56118b903352f6d6557f Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Fri, 6 Oct 2023 15:52:05 -0400 Subject: [PATCH] Add Candlepin pipeline to run puppet-candlepin tests --- pipelines/candlepin.yml | 3 ++ pipelines/candlepin/01-boxes.yml | 8 +++++ pipelines/candlepin/02-install.yml | 11 +++++++ pipelines/candlepin/03-tests.yml | 18 +++++++++++ pipelines/vars/forklift_candlepin.yml | 8 +++++ roles/beaker/tasks/main.yml | 46 +++++++++++++++++++++++++++ 6 files changed, 94 insertions(+) create mode 100644 pipelines/candlepin.yml create mode 100644 pipelines/candlepin/01-boxes.yml create mode 100644 pipelines/candlepin/02-install.yml create mode 100644 pipelines/candlepin/03-tests.yml create mode 100644 pipelines/vars/forklift_candlepin.yml create mode 100644 roles/beaker/tasks/main.yml diff --git a/pipelines/candlepin.yml b/pipelines/candlepin.yml new file mode 100644 index 000000000..fcdcea316 --- /dev/null +++ b/pipelines/candlepin.yml @@ -0,0 +1,3 @@ +- import_playbook: candlepin/01-boxes.yml +- import_playbook: candlepin/02-install.yml +- import_playbook: candlepin/03-tests.yml diff --git a/pipelines/candlepin/01-boxes.yml b/pipelines/candlepin/01-boxes.yml new file mode 100644 index 000000000..2a2758787 --- /dev/null +++ b/pipelines/candlepin/01-boxes.yml @@ -0,0 +1,8 @@ +--- +- name: create vagrant boxes + hosts: localhost + become: False + vars_files: + - ../vars/forklift_candlepin.yml + roles: + - forklift diff --git a/pipelines/candlepin/02-install.yml b/pipelines/candlepin/02-install.yml new file mode 100644 index 000000000..3b6d7662f --- /dev/null +++ b/pipelines/candlepin/02-install.yml @@ -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 diff --git a/pipelines/candlepin/03-tests.yml b/pipelines/candlepin/03-tests.yml new file mode 100644 index 000000000..6fad95091 --- /dev/null +++ b/pipelines/candlepin/03-tests.yml @@ -0,0 +1,18 @@ +--- +- name: run tests + become: True + hosts: + - "{{ forklift_name }}" + vars_files: + - ../vars/forklift_candlepin.yml + tasks: + - name: Run acceptance tests + command: bundle exec rake beaker + args: + chdir: /src/puppet-candlepin + environment: + BEAKER_HYPERVISOR: "docker" + BEAKER_provision: "yes" + BEAKER_setfile: "{{ pipeline_os | regex_replace('-stream', '') }}-64{hostname={{ pipeline_os | regex_replace('-stream', '') }}-64.example.com}" + BEAKER_destroy: "no" + BEAKER_FACTER_CANDLEPIN_VERSION: "{{ pipeline_version }}" diff --git a/pipelines/vars/forklift_candlepin.yml b/pipelines/vars/forklift_candlepin.yml new file mode 100644 index 000000000..df531f83e --- /dev/null +++ b/pipelines/vars/forklift_candlepin.yml @@ -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} }}" diff --git a/roles/beaker/tasks/main.yml b/roles/beaker/tasks/main.yml new file mode 100644 index 000000000..3c26493ad --- /dev/null +++ b/roles/beaker/tasks/main.yml @@ -0,0 +1,46 @@ +--- +- 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: 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: "/src/{{ beaker_puppet_module }}" + version: "{{ beaker_puppet_module_version | default('master') }}" + +- name: Bundle install + command: bundle install + args: + chdir: "/src/{{ beaker_puppet_module }}"