Skip to content

Commit

Permalink
Updates release and adds an integration test. (#61)
Browse files Browse the repository at this point in the history
* update workflows

* fix readme

* update release and testing

* update release and testing
  • Loading branch information
sean-m-sullivan authored Jan 13, 2023
1 parent d6e735c commit dfb5ee3
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/tests/build_ee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- name: Playbook to configure execution environments
hosts: localhost
connection: local
gather_facts: false
pre_tasks:
- name: Validate that ansible-builder is installed on target system
block:
- name: Try command
ansible.builtin.shell: ansible-builder --version
register: r_builder
changed_when: false
rescue:
- name: Try to install with rpms
block:
- name: Install ansible-builder from rpm
ansible.builtin.dnf:
name:
- ansible-builder
- ansible-core
enablerepo: ansible-automation-platform-2.2-for-rhel-8-x86_64-rpms
state: present
become: true
rescue:
- name: Install ansible-builder from pip
ansible.builtin.pip:
name:
- ansible-builder
- ansible-core
state: latest

tasks:
- name: Include ee_builder role
ansible.builtin.include_role:
name: ee_builder
vars:
ee_pull_collections_from_hub: false
ee_list:
- name: config_as_code_ee
bindep:
- unzip
python:
- ansible-lint
- netaddr
collections:
- name: infra.controller_configuration
- name: infra.ah_configuration
- name: infra.ee_utilities
- name: infra.aap_utilities
- name: awx.awx
append:
- RUN dnf update -y
...
31 changes: 31 additions & 0 deletions .github/workflows/ci_testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Run Test of EE utilities
on: [push, pull_request]

jobs:
Integration-test:
name: Run Test of EE utilities
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Ansible and Ansible Builder
run: pip install --upgrade ansible-core ansible-builder

- name: Install Dependencies
run: ansible-galaxy collection install containers.podman -f

- name: Docker login
run: docker login -u="redhat_cop+github_action" -p="${{ secrets.quay_token }}" quay.io

- name: Build EE
run: ansible-playbook .github/tests/build_ee.yml -e "ee_registry_username=redhat_cop+github_action" -e "ee_registry_password=${{ secrets.quay_token }}" --connection=local -e "ee_registry_dest=quay.io/redhat_cop/config_as_code_ee" -vvv
env:
ANSIBLE_HOST_KEY_CHECKING: False
...
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
collection_name: ee_utilities
collection_version: ${{ github.ref_name }}
collection_repo: https://github.com/redhat-cop/ee_utilities/
quay_username: redhat_cop
secrets:
galaxy_api_key: ${{ secrets.ANSIBLE_GALAXY_APIKEY }}
infra_api_key: ${{ secrets.GALAXY_INFRA_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
quay_token: ${{ secrets.quay_token }}
...
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
collections_paths=collections
roles_path=roles/
2 changes: 1 addition & 1 deletion roles/ee_builder/tasks/00_build_ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
ansible.builtin.command: >
ansible-builder build -f
{{ builder_dir | default(build_dir.path) }}/execution_environment.yml
-t {{ __execution_environment_definition.name }}{% if __execution_environment_definition.tag is defined %}:{{ __execution_environment_definition.tag }}{% endif %} --container-runtime={{ ee_container_runtime }}
-t {{ __execution_environment_definition.name | default( __execution_environment_definition.ee_name )}}{% if __execution_environment_definition.tag is defined %}:{{ __execution_environment_definition.tag }}{% endif %} --container-runtime={{ ee_container_runtime }}
{% if ee_prune_images %} --prune-images{% endif %}
{% if ee_galaxy_keyring is defined %} --galaxy-keyring={{ ee_galaxy_keyring }}{% endif %}
{% if ee_galaxy_ignore_signature_status_code is defined %}{% for status_code in ee_galaxy_ignore_signature_status_code %} --galaxy-ignore-signature-status-code={{ status_code }}{% endfor %}{% endif %}
Expand Down

0 comments on commit dfb5ee3

Please sign in to comment.