Skip to content

Commit

Permalink
Ansible Core version bump up to 2.14.0 (#452)
Browse files Browse the repository at this point in the history
* Version bump for runtime.yml

* Dummy commit

* Add ansible lint check

* Requirements bumpup ansible-core version

* Workflow should only have 3.9 as 3.8 and 3.7 support is gone from ansible

* Revert pipeline changes

* Revert sanity version changes

* Change ansible-core to 2.14.0

* Use python 3.9 only and use ubuntu 20.4 runner for ansible unit tests

* Doc fixes

* 1. Bump up coverage.
2. Lint fixes

* Add notes in inventory modules

* Minor lint fixes

* notes lint fix

* Fix notes lint faulure

* Fix trailing spaces

* More lint fixes

* More lint fixes

* Remove ansible lint check

* Fix fetch_url for ansible versions >= 2.13.0

* Install community package before inetegration tests

* Fix integration requirements.txt

* print ansible version in pipeliines

* Update source branch of ok to test

* revert workflows temp changes

* Not run foundation and ndb sanity test

* Fix PBRS tests. Add correct value types for code and type in icmp spec

* Enable NDB sanity tests

* Fix read me typos

* Enable foundation sanity and some lint fixes

* Add bond modes in test for foundation

* Disable pc tests

* Minor fix

* Revert "Disable pc tests"

This reverts commit be1a11d.

* Disabled foundation and database to run only PC tests

* Release notes update

* Lint fxies

* Change log changes
  • Loading branch information
bhati-pradeep authored Mar 28, 2024
1 parent b6dc17a commit 03d0974
Show file tree
Hide file tree
Showing 235 changed files with 1,278 additions and 1,267 deletions.
5 changes: 3 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
🐍 python:
- "**/*.py"
- "*.py"
Expand All @@ -7,7 +8,7 @@
- "*.md"

⚙ ci:
- ".github/**"
- .github/**

⚙ build:
- "Makefile"
- Makefile
5 changes: 3 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Black
on:
push:
Expand All @@ -15,8 +16,8 @@ jobs:
- name: Set up Python 3.x (latest)
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: 3.x
- name: black
uses: psf/black@stable
with:
version: "22.6.0"
version: 22.6.0
5 changes: 3 additions & 2 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Flake8
on:
push:
Expand All @@ -15,8 +16,8 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: "3.9"
- name: Run Flake8
run: |
pip install -r requirements.txt
flake8
flake8
5 changes: 3 additions & 2 deletions .github/workflows/isort.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Isort
on:
push:
Expand All @@ -15,5 +16,5 @@ jobs:
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: isort/isort-action@master
python-version: 3.x
- uses: isort/isort-action@master
47 changes: 24 additions & 23 deletions .github/workflows/ok-to-test-command.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Integration Test cases
on:
pull_request:
Expand All @@ -10,14 +11,14 @@ jobs:
strategy:
max-parallel: 1
matrix:
python-version: ['3.9']
python-version: ["3.9"]
if: github.event_name == 'repository_dispatch'
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."

- uses: actions/checkout@v2
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
ref: refs/pull/${{ github.event.client_payload.pull_request.number }}/merge
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -47,13 +48,13 @@ jobs:
args="${{ github.event.client_payload.slash_command.args.all }}"
flag=""
if [ "$args" = "allow-disabled" ]
then
then
flag="--allow-disabled"
fi
echo '${{ secrets.FOUNDATION_CONFIG }}' > tests/integration/targets/prepare_foundation_env/vars/main.yml
echo '${{ secrets.FC_CONFIG }}' > tests/integration/targets/prepare_fc_env/vars/main.yml
echo '${{ secrets.PC_CONFIG }}' > tests/integration/targets/prepare_env/vars/main.yml
echo '${{ secrets.NDB_CONFIG }}' > tests/integration/targets/prepare_ndb_env/vars/main.yml
echo '${{ secrets.PC_CONFIG }}' > tests/integration/targets/prepare_env/vars/main.yml
echo '${{ secrets.NDB_CONFIG }}' > tests/integration/targets/prepare_ndb_env/vars/main.yml
ansible-playbook tests/integration/targets/prepare_env/tasks/prepare_env.yml
ansible-playbook tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml
ansible-playbook tests/integration/targets/prepare_fc_env/tasks/prepare_fc_env.yml
Expand All @@ -65,23 +66,23 @@ jobs:
- name: Code Coverage Check
if: ${{ always() }}
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
ansible-test coverage html
sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }}
echo "Code coverage: Checking if code coverage is above threshold..."
export COVERAGE_THRESHOLD=70
echo "Threshold: $COVERAGE_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current integration test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
ansible-test coverage html
sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }}
echo "Code coverage: Checking if code coverage is above threshold..."
export COVERAGE_THRESHOLD=70
echo "Threshold: $COVERAGE_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current integration test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
- run: echo "🍏 This job's status is ${{ job.status }}."

Expand All @@ -105,7 +106,7 @@ jobs:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
conclusion: ${{ job.status }}
conclusion: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ok-to-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: 'Ok-To-Test'
---
name: Ok-To-Test

on: [issue_comment]

jobs:
test:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}. And Github Token is ${{ secrets.GITHUB_TOKEN }}"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "Your Github Token is ${{ secrets.GITHUB_TOKEN }}"

- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
with:
token: ${{ secrets.PAT }}
commands: ok-to-test
permission: write
- run: echo "🍏 This job's status is ${{ job.status }}."
- run: echo "🍏 This job's status is ${{ job.status }}."
5 changes: 3 additions & 2 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: PR Labeler

on:
- pull_request
- pull_request

jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: ${{ secrets.GITHUB_TOKEN }}
39 changes: 20 additions & 19 deletions .github/workflows/unit_testing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Run compile and tests

on:
Expand All @@ -9,10 +10,10 @@ on:
- main
jobs:
sanity:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.9']
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -38,10 +39,10 @@ jobs:
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
ansible-test sanity --docker default --python ${{ matrix.python-version }} -v
unit_testing:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -68,18 +69,18 @@ jobs:
ansible-test units --docker default --python ${{ matrix.python-version }} --coverage -v
ansible-test coverage report --include */plugins/* --omit */utils.py,_fetch_url* > coverage.txt
- name: Code Coverage Check
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
echo "Code coverage: Checking if code coverage is above threshold..."
export TESTCOV_THRESHOLD=55
echo "Threshold: $TESTCOV_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
echo "Code coverage: Checking if code coverage is above threshold..."
export TESTCOV_THRESHOLD=55
echo "Threshold: $TESTCOV_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- ntnx_vms_clone - [Bug] cannot change boot_config when cloning in module ntnx_vms_clone [[\#360](https://github.com/nutanix/nutanix.ansible/issues/359)]
- website - [Bug] Github page deployment action is failing. [[\#483](https://github.com/nutanix/nutanix.ansible/issues/483)]

**Breaking Changes:**

- nutanix.ncp collection - Due to all versions of ansible-core less than v2.14.0 are EOL, we are also deprecating support for same and minimum version to use this collection is ansible-core==2.14.0

**Full Changelog:** [here](https://github.com/nutanix/nutanix.ansible/compare/v1.9.0...v1.9.1)

## v1.9.0 (11 July 2023)
Expand Down Expand Up @@ -190,7 +194,7 @@
**Prism Central**
- Ansible module for Image Management
- Ansible info module for Image Management
- Ansible module for Image Placement Policy
- Ansible module for Image Placement Policy
- Ansible info module for Image Placement Policies
- Ansible module for Network Security Rules
- Ansible info module for Network Security Rules
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Nutanix.Ncp Release Notes
v1.9.1
======

Release Summary
---------------

This release included bug fixes and improvement. We have also deprecated support for ansible-core less than v2.14.0

Minor Changes
-------------

Expand All @@ -21,6 +26,11 @@ Minor Changes
- ntnx_vms - owner association upon vm creation module [[\#359](https://github.com/nutanix/nutanix.ansible/issues/359)]
- ntnx_vms_info - [Imprv] add examples with guest customization for module ntnx_vms [[\#395](https://github.com/nutanix/nutanix.ansible/issues/395)]

Breaking Changes / Porting Guide
--------------------------------

- nutanix.ncp collection - Due to all versions of ansible-core less than v2.14.0 are EOL, we are also deprecating support for same and minimum version to use this collection is ansible-core==2.14.0

Bugfixes
--------

Expand Down
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ Ansible Nutanix Provider leverages the community-supported model. See [Open Sour
# Version compatibility

## Ansible
This collection and examples has been tested against following versions :
1. ansible==5.0.1
2. ansible-core==2.12.3
This collection requires ansible-core>=2.14.0

## Python
This collection requires Python 2.7 or greater
This collection requires Python 3.9 or greater

## Prism Central
> For the 1.1.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc2022.1.0.2, pc.2021.9.0.5 and pc.2021.8.0.1.
> For the 1.2.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.5.
> For the 1.3.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.4.
> For the 1.3.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.4.
> For the 1.4.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.4.
> For the 1.4.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.4.
> For the 1.5.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.6, pc.2022.4.0.2 and pc2022.1.0.2.
Expand All @@ -57,7 +55,7 @@ Prism Central based examples: https://github.com/nutanix/nutanix.ansible/tree/ma
## Foundation
> For the 1.1.0 release of the ansible plugin, it will have N-1 compatibility with the Foundation. This release was tested against Foundation versions v5.2 and v5.1.1
> For the 1.9.1 release of the ansible plugin, it was tested against NDB versions v2.5.2
> For the 1.9.1 release of the ansible plugin, it was tested against versions v5.2
Foundation based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/foundation

Expand All @@ -67,11 +65,11 @@ Foundation based examples : https://github.com/nutanix/nutanix.ansible/tree/main
Foundation Central based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/fc

## Karbon
> For the 1.6.0 release of the ansible plugin, it will have N-2 compatibility with the Karbon. This release was tested against Karbon versions v2.3.0, v2.4.0 and v2.5.0
> For the 1.6.0 release of the ansible plugin, it will have N-2 compatibility with the Karbon. This release was tested against Karbon versions v2.3.0, v2.4.0 and v2.5.0
> For the 1.9.0 release of the ansible plugin, it was tested against Karbon versions v2.6.0, v2.7.0 and v2.8.0
> For the 1.9.0 release of the ansible plugin, it was tested against Karbon versions v2.6.0, v2.7.0 and v2.8.0
> For the 1.9.1 release of the ansible plugin, it was tested against Karbon version v2.8.0
> For the 1.9.1 release of the ansible plugin, it was tested against Karbon version v2.8.0
Karbon based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/karbon

Expand All @@ -87,7 +85,7 @@ NDB based examples : https://github.com/nutanix/nutanix.ansible/tree/main/exampl

### Notes:
1. Currently NDB based modules are supported and tested against postgres based databases.

# Installing the collection
**Prerequisite**

Expand Down Expand Up @@ -275,13 +273,13 @@ We glady welcome contributions from the community. From updating the documentati
To conduct integration tests for a specific Ansible module such as the `ntnx_vms` module, the following step-by-step procedures can be followed:

### Prerequisites
- Ensure you are in the installed collection directory where the module is located. For example:
- Ensure you are in the installed collection directory where the module is located. For example:
`/Users/mac.user1/.ansible/collections/ansible_collections/nutanix/ncp`

### Setting up Variables
1. Navigate to the `tests/integration/targets` directory within the collection.

2. Define the necessary variables within the feature-specific var files, such as `tests/integration/targets/prepare_env/vars/main.yml`, `tests/integration/targets/prepare_foundation_env/vars/main.yml`,`tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml`, etc.
2. Define the necessary variables within the feature-specific var files, such as `tests/integration/targets/prepare_env/vars/main.yml`, `tests/integration/targets/prepare_foundation_env/vars/main.yml`,`tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml`, etc.

Note: For Karbon and FC tests, use the PC vars exclusively, as these features rely on pc setup. Not all variables are mandatory; define only the required variables for the particular feature to be tested.

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-cayman
theme: jekyll-theme-cayman
Loading

0 comments on commit 03d0974

Please sign in to comment.