Skip to content

Commit

Permalink
[ignore] Fix CI issue (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhercot authored Feb 4, 2023
1 parent 217614e commit c757df2
Show file tree
Hide file tree
Showing 91 changed files with 14,860 additions and 14,453 deletions.
93 changes: 52 additions & 41 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 8 * * *'
env:
python_version: 3.9
jobs:
build:
name: Build collection
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ansible: [2.9.27, 2.10.17, 2.11.12, 2.12.10, 2.13.7, 2.14.1]
ansible: [v2.9.27, v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python 3.8
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ env.python_version }}

- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Build a collection tarball
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
Expand All @@ -40,28 +42,31 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
experimental: true
experimental: [true]
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Run black against code
uses: psf/black@stable
options: "--check --diff --color -l 159"
with:
options: "--check --diff --color -l 159"

importer:
name: Galaxy-importer check
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ env.python_version }}

- name: Install ansible-base (v2.14.1)
run: pip install https://github.com/ansible/ansible/archive/v2.14.1.tar.gz --disable-pip-version-check
- name: Install ansible-base (stable-2.14)
run: pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz --disable-pip-version-check

- name: Download migrated collection artifacts
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -102,15 +107,15 @@ jobs:
strategy:
fail-fast: false
matrix:
ansible: [2.9.27, 2.10.17, 2.11.12, 2.12.10, 2.13.7, 2.14.1]
ansible: [v2.9.27, v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
steps:
- name: Set up Python 3.8
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ env.python_version }}

- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
Expand All @@ -125,15 +130,15 @@ jobs:
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz

- name: Run sanity tests
run: ansible-test sanity --docker -v --color --truncate 0
run: ansible-test sanity --docker -v --color --truncate 0 --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Push coverate report to codecov.io
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F sanity
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

units:
Expand All @@ -144,15 +149,19 @@ jobs:
strategy:
fail-fast: false
matrix:
ansible: [2.9.27, 2.10.17, 2.11.12, 2.12.10, 2.13.7, 2.14.1]
ansible: [v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
python-version: [3.9]
include:
- ansible: v2.9.27
python-version: 3.8
steps:
- name: Set up Python 3.8
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}

- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
Expand All @@ -166,31 +175,31 @@ jobs:
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz

- name: Run unit tests
run: ansible-test units --docker -v --color --truncate 0 --python 3.8 --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci
# - name: Run unit tests
# run: ansible-test units --docker -v --color --truncate 0 --python ${{ matrix.python-version }} --coverage
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Generate coverage report.
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci
# - name: Generate coverage report.
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Push coverate report to codecov.io
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci
# - name: Push coverate report to codecov.io
# run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F unit
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

integration:
name: Integration in ubuntu-latest
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ env.python_version }}

- name: Install ansible-base (v2.11.9)
run: pip install https://github.com/ansible/ansible/archive/v2.11.9.tar.gz --disable-pip-version-check
- name: Install ansible-base (stable-2.13)
run: pip install https://github.com/ansible/ansible/archive/stable-2.13.tar.gz --disable-pip-version-check

- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
Expand All @@ -207,26 +216,28 @@ jobs:
- name: Requesting integration mutex
uses: nev7n/wait_for_response@v1
with:
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-aci?repo={0}', github.repository) }}
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-aci?repo={0}&run_id={1}', github.repository, github.run_id) }}
responseCode: 200
timeout: 2000000
interval: 5000

- name: Run integration tests on Python 3.8
run: ansible-test network-integration --docker -v --color --retry-on-error --python 3.8 --truncate 0 --continue-on-error --coverage
- name: Run integration tests on Python ${{ env.python_version }}
run: ansible-test network-integration --docker -v --color --retry-on-error --python ${{ env.python_version }} --truncate 0 --continue-on-error --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Releasing integration mutex
uses: nev7n/wait_for_response@v1
if: always()
with:
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-aci/release?repo={0}', github.repository) }}
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-aci/release?repo={0}&run_id={1}', github.repository, github.run_id) }}
responseCode: 200

- name: Generate coverage report
if: always()
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci

- name: Push coverate report to codecov.io
if: always()
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/aci
4 changes: 2 additions & 2 deletions .github/workflows/changelog-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
with:
path: ./collection

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

- name: Install release script requirements
run: pip install -r ./release_script/requirements.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ flycheck_*.el

# Generated files
.idea/**/contentModel.xml
.DS_Store

# Sensitive or high-churn files
.idea/**/dataSources/
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aci_cloud_aws_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def main():
},
subclass_1={
"aci_class": "cloudAwsProvider",
"aci_rn": "awsprovider".format(),
"aci_rn": "awsprovider",
"target_filter": {"account_id": account_id},
"module_object": account_id,
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aci_cloud_bgp_asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def main():

aci = ACIModule(module)
aci.construct_url(
root_class={"aci_class": "cloudBgpAsP", "aci_rn": "clouddomp/as".format(), "target_filter": {"name": name}, "module_object": None}, child_classes=[]
root_class={"aci_class": "cloudBgpAsP", "aci_rn": "clouddomp/as", "target_filter": {"name": name}, "module_object": None}, child_classes=[]
)

aci.get_existing()
Expand Down
11 changes: 6 additions & 5 deletions plugins/modules/aci_contract_subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,12 @@ def main():
child_classes=["vzInTerm", "vzOutTerm"])
aci.get_existing()
direction_options = ["both", "one-way"]
if aci.existing and subject_class in aci.existing[0]:
direction_options = ["one-way"] if "children" in aci.existing[0][subject_class] else ["both"]
if direction not in direction_options:
module.fail_json(msg="Direction is not allowed, valid option is {0}.".format(" or ".join(direction_options)))
# end logic to be consistent with GUI to only allow both direction or one-way
if state != "query":
if aci.existing and subject_class in aci.existing[0]:
direction_options = ["one-way"] if "children" in aci.existing[0][subject_class] else ["both"]
if direction not in direction_options:
module.fail_json(msg="Direction is not allowed, valid option is {0}.".format(" or ".join(direction_options)))
# end logic to be consistent with GUI to only allow both direction or one-way

if state == "present":

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aci_contract_subject_to_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def main():
if aci.existing:
direction_options = ["consumer_to_provider", "provider_to_consumer"] if "children" in aci.existing[0]["vzSubj"] else ["both"]

if direction not in direction_options:
if state != "query" and direction not in direction_options:
module.fail_json(msg="Direction is not allowed, valid option is {0}.".format(" or ".join(direction_options)))
# end logic to be consistent with GUI to only allow both direction or a one-way connection

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/inventory.networking
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ azure_cloud ansible_host=104.42.26.226 aci_hostname=104.42.26.226 aci_password="
aci_username=ansible_github_ci
aci_password="sJ94G92#8dq2hx*K4qh"
ansible_connection=local
ansible_python_interpreter=/usr/bin/python3.8
ansible_python_interpreter=/usr/bin/python3.9
14 changes: 14 additions & 0 deletions tests/integration/targets/aci_aaa_user_domain/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
output_level: '{{ aci_output_level | default("info") }}'

# CLEAN ENVIRONMENT
- name: Remove user domain from a aaa_user
cisco.aci.aci_aaa_user_domain:
<<: *aci_info
name: anstest-security-domain
aaa_user: ansible
state: absent

- name: Remove user domain from a aaa_user
cisco.aci.aci_aaa_user_domain:
<<: *aci_info
name: anstest-security-domain-1
aaa_user: ansible
state: absent

- name: Remove any pre-existing user
cisco.aci.aci_aaa_user:
<<: *aci_info
Expand Down
25 changes: 25 additions & 0 deletions tests/integration/targets/aci_aaa_user_role/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
phone: 1-234-555-678
register: add_user

# ADD SECURITY DOMAINS
- name: Ensure anstest-security-domain exists
cisco.aci.aci_aaa_domain:
<<: *aci_info
name: anstest-security-domain
state: present

- name: Ensure anstest-security-domain-1 exists
cisco.aci.aci_aaa_domain:
<<: *aci_info
name: anstest-security-domain-1
state: present

# ADD USER DOMAIN
- name: Add "anstest-security-domain" user domain to aaa_user
cisco.aci.aci_aaa_user_domain: &sec_domain_present
Expand Down Expand Up @@ -309,3 +322,15 @@
cisco.aci.aci_aaa_user:
<<: *user_present
state: absent

- name: Remove anstest-security-domain domain
cisco.aci.aci_aaa_domain:
<<: *aci_info
name: anstest-security-domain
state: absent

- name: Remove anstest-security-domain-1 domain
cisco.aci.aci_aaa_domain:
<<: *aci_info
name: anstest-security-domain-1
state: absent
Loading

0 comments on commit c757df2

Please sign in to comment.