Skip to content

Commit

Permalink
Migrate EST tests to ansible
Browse files Browse the repository at this point in the history
Tests based on GitHub workflow cannot easily be executed locally
before the code is pushed making more difficult to identify problems
during the development.

Additionally, there are several limitation on how workflows can be
combined.

Moving to ansible should solve the limitation and allow the
execution of test on developer machine.

This is the first step aims at converting a single workflow to ansible.

The preliminary steps of building the docker images and deploy onto the
runner are still based on github actions.

If/when all workflows will use ansible the overall CI activities could
be reorganised to optimise the execution in the available runners.
  • Loading branch information
fmarco76 committed Jun 27, 2023
1 parent 65d1a36 commit 5c385bc
Show file tree
Hide file tree
Showing 13 changed files with 382 additions and 168 deletions.
165 changes: 0 additions & 165 deletions .github/workflows/est-basic-test.yml

This file was deleted.

31 changes: 28 additions & 3 deletions .github/workflows/est-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,32 @@ jobs:
est-basic-test:
name: Basic EST
needs: [init, build]
uses: ./.github/workflows/est-basic-test.yml
with:
db-image: ${{ needs.init.outputs.db-image }}
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Retrieve PKI images
uses: actions/cache@v3
with:
key: pki-images-${{ github.sha }}
path: pki-images.tar

- name: Load PKI images
run: docker load --input pki-images.tar

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install ansible
run: |
python -m pip install --upgrade pip
pip install --user -r tests/ansible/requirements.txt
- name: Execute est playbook
run: |
ansible-playbook -e 'pki_subsystem="est"' tests/ansible/pki-playbook.yml
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/tests/ansible/ansible.cfg
7 changes: 7 additions & 0 deletions tests/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[defaults]

# (string) Set the main callback used to display Ansible output. You can only have one at a time.
# You can have many other callbacks, but just one can be in charge of stdout.
# See :ref:`callback_plugins` for a list of available options.
stdout_callback=community.general.unixy

51 changes: 51 additions & 0 deletions tests/ansible/est/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
EST
===

EST tests for CI

Requirements
------------
The only requirement is the `community.docker` module

Role Variables
--------------

**DS** related variables:

- `ds_container`: name of the container running directory server (_ds_);
- `ds_image`: image for the directory server container (_quay.io/389ds/dirsrv_);
- `ds_hostname`: hostname for directory server container (_ds.example.com_);
- `ds_password`: direcotry server password (_Secret.123_).

**CA** related variables:

- `pki_container`: name of the container running the CA and EST subsystem(_pki_);
- `pki_image`: image for CA deplyment container (*pki_runner*);
- `pki_hostname`: hostname for the CA (_pki.example.com_).

**libest** client variables:

- `client_container`: name of the container running the client (_client_);
- `client_image`: image for the client container (_quay.io/dogtagpki/libest_);
- `client_hostname`: hostname for the client (_client.example.com_)



Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- est

License
-------

GPL-2-and-later

Author Information
------------------

Marco Fargetta ([email protected])
21 changes: 21 additions & 0 deletions tests/ansible/est/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for est

shared_workspace: /tmp/workdir/pki
github_workspace: ./

#DS
ds_container: ds
ds_image: quay.io/389ds/dirsrv
ds_hostname: ds.example.com
ds_password: Secret.123

#PKI
pki_container: pki
pki_image: pki-runner
pki_hostname: pki.example.com

#Client
client_container: client
client_image: quay.io/dogtagpki/libest
client_hostname: client.example.com
2 changes: 2 additions & 0 deletions tests/ansible/est/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for est
24 changes: 24 additions & 0 deletions tests/ansible/est/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
galaxy_info:
author: Marco Fargetta ([email protected])
description: EST tests for CI
company: Red Hat


license: GPL-2.0-or-later

min_ansible_version: 2.1


platforms:
- name: Fedora
versions:
- all
- name: Ubuntu
versions:
- 22.04

galaxy_tags:
- dogtag
- pki

dependencies: []
Loading

0 comments on commit 5c385bc

Please sign in to comment.