Skip to content

Commit

Permalink
PSMDB tests for pro tarballs (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-havryliak authored Feb 20, 2024
1 parent f925564 commit 7b3a2f2
Show file tree
Hide file tree
Showing 11 changed files with 597 additions and 0 deletions.
11 changes: 11 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/.yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable
Empty file.
60 changes: 60 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
galaxy_info:
role_name: psmdb_tarball
namespace: psmdb
author: your name
description: your description
company: your company (optional)

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)

min_ansible_version: 1.2

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
# github_branch:

#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
Empty file.
46 changes: 46 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/molecule/rhel9/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
dependency:
name: galaxy
driver:
name: ec2
platforms:
- name: rhel9-${BUILD_NUMBER}-${JOB_NAME}
region: us-west-2
image: ami-04a616933df665b44
vpc_subnet_id: subnet-03136d8c244f56036
instance_type: ${INSTANCE_TYPE:-t2.medium}
ssh_user: ec2-user
root_device_name: /dev/sda1
instance_tags:
iit-billing-tag: jenkins-psmdb-worker
job-name: ${JOB_NAME}
provisioner:
name: ansible
log: True
playbooks:
create: ../../../../playbooks/create.yml
destroy: ../../../../playbooks/destroy.yml
prepare: ../../playbooks/prepare.yml
cleanup: ../../playbooks/cleanup.yml
converge: ../../playbooks/playbook.yml
verifier:
name: testinfra
directory: ../../tests/
options:
verbose: true
s: true
junitxml: rhel9-report.xml
scenario:
name: rhel9
destroy_sequence:
- destroy
clenup_sequence:
- cleanup
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- cleanup
- destroy
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
dependency:
name: galaxy
driver:
name: ec2
platforms:
- name: ujammy-pro-${BUILD_NUMBER}-${JOB_NAME}
region: us-west-2
image: ami-058168290d30b9c52
vpc_subnet_id: subnet-03136d8c244f56036
instance_type: t3.large
ssh_user: ubuntu
root_device_name: /dev/sda1
instance_tags:
iit-billing-tag: jenkins-psmdb-worker
job-name: ${JOB_NAME}
provisioner:
name: ansible
log: True
playbooks:
create: ../../../../playbooks/create.yml
destroy: ../../../../playbooks/destroy.yml
prepare: ../../playbooks/prepare.yml
cleanup: ../../playbooks/cleanup.yml
converge: ../../playbooks/playbook.yml
verifier:
name: testinfra
directory: ../../tests/
options:
verbose: true
s: true
junitxml: ubuntu-jammy-pro-report.xml
scenario:
name: ubuntu-jammy-pro
destroy_sequence:
- destroy
clenup_sequence:
- cleanup
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- cleanup
- destroy
6 changes: 6 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/playbooks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Cleanup
hosts: all
become: true
become_method: sudo
tasks:
78 changes: 78 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/playbooks/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
- name: Download packages to localhost
hosts: localhost
connection: local
gather_facts: false
tasks:
- set_fact:
tarball_ol9: "{{ lookup('env', 'TARBALL_OL9') | default('https://downloads.percona.com/downloads/percona-server-mongodb-5.0/percona-server-mongodb-5.0.13-11/binary/tarball/percona-server-mongodb-5.0.13-11-x86_64.glibc2.17-minimal.tar.gz', true) }}"

- name: Get tarball link for jammy
set_fact:
tarball_jammy: "{{ tarball_ol9 | regex_replace('ol9', 'jammy') }}"

- name: Debug tarball for jammy
debug:
msg: "{{ tarball_jammy }}"

- name: Get mongodb version
set_fact:
mongodb_ver: "{{ tarball_ol9 | regex_search('mongodb-pro-([0-9]+\\.[0-9]+\\.[0-9]+)', '\\1') }}"

- name: Get mongodb major version
set_fact:
maj_version={{ mongodb_ver[0].split('.')[0] }}

- name: Debug mongodb major version
debug:
msg: "{{ maj_version }}"

- name: Get git repo branch
set_fact:
repo_branch: "v{{ mongodb_ver[0].split('.')[0] }}.{{ mongodb_ver[0].split('.')[1] }}"

- name: Debug repo branch
debug:
msg: "{{ repo_branch }}"

- name: Download tarball for ol9 from url
get_url:
url: '{{ tarball_ol9 }}'
dest: /tmp/percona-server-mongodb-{{mongodb_ver[0]}}.ol9.tar.gz
mode: '0644'
when: tarball_ol9.startswith('http')

- name: Download tarball for ol9 from s3
aws_s3:
bucket: "{{ tarball_ol9 | urlsplit('hostname') }}"
object: "{{ tarball_ol9 | urlsplit('path') }}"
dest: /tmp/percona-server-mongodb-{{mongodb_ver[0]}}.ol9.tar.gz
mode: get
when: tarball_ol9.startswith('s3')

- name: Download tarball for jammy from url
get_url:
url: '{{ tarball_jammy }}'
dest: /tmp/percona-server-mongodb-{{mongodb_ver[0]}}.jammy.tar.gz
mode: '0644'
when: tarball_ol9.startswith('http')

- name: Download tarball for jammy from s3
aws_s3:
bucket: "{{ tarball_jammy | urlsplit('hostname') }}"
object: "{{ tarball_jammy | urlsplit('path') }}"
dest: /tmp/percona-server-mongodb-{{mongodb_ver[0]}}.jammy.tar.gz
mode: get
when: tarball_ol9.startswith('s3')

- name: Converge
hosts: all
become: true
become_method: sudo
gather_facts: yes
roles:
- role: psmdb-tarball-pro
- role: '../../../roles/openldap'
- role: '../../../roles/kerberos'
- role: '../../../roles/kmip'
- role: '../../../roles/vault'
88 changes: 88 additions & 0 deletions psmdb-tarball/psmdb-tarball-pro/playbooks/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
- name: Prepare node for running tests
hosts: all
become: true
become_method: sudo
gather_facts: true
tasks:
- name: Subscribe for fips-updates
command: pro enable fips-updates --assume-yes
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "22"

- name: install necessary rpm packages for RHEL8+
yum:
name: "{{ packages }}"
state: latest
vars:
packages:
- iproute
- bzip2-devel
- bzip2-libs
- gcc
- git
- make
- openssl-devel
- curl
- python3-pip
- python3-devel
- python3-ldap
- psmisc
- libffi-devel
- xz-devel
- unzip
when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= "8"

- name: install necessary rpm packages for RHEL9
yum:
name: "{{ packages }}"
state: latest
vars:
packages:
- openldap-compat
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "9"

- name: Update apt cache
shell: apt update --allow-releaseinfo-change
when: ansible_os_family == "Debian"

- name: Install necessary deb packages
apt:
name: "{{ packages }}"
update_cache: yes
vars:
packages:
- dirmngr
- net-tools
- curl
- gcc
- git
- libbz2-dev
- libreadline-dev
- libssl-dev
- libsqlite3-dev
- make
- zlib1g-dev
- python3
- python3-pip
- python3-dev
- python3-markdown
- python3-virtualenv
- unzip
when: ansible_os_family == "Debian"

- name: Install necessary python packages RHEL8
yum:
name: "{{ packages }}"
state: latest
vars:
packages:
- python38
- python38-pip
- python38-devel
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"

- name: Ensure python RHEL8
shell: alternatives --set python3 /usr/bin/python3.8
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"


Loading

0 comments on commit 7b3a2f2

Please sign in to comment.