Skip to content

Commit

Permalink
CI - increase the number of integration workflow (ansible-collections…
Browse files Browse the repository at this point in the history
…#620)

enable profile_tasks callback plugin for integration tests targets
  • Loading branch information
abikouo committed May 2, 2023
1 parent 869f06f commit a624251
Show file tree
Hide file tree
Showing 79 changed files with 455 additions and 8 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,27 @@ jobs:
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main
with:
collections_to_test: ${{ env.source_dir }}
total_jobs: 8

- name: display targets
id: display
run: echo "test_targets=${{ steps.splitter.outputs.test_targets }}" >> $GITHUB_OUTPUT
shell: bash

integration:
needs:
- splitter
env:
source: "./source"
cloud_common: "./cloudcommon"
ansible_posix: "./ansible_posix"
test_targets: ${{ needs.splitter.outputs.test_targets }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
ansible-version:
- stable-2.9
- stable-2.10
- stable-2.12
- milestone
- devel
Expand Down Expand Up @@ -87,20 +89,23 @@ jobs:
enable-turbo-mode:
- true
- false
job-index:
- 1
- 2
- 3
name: "kubernetes.core-py${{ matrix.python-version }}-${{ matrix.ansible-version }}-turbo-mode=${{ matrix.enable-turbo-mode }}-${{ matrix.job-index }}"
job-index: [1, 2, 3, 4, 5, 6, 7, 8]
name: "integration-py${{ matrix.python-version }}-${{ matrix.ansible-version }}-turbo-mode=${{ matrix.enable-turbo-mode }}-${{ matrix.job-index }}"
steps:
# could read collection name using $(yq -r '.namespace' galaxy.yml).$(yq -r '.name' galaxy.yml)
- name: Read ansible-test targets
id: read-targets
run: >-
echo "ansible_test_targets=$(echo "${{ env.test_targets }}" | sed s/';'/'\n'/g |
grep "kubernetes.core-${{ matrix.job-index }}" | cut -d ':' -f2 | sed s/','/' '/g)" >> $GITHUB_OUTPUT
shell: bash

- name: Display targets
run: >-
echo "targets to test: $ANSIBLE_TARGETS"
shell: bash
env:
ANSIBLE_TARGETS: ${{ steps.read-targets.outputs.ansible_test_targets }}

- name: Checkout kubernetes.core repository
uses: actions/checkout@v3
with:
Expand All @@ -116,6 +121,14 @@ jobs:
ref: main
if: steps.read-targets.outputs.ansible_test_targets != ''

- name: checkout ansible-collections/ansible.posix
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
repository: ansible-collections/ansible.posix
path: ${{ env.ansible_posix }}
ref: main
if: steps.read-targets.outputs.ansible_test_targets != ''

- name: install kubernetes.core collection
id: install-collection
uses: abikouo/github_actions/.github/actions/build_install_collection@build_install_collection
Expand All @@ -131,6 +144,13 @@ jobs:
source_path: ${{ env.cloud_common }}
if: steps.read-targets.outputs.ansible_test_targets != ''

- name: install ansible.posix collection
uses: abikouo/github_actions/.github/actions/build_install_collection@build_install_collection
with:
install_python_dependencies: true
source_path: ${{ env.ansible_posix }}
if: steps.read-targets.outputs.ansible_test_targets != ''

- name: create kubernetes cluster
uses: helm/kind-action@v1.4.0
if: steps.read-targets.outputs.ansible_test_targets != ''
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest
pytest-xdist
pytest-mock
pytest-forked
virtualenv
7 changes: 7 additions & 0 deletions tests/integration/targets/helm/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm
5 changes: 5 additions & 0 deletions tests/integration/targets/helm/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_diff/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_diff
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_diff/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_kubeconfig/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_kubeconfig
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_kubeconfig/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_plugin/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_plugin
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_plugin/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_pull/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_pull
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_pull/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_repository/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_repository
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_repository/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/helm_set_values/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- connection: local
gather_facts: true
hosts: localhost

roles:
- helm_set_values
5 changes: 5 additions & 0 deletions tests/integration/targets/helm_set_values/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
1 change: 1 addition & 0 deletions tests/integration/targets/inventory_k8s/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ USER_CREDENTIALS_DIR=$(pwd)
ansible-playbook playbooks/delete_resources.yml -e "user_credentials_dir=${USER_CREDENTIALS_DIR}" "$@"

{
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_INVENTORY_ENABLED=kubernetes.core.k8s,yaml
export ANSIBLE_PYTHON_INTERPRETER=auto_silent

Expand Down
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_access_review/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_access_review
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_access_review/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_append_hash/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_append_hash
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_append_hash/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_apply/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_apply
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_apply/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_check_mode/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_check_mode
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_check_mode/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_cluster_info/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_cluster_info
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_cluster_info/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_copy/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_copy
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_copy/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_crd/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_crd
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_crd/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_delete/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_delete
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_delete/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_diff/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_diff
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_diff/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_drain/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_drain
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_drain/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_exec/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_exec
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_exec/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_full/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_full
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_full/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_gc/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_gc
5 changes: 5 additions & 0 deletions tests/integration/targets/k8s_gc/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yaml "$@"
6 changes: 6 additions & 0 deletions tests/integration/targets/k8s_generate_name/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- connection: local
gather_facts: false
hosts: localhost
roles:
- k8s_generate_name

0 comments on commit a624251

Please sign in to comment.