Skip to content

Commit

Permalink
update testing (redhat-cop#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan authored and Przemyslaw Kalitowski committed Nov 22, 2024
1 parent 990d99b commit 5a083c6
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 125 deletions.
6 changes: 3 additions & 3 deletions .github/tests/configs/instances.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
controller_instances:
- hostname: my-instance.prod.example.com
capacity_adjustment: 0.4
# controller_instances:
# - hostname: my-instance.prod.example.com
# capacity_adjustment: 0.4
...
2 changes: 2 additions & 0 deletions .github/tests/configs/projects.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
controller_configuration_projects_async_retries: 60
controller_configuration_projects_async_delay: 3
controller_projects:
- name: Test Project
scm_type: git
Expand Down
36 changes: 26 additions & 10 deletions .github/tests/configure_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
ansible.builtin.debug:
msg: "Using the 'controller_api' plugin from: {{ controller_api_plugin }}"

- name: Include vars from configs directory
ansible.builtin.include_vars:
dir: ./configs
ignore_files: [controller_config.yml.template]
extensions: ["yml"]
tags:
- always

- name: Wait for Controller to come up
ansible.builtin.uri:
url: "https://{{ controller_hostname }}/api/v2/ping"
Expand All @@ -49,23 +57,31 @@
delay: 30
ignore_errors: true

- name: "Show result of ping"
- name: Wait for the controller node to be up
uri:
url: "https://{{ controller_hostname }}/api/v2/mesh_visualizer/"
user: "{{ controller_username }}"
password: "{{ controller_password }}"
method: GET
validate_certs: false
force_basic_auth: true
status_code: 200
body_format: json
register: mesh_data
until: mesh_data.json is defined
retries: 80
delay: 5
ignore_errors: true

- name: "Show result of mesh_visualizer"
ansible.builtin.debug:
var: result
var: mesh_data

- name: Sleep for 60 seconds and allow awx to come up.
ansible.builtin.wait_for:
timeout: 60
delegate_to: localhost

- name: Include vars from configs directory
ansible.builtin.include_vars:
dir: ./configs
ignore_files: [controller_config.yml.template]
extensions: ["yml"]
tags:
- always

roles:
- {role: settings, when: controller_settings is defined, tags: settings}
- {role: organizations, when: controller_organizations is defined, tags: organizations}
Expand Down
26 changes: 17 additions & 9 deletions .github/tests/configure_controller_export_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,29 @@
ansible.builtin.debug:
msg: "Using the 'controller_api' plugin from: {{ controller_api_plugin }}"

- name: Wait for Controller to come up
ansible.builtin.uri:
url: "{{ controller_hostname }}/api/v2/ping"
status_code: 200
register: result
until: result.status == 200
retries: 20
delay: 30

- name: Include vars from controller_configs directory
ansible.builtin.include_vars:
dir: ./configs_export_model
ignore_files: [README.md]
extensions: ["yml"]

- name: Wait for the controller to be up
uri:
url: "https://{{ controller_hostname }}/api/v2/mesh_visualizer/"
user: "{{ controller_username }}"
password: "{{ controller_password }}"
method: GET
validate_certs: false
force_basic_auth: true
status_code: 200
body_format: json
register: mesh_data
until: mesh_data.json.nodes[0].enabled
retries: 120
delay: 5



roles:
- {role: organizations, when: controller_organizations is defined, tags: organizations}
- {role: users, when: controller_user_accounts is defined, tags: users}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ci_standalone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Test collection with AWX matrix
on:
push:
branches:
- '*_'
- devel
tags:
- '*_' # ending underscore for trying things
- 'v[0-9]+.[0-9]+.[0-9]+' # final version
- 'v[0-9]+.[0-9]+.[0-9]+[abrc]+[0-9]+' # alpha, beta, release candidate (rc)
- 'v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+' # development versions
pull_request:

jobs:
ci_standalone:
strategy:
fail-fast: false
matrix:
awx_version:
- 21.11.0
- 21.12.0
- 21.13.0
# - devel Disabled for now
uses: "./.github/workflows/ci_standalone_versioned.yml"
with:
awx_version: ${{ matrix.awx_version }}
77 changes: 77 additions & 0 deletions .github/workflows/ci_standalone_versioned.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Test collection with AWX

on:
workflow_call:
inputs:
awx_version:
description: The version to pull of awx
required: true
type: string
env:
# Run docker-compose up in the background
COMPOSE_UP_OPTS: -d

jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: "Checkout galaxy_ng"
uses: actions/checkout@v2
with:
repository: ansible/awx
path: awx
ref: ${{ inputs.awx_version }}

- uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Update apt
run: sudo apt -y update

- name: Install requirements
run: sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev build-essential

- name: Install docker-compose
run: pip3 install --upgrade docker-compose

- name: collect system info
run: whoami; id; pwd; ls -al; uname -a ; df -h .; mount ; cat /etc/issue; docker --version ; ps aux | fgrep -i docker; ls -al /var/run/containerd/containerd.sock

- name: set the awx password in the inventory
run: echo "admin_password='password'" >> awx/tools/docker-compose/inventory

- name: build images
working-directory: awx
run: make docker-compose-build

- name: build stack
working-directory: awx
run: make docker-compose up
continue-on-error: true

- name: give some time to spin up
run: sleep 200

- name: Preload data
working-directory: awx
run: docker exec tools_awx_1 awx-manage create_preload_data

- name: set the awx password in the inventory
run: ls awx/tools/docker-compose/_sources/secrets

- name: Display Versions
run: which python && pip --version && ansible --version

- name: "Install Galaxy dependencies"
run: ansible-galaxy collection install -r .github/collections/requirements.yml

- name: "Perform playbook tests"
run: ansible-playbook .github/tests/configure_controller.yml -e controller_hostname=localhost:8043 -v

- name: "Perform export model playbook tests"
run: ansible-playbook .github/tests/configure_controller_export_model.yml -e controller_hostname=localhost:8043 -v
...
18 changes: 0 additions & 18 deletions .github/workflows/ci_testing.yaml

This file was deleted.

85 changes: 0 additions & 85 deletions .github/workflows/ci_workflow.yaml

This file was deleted.

0 comments on commit 5a083c6

Please sign in to comment.