-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new CI workflow to test against the automation hub collection (#1795
) * add new CI workflow to test against the automation hub collection * remove installation of docker-compose * add changelog Issue: AAH-2419 Signed-off-by: EamonTracey <[email protected]>
- Loading branch information
1 parent
96d4ff8
commit 305b0a3
Showing
7 changed files
with
366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
name: Automation Hub Collection CI | ||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
paths-ignore: | ||
- "CHANGES/**" | ||
- "docs/**" | ||
- "mkdocs.yml" | ||
push: | ||
branches: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
automation_hub_collection: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout galaxy_ng | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Checkout the automation hub collection | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ansible/automation_hub_collection | ||
path: automation_hub_collection | ||
|
||
- name: Build and install the collection | ||
working-directory: automation_hub_collection | ||
run: | | ||
ansible all -i localhost, -c local -m template -a "src=galaxy.yml.j2 dest=galaxy.yml" -e collection_namespace=ansible -e collection_name=automation_hub -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection | ||
ansible-galaxy collection build -vvv | ||
ansible-galaxy collection install ansible-automation_hub-1.0.0.tar.gz -vvv | ||
- name: Spin up a standalone galaxy_ng installation | ||
run: | | ||
echo "COMPOSE_PROFILE=standalone" > .compose.env | ||
echo "DEV_SOURCE_PATH=galaxy_ng" >> .compose.env | ||
make docker/all | ||
./compose up -d | ||
pip3 install --upgrade requests pyyaml | ||
python3 dev/common/poll.py | ||
- name: Test the user playbook | ||
run: ansible-playbook dev/ah_collection_plays/user.yml -vvv | ||
|
||
- name: Test the content playbook | ||
run: ansible-playbook dev/ah_collection_plays/content.yml -vvv | ||
|
||
- name: Test the repo playbook | ||
run: ansible-playbook dev/ah_collection_plays/repo.yml -vvv | ||
|
||
- name: Test the ee playbook | ||
run: ansible-playbook dev/ah_collection_plays/ee.yml -vvv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
New CI workflow to test against the automation hub collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
- name: Galaxy + AH Collection Tests for Content Automation | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
collections: | ||
- ansible.automation_hub | ||
|
||
pre_tasks: | ||
- name: Include variables | ||
ansible.builtin.include_vars: | ||
file: vars.yml | ||
|
||
tasks: | ||
- name: Authenticate and retrieve API token | ||
ansible.automation_hub.ah_token: | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Create the automate namespace | ||
ansible.automation_hub.ah_namespace: | ||
name: automate | ||
company: Automator Inc. | ||
email: [email protected] | ||
description: The namespace for all things automation | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Rename automate namespace to automator | ||
ansible.automation_hub.ah_namespace: | ||
name: automate | ||
new_name: automator | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Delete the automator namespace | ||
ansible.automation_hub.ah_namespace: | ||
state: absent | ||
name: automator | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Ensure there is an ansible namespace | ||
ansible.automation_hub.ah_namespace: | ||
name: ansible | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Upload the automation hub collection to the ansible namespace | ||
ansible.automation_hub.ah_collection: | ||
namespace: ansible | ||
name: automation_hub | ||
path: "{{ ah_artifact_runner_absolute_path }}" | ||
version: "1.0.0" | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Approve the automation hub collection | ||
ansible.automation_hub.ah_approval: | ||
namespace: ansible | ||
name: automation_hub | ||
version: "1.0.0" | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Delete the automation hub collection | ||
ansible.automation_hub.ah_collection: | ||
state: absent | ||
namespace: ansible | ||
name: automation_hub | ||
version: "1.0.0" | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Deauthenticate | ||
ansible.automation_hub.ah_token: | ||
state: absent | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
- name: Galaxy + AH Collection Tests for Execution Environment Automation | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
collections: | ||
- ansible.automation_hub | ||
|
||
pre_tasks: | ||
- name: Include variables | ||
ansible.builtin.include_vars: | ||
file: vars.yml | ||
|
||
tasks: | ||
- name: Add redhat.io registry | ||
ansible.automation_hub.ah_ee_registry: | ||
name: redhat | ||
url: registry.redhat.io | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Index redhat.io registry | ||
ansible.automation_hub.ah_ee_registry_index: | ||
name: redhat | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Update aap22ee29rhel8 ee repository | ||
ansible.automation_hub.ah_ee_repository: | ||
name: ansible-automation-platform-22/ee-29-rhel8 | ||
description: AAP RHEL execution environment | ||
readme: | | ||
# RHEL execution environment | ||
* Contains ansible | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Delete the aap22ee29rhel8 repository | ||
ansible.automation_hub.ah_ee_repository: | ||
name: ansible-automation-platform-22/ee-29-rhel8 | ||
state: absent | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Delete the redhat.io registry | ||
ansible.automation_hub.ah_ee_registry: | ||
name: redhat | ||
state: absent | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
- name: Galaxy + AH Collection Tests for Repo Automation | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
collections: | ||
- ansible.automation_hub | ||
|
||
pre_tasks: | ||
- name: Include variables | ||
ansible.builtin.include_vars: | ||
file: vars.yml | ||
|
||
tasks: | ||
- name: Authenticate and retrieve API token | ||
ansible.automation_hub.ah_token: | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Configure community repository | ||
ansible.automation_hub.ah_repository: | ||
name: community | ||
url: https://galaxy.ansible.com/api/ | ||
requirements: | ||
- community.docker | ||
- geerlingguy.k8s | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Sync community repository | ||
ansible.automation_hub.ah_repository_sync: | ||
name: community | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Deauthenticate | ||
ansible.automation_hub.ah_token: | ||
ah_host: "{{ ah_host }}" | ||
ah_token: "{{ ah_token }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
- name: Galaxy + AH Collection Tests for User Automation | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
collections: | ||
- ansible.automation_hub | ||
|
||
pre_tasks: | ||
- name: Include variables | ||
ansible.builtin.include_vars: | ||
file: vars.yml | ||
|
||
tasks: | ||
- name: Create a developers group | ||
ansible.automation_hub.ah_group: | ||
name: developers | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Add 3 new users who are developers | ||
ansible.automation_hub.ah_user: | ||
username: "dev_{{ item }}" | ||
password: password!@3w6$% | ||
first_name: Developer | ||
last_name: "{{ item | capitalize }}" | ||
groups: | ||
- developers | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
loop: | ||
- red | ||
- green | ||
- blue | ||
|
||
- name: Create an executives group | ||
ansible.automation_hub.ah_group: | ||
name: executives | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Create an omnipotent role with all permissions | ||
ansible.automation_hub.ah_role: | ||
name: galaxy.omnipotent | ||
description: Manage anything and everything | ||
perms: all | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
# TODO: Add a test that permissions/roles can be added to a group after | ||
# https://github.com/ansible/automation_hub_collection/issues/179 is resolved. | ||
|
||
- name: Create new executive users | ||
ansible.automation_hub.ah_user: | ||
username: "{{ item }}" | ||
password: executive!@3w6$% | ||
is_superuser: true | ||
email: "{{ item }}@redhat.com" | ||
groups: | ||
- executives | ||
- developers | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
loop: | ||
- ceo | ||
- cfo | ||
- cto | ||
|
||
- name: Delete the red developer | ||
ansible.automation_hub.ah_user: | ||
state: absent | ||
username: dev_red | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
|
||
- name: Delete the developers and executives groups | ||
ansible.automation_hub.ah_group: | ||
state: absent | ||
name: "{{ item }}" | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" | ||
loop: | ||
- developers | ||
- executives | ||
|
||
- name: Delete the omnipotent role | ||
ansible.automation_hub.ah_role: | ||
state: absent | ||
name: galaxy.omnipotent | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
ah_path_prefix: "{{ ah_path_prefix }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ah_host: http://localhost:5001 | ||
ah_username: iqe_admin | ||
ah_password: redhat | ||
ah_path_prefix: automation-hub | ||
ah_artifact_runner_absolute_path: /home/runner/work/galaxy_ng/galaxy_ng/automation_hub_collection/ansible-automation_hub-1.0.0.tar.gz |