Skip to content

Commit 5304216

Browse files
xinyuezhaolhercot
andauthored
[minor_change] Add module nd_pcv, nd_pcv_delta_analysis and nd_pcv_compliance, fix HTTPAPI Connection plugin when wrong login_domain and add ansible_httpapi_login_domain global variable.
Co-authored-by: Lionel Hercot <[email protected]>
1 parent 2074385 commit 5304216

26 files changed

+2477
-301
lines changed

.github/workflows/ansible-test.yml

+85-58
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,71 @@ on:
55
pull_request:
66
schedule:
77
# * is a special character in YAML so you have to quote this string
8-
- cron: '0 7 * * *'
8+
- cron: '0 6 * * *'
9+
env:
10+
python_version: 3.9
911
jobs:
1012
build:
1113
name: Build collection
1214
runs-on: ubuntu-latest
1315
strategy:
16+
fail-fast: false
1417
matrix:
15-
ansible: [2.9.17, 2.10.5, 2.11.0]
18+
ansible: [v2.9.27, v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
1619
steps:
1720
- name: Check out code
18-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
1922

20-
- name: Set up Python 3.8
21-
uses: actions/setup-python@v1
23+
- name: Set up Python ${{ env.python_version }}
24+
uses: actions/setup-python@v4
2225
with:
23-
python-version: 3.8
26+
python-version: ${{ env.python_version }}
2427

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

2831
- name: Build a collection tarball
2932
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
3033

3134
- name: Store migrated collection artifacts
32-
uses: actions/upload-artifact@v1
35+
uses: actions/upload-artifact@v3
3336
with:
3437
name: collection
3538
path: .cache/collection-tarballs
3639

40+
black-formating:
41+
name: Using Black to check formating
42+
runs-on: ubuntu-latest
43+
continue-on-error: true
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
experimental: [true]
48+
steps:
49+
- name: Check out code
50+
uses: actions/checkout@v3
51+
52+
- name: Run black against code
53+
uses: psf/black@stable
54+
with:
55+
options: "--check --diff --color -l 159"
56+
3757
importer:
3858
name: Galaxy-importer check
3959
needs:
4060
- build
4161
runs-on: ubuntu-latest
4262
steps:
43-
- name: Set up Python 3.8
44-
uses: actions/setup-python@v1
63+
- name: Set up Python ${{ env.python_version }}
64+
uses: actions/setup-python@v4
4565
with:
46-
python-version: 3.8
66+
python-version: ${{ env.python_version }}
4767

48-
- name: Install ansible-base (v2.11.0)
49-
run: pip install https://github.com/ansible/ansible/archive/v2.11.0.tar.gz --disable-pip-version-check
68+
- name: Install ansible-base (stable-2.14)
69+
run: pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz --disable-pip-version-check
5070

5171
- name: Download migrated collection artifacts
52-
uses: actions/download-artifact@v1
72+
uses: actions/download-artifact@v3
5373
with:
5474
name: collection
5575
path: .cache/collection-tarballs
@@ -73,7 +93,7 @@ jobs:
7393
run: if grep -E 'WARNING|ERROR' .cache/collection-tarballs/log.txt; then exit 1; else exit 0; fi
7494

7595
- name: Store galaxy_importer check log file
76-
uses: actions/upload-artifact@v1
96+
uses: actions/upload-artifact@v3
7797
with:
7898
name: galaxy-importer-log
7999
path: .cache/collection-tarballs/importer_result.json
@@ -85,22 +105,23 @@ jobs:
85105
- build
86106
runs-on: ubuntu-latest
87107
strategy:
108+
fail-fast: false
88109
matrix:
89-
ansible: [2.9.17, 2.10.5, 2.11.0]
110+
ansible: [v2.9.27, v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
90111
steps:
91-
- name: Set up Python 3.8
92-
uses: actions/setup-python@v1
112+
- name: Set up Python ${{ env.python_version }}
113+
uses: actions/setup-python@v4
93114
with:
94-
python-version: 3.8
115+
python-version: ${{ env.python_version }}
95116

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

99120
- name: Install coverage (v4.5.4)
100121
run: pip install coverage==4.5.4
101122

102123
- name: Download migrated collection artifacts
103-
uses: actions/download-artifact@v1
124+
uses: actions/download-artifact@v3
104125
with:
105126
name: collection
106127
path: .cache/collection-tarballs
@@ -109,15 +130,15 @@ jobs:
109130
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
110131

111132
- name: Run sanity tests
112-
run: ansible-test sanity --docker -v --color --truncate 0
133+
run: ansible-test sanity --docker -v --color --truncate 0 --coverage
113134
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
114135

115136
- name: Generate coverage report
116137
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
117138
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
118-
139+
119140
- name: Push coverate report to codecov.io
120-
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
141+
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F sanity
121142
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
122143

123144
units:
@@ -126,91 +147,97 @@ jobs:
126147
- build
127148
runs-on: ubuntu-latest
128149
strategy:
150+
fail-fast: false
129151
matrix:
130-
ansible: [2.9.17, 2.10.5, 2.11.0]
152+
ansible: [v2.10.17, v2.11.12, v2.12.10, stable-2.13, stable-2.14]
153+
python-version: [3.9]
154+
include:
155+
- ansible: v2.9.27
156+
python-version: 3.8
131157
steps:
132-
- name: Set up Python 3.8
133-
uses: actions/setup-python@v1
158+
- name: Set up Python ${{ matrix.python-version }}
159+
uses: actions/setup-python@v4
134160
with:
135-
python-version: 3.8
161+
python-version: ${{ matrix.python-version }}
136162

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

140166
- name: Install coverage (v4.5.4)
141167
run: pip install coverage==4.5.4
142168

143169
- name: Download migrated collection artifacts
144-
uses: actions/download-artifact@v1
170+
uses: actions/download-artifact@v3
145171
with:
146172
name: collection
147173
path: .cache/collection-tarballs
148174

149175
- name: Install the collection tarball
150176
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
151177

152-
#- name: Run unit tests
153-
# run: ansible-test units --docker -v --color --truncate 0 --python 3.8 --coverage
154-
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
178+
# - name: Run unit tests
179+
# run: ansible-test units --docker -v --color --truncate 0 --python ${{ matrix.python-version }} --coverage
180+
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
155181

156-
#- name: Generate coverage report.
157-
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
158-
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
182+
# - name: Generate coverage report.
183+
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
184+
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
159185

160-
#- uses: codecov/codecov-action@v1
161-
# with:
162-
# fail_ci_if_error: false
163-
# file: /home/runner/.ansible/collections/ansible_collections/cisco/nd/tests/output/reports/coverage.xml
186+
# - name: Push coverate report to codecov.io
187+
# run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F unit
188+
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
164189

165190
integration:
166191
name: Integration in ubuntu-latest
167192
needs:
168193
- build
169194
runs-on: ubuntu-latest
170195
steps:
171-
- name: Set up Python 3.8
172-
uses: actions/setup-python@v1
196+
- name: Set up Python ${{ env.python_version }}
197+
uses: actions/setup-python@v4
173198
with:
174-
python-version: 3.8
175-
176-
- name: Install ansible-base (v2.9.17)
177-
run: pip install https://github.com/ansible/ansible/archive/v2.9.17.tar.gz --disable-pip-version-check
178-
199+
python-version: ${{ env.python_version }}
200+
201+
- name: Install ansible-base (stable-2.13)
202+
run: pip install https://github.com/ansible/ansible/archive/stable-2.13.tar.gz --disable-pip-version-check
203+
179204
- name: Install coverage (v4.5.4)
180205
run: pip install coverage==4.5.4
181-
206+
182207
- name: Download migrated collection artifacts
183-
uses: actions/download-artifact@v1
208+
uses: actions/download-artifact@v3
184209
with:
185210
name: collection
186211
path: .cache/collection-tarballs
187-
212+
188213
- name: Install the collection tarball
189214
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
190215

191216
- name: Requesting integration mutex
192217
uses: nev7n/wait_for_response@v1
193218
with:
194-
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-nd?repo={0}', github.repository) }}
219+
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-nd?repo={0}&run_id={1}', github.repository, github.run_id) }}
195220
responseCode: 200
196221
timeout: 2000000
197222
interval: 5000
198223

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

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

210235
- name: Generate coverage report
236+
if: always()
211237
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
212238
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
213-
239+
214240
- name: Push coverate report to codecov.io
241+
if: always()
215242
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
216243
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Generate Changelog
2+
on:
3+
push:
4+
branches: master
5+
jobs:
6+
generate-changelog:
7+
name: Run automation script
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out script code
11+
uses: actions/checkout@v3
12+
with:
13+
repository: ciscoecosystem/release_script
14+
path: ./release_script
15+
16+
- name: Check out collection code
17+
uses: actions/checkout@v3
18+
with:
19+
path: ./collection
20+
21+
- name: Set up Python 3.9
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: 3.9
25+
26+
- name: Install release script requirements
27+
run: pip install -r ./release_script/requirements.txt
28+
29+
- name: Run automation script
30+
run: python ./release_script/script.py
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql-analysis.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
schedule:
8+
- cron: '40 8 * * 5'
9+
10+
jobs:
11+
analyze:
12+
name: Analyze
13+
runs-on: ubuntu-latest
14+
permissions:
15+
actions: read
16+
contents: read
17+
security-events: write
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: [ 'python' ]
23+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
24+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
# Initializes the CodeQL tools for scanning.
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v2
33+
with:
34+
languages: ${{ matrix.language }}
35+
# If you wish to specify custom queries, you can do so here or in a config file.
36+
# By default, queries listed here will override any specified in a config file.
37+
# Prefix the list here with "+" to use these queries and those in the config file.
38+
39+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
40+
# queries: security-extended,security-and-quality
41+
42+
- name: Perform CodeQL Analysis
43+
uses: github/codeql-action/analyze@v2

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ flycheck_*.el
100100

101101
# Generated files
102102
.idea/**/contentModel.xml
103+
.DS_Store
103104

104105
# Sensitive or high-churn files
105106
.idea/**/dataSources/

plugins/doc_fragments/modules.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <[email protected]>
44
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
55

6-
from __future__ import (absolute_import, division, print_function)
6+
from __future__ import absolute_import, division, print_function
7+
78
__metaclass__ = type
89

910

1011
class ModuleDocFragment(object):
1112
# Standard files documentation fragment
12-
DOCUMENTATION = r'''
13+
DOCUMENTATION = r"""
1314
options:
1415
host:
1516
description:
@@ -68,13 +69,12 @@ class ModuleDocFragment(object):
6869
login_domain:
6970
description:
7071
- The login domain name to use for authentication.
71-
- The default value is Local.
72+
- The default value is DefaultAuth.
7273
- If the value is not specified in the task, the value of environment variable C(ND_LOGIN_DOMAIN) will be used instead.
7374
type: str
74-
default: local
7575
requirements:
7676
- Nexus Dashboard v2.0 or newer
7777
notes:
7878
- Please read the :ref:`nd_guide` for more detailed information on how to manage your ND infrastructure using Ansible.
7979
- This module was written to support Nexus Dashboard v2.0 or newer. Some or all functionality may not work on earlier versions.
80-
'''
80+
"""

0 commit comments

Comments
 (0)