forked from cisco-en-programmability/dnacenter-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cisco-en-programmability#3 from ajithandrewj/user_…
…and_role_workflow_feature User and role workflow feature
- Loading branch information
Showing
75 changed files
with
17,899 additions
and
2,101 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,325 @@ | ||
version: 2.1 | ||
|
||
setup: << pipeline.parameters.run-setup >> | ||
|
||
orbs: | ||
path-filtering: circleci/[email protected] | ||
|
||
parameters: | ||
run-setup: | ||
type: boolean | ||
default: true | ||
run-any: | ||
type: boolean | ||
default: false | ||
run-all: | ||
type: boolean | ||
default: false | ||
run-site: | ||
type: boolean | ||
default: false | ||
run-devicecredential: | ||
type: boolean | ||
default: false | ||
run-discovery: | ||
type: boolean | ||
default: false | ||
run-inventory: | ||
type: boolean | ||
default: false | ||
run-swim: | ||
type: boolean | ||
default: false | ||
run-pnp: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
|
||
pre: | ||
parameters: | ||
ansible_cisco_dnac_version: | ||
type: string | ||
default: "6.9.0" | ||
|
||
#machine: true | ||
docker: | ||
- image: python:3.8.10 | ||
resource_class: madhansansel/dnacenter-ansible | ||
|
||
steps: | ||
- run: | ||
name: Debug information for pre | ||
command: | | ||
set -x | ||
echo "REPO_URL: $REPO_URL" | ||
echo "CIRCLE_PROJECT_REPONAME: $CIRCLE_PROJECT_REPONAME" | ||
echo "CIRCLE_PROJECT_BRANCHNAME: $CIRCLE_PROJECT_BRANCHNAME" | ||
build: | ||
parameters: | ||
ansible_cisco_dnac_version: | ||
type: string | ||
default: "6.9.0" | ||
|
||
#machine: true | ||
docker: | ||
- image: python:3.8.10 | ||
resource_class: madhansansel/dnacenter-ansible | ||
steps: | ||
- run: | ||
name: Debug information | ||
command: | | ||
echo "REPO_URL: $REPO_URL" | ||
echo "CIRCLE_PROJECT_REPONAME: $CIRCLE_PROJECT_REPONAME" | ||
echo "CIRCLE_PROJECT_BRANCHNAME: $CIRCLE_PROJECT_BRANCHNAME" | ||
- restore_cache: | ||
keys: | ||
- collection-<< pipeline.git.revision >> | ||
- run: | ||
name: Skip if already build | ||
command: | | ||
if [ $(ls workspace/*tar.gz) ]; then | ||
ls -alh workspace | ||
circleci-agent step halt | ||
fi | ||
- run: | ||
name: Clone repo to workspace | ||
command: | | ||
git clone --depth=1 https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git . | ||
git fetch origin $CIRCLE_BRANCH:work | ||
git checkout work | ||
- restore_cache: | ||
keys: | ||
- pip-cache-{{ checksum "test-requirements.txt" }} | ||
- run: | ||
name: Activate Virtual Environment, Install ansible and Build collection tarball | ||
command: | | ||
# Install ansible, dnacentersdk | ||
pip install --upgrade pip | ||
pip install -r test-requirements.txt | ||
# Build collection and store resulting tarball in directory $HOME/.cache/v<< parameters.ansible_cisco_dnac_version >>/collection-tarballs | ||
ansible-galaxy collection build --force --output-path workspace/ | ||
- save_cache: | ||
key: collection-<< pipeline.git.revision >> | ||
paths: | ||
- 'workspace' | ||
- save_cache: | ||
key: pip-cache-{{ checksum "test-requirements.txt" }} | ||
paths: | ||
- ~/.cache/pip | ||
|
||
addrole: | ||
#machine: true | ||
docker: | ||
- image: python:3.8.10 | ||
resource_class: madhansansel/dnacenter-ansible | ||
|
||
steps: | ||
- run: | ||
name: Create Roles File header | ||
command: | | ||
mkdir -p roles-file | ||
echo "---" > roles-file/ccc_roles.yml | ||
echo "- hosts: dnac_servers" >> roles-file/ccc_roles.yml | ||
echo " gather_facts: no" >> roles-file/ccc_roles.yml | ||
echo " connection: local" >> roles-file/ccc_roles.yml | ||
echo " " >> roles-file/ccc_roles.yml | ||
echo " tasks:" >> roles-file/ccc_roles.yml | ||
echo " " >> roles-file/ccc_roles.yml | ||
echo " vars:" >> roles-file/ccc_roles.yml | ||
echo " debug: false" >> roles-file/ccc_roles.yml | ||
echo " " >> roles-file/ccc_roles.yml | ||
echo " roles:" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-site >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_site_management" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-devicecredential >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_device_credential_management" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-discovery >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_discovery_management" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-inventory >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_inventory_management" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-swim >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_swim_management" >> roles-file/ccc_roles.yml | ||
- when: | ||
condition: | ||
or: [ << pipeline.parameters.run-pnp >>, << pipeline.parameters.run-all >> ] | ||
steps: | ||
- run: | ||
command: | | ||
echo " - ccc_pnp_management" >> roles-file/ccc_roles.yml | ||
- persist_to_workspace: | ||
root: 'roles-file' | ||
paths: | ||
- 'ccc_roles.yml' | ||
sanity-tests: | ||
parameters: | ||
ansible_cisco_dnac_version: | ||
type: string | ||
default: "6.9.0" | ||
|
||
#machine: true | ||
docker: | ||
- image: python:3.8.10 | ||
resource_class: madhansansel/dnacenter-ansible | ||
|
||
steps: | ||
- run: | ||
name: Debug information | ||
command: | | ||
echo "REPO_URL: $REPO_URL" | ||
echo "CIRCLE_PROJECT_REPONAME: $CIRCLE_PROJECT_REPONAME" | ||
echo "CIRCLE_PROJECT_BRANCHNAME: $CIRCLE_PROJECT_BRANCHNAME" | ||
- run: | ||
name: Clone repo to workspace | ||
command: | | ||
git clone --depth=1 https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git . | ||
git fetch origin $CIRCLE_BRANCH:work | ||
git checkout work | ||
- attach_workspace: | ||
at: roles-file | ||
|
||
- restore_cache: | ||
keys: | ||
- collection-<< pipeline.git.revision >> | ||
- restore_cache: | ||
keys: | ||
- pip-cache-{{ checksum "test-requirements.txt" }} | ||
- run: | ||
name: Activate Virtual Environment, Install ansible and Build collection tarball | ||
command: | | ||
# Install ansible, dnacentersdk | ||
pip install --upgrade pip | ||
pip install -r test-requirements.txt | ||
ansible --version | ||
- run: | ||
name: Install the collection tarball | ||
command: | | ||
python --version | ||
ansible --version | ||
ansible-galaxy collection install --force workspace/*.tar.gz | ||
- run: | ||
name: Copy static files | ||
command: | | ||
mkdir -p group_vars | ||
cp roles-file/ccc_roles.yml ccc_roles.yml | ||
echo ${GROUP_VARS} | base64 -d > group_vars/dnac_servers.yml | ||
echo ${DNAC_HOSTS} | base64 -d > hosts | ||
- run: | ||
name: Run sanity tests | ||
command: | | ||
export ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=1000 | ||
export ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=1000 | ||
export ANSIBLE_ROLES_PATH=$PWD/tests/integration | ||
ansible-playbook -i hosts ccc_roles.yml | ||
no_output_timeout: 120m | ||
|
||
post_pnp_testing: | ||
#machine: true | ||
docker: | ||
- image: python:3.8.10 | ||
resource_class: madhansansel/dnacenter-ansible | ||
|
||
steps: | ||
- when: | ||
condition: << pipeline.parameters.run-pnp >> | ||
steps: | ||
- run: | ||
command: | | ||
python ${HOME}/static/pnp_script.py #TODO | ||
workflows: | ||
|
||
building: | ||
when: << pipeline.parameters.run-setup >> | ||
jobs: | ||
- pre | ||
|
||
- build: | ||
matrix: | ||
parameters: | ||
ansible_cisco_dnac_version: | ||
- "6.9.0" | ||
requires: | ||
- pre | ||
|
||
- path-filtering/filter: | ||
requires: | ||
- build | ||
base-revision: main | ||
config-path: .circleci/config.yml | ||
mapping: | | ||
.* run-setup false | ||
plugins/.* run-any true | ||
tests/integration/.* run-any true | ||
plugins/module_utils/.* run-all true | ||
plugins/modules/site_workflow_manager.py run-site true | ||
plugins/modules/device_credential_workflow_manager.py run-devicecredential true | ||
plugins/modules/discovery_workflow_manager.py run-discovery true | ||
plugins/modules/inventory_workflow_manager.py run-inventory true | ||
plugins/modules/swim_workflow_manager.py run-swim true | ||
plugins/modules/pnp_workflow_manager.py run-pnp true | ||
tests/integration/ccc_site_management/.* run-site true | ||
tests/integration/ccc_device_credential_management/.* run-devicecredential true | ||
tests/integration/ccc_discovery_management/.* run-discovery true | ||
tests/integration/ccc_inventory_management/.* run-inventory true | ||
tests/integration/ccc_swim_management/.* run-swim true | ||
tests/integration/ccc_pnp_management/.* run-pnp true | ||
testing: | ||
when: << pipeline.parameters.run-any >> | ||
jobs: | ||
- addrole | ||
- sanity-tests: | ||
requires: | ||
- addrole | ||
context: | ||
- dnac-servers | ||
matrix: | ||
parameters: | ||
ansible_cisco_dnac_version: | ||
- "6.9.0" | ||
# - post_pnp_testing: | ||
# requires: | ||
# - sanity-tests | ||
|
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
namespace: cisco | ||
name: dnac | ||
version: 6.16.0 | ||
version: 6.17.0 | ||
readme: README.md | ||
authors: | ||
- Rafael Campos <[email protected]> | ||
|
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
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
Oops, something went wrong.