Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
ee46d5d
switch to collection
Sep 16, 2021
da5c87a
update unit tests to use collections
Sep 20, 2021
5f80e45
update unit tests to use collection
Sep 20, 2021
da6c8c2
more updates to unit tests
Sep 20, 2021
3119259
update python packages, collections_path
Sep 20, 2021
744cc51
update readme
Sep 20, 2021
7c52ae6
fix remaining unit tests
Sep 20, 2021
b7db30c
separate dockerfile ansible 2.9 vs 2.10, update readme tests
Sep 21, 2021
f44dcf6
support 2.9, 2.10+ in fdm_swagger_client
Sep 21, 2021
26a7b46
dockerfile cleanup post testing
Sep 22, 2021
05b7e01
readme update on using collections
Sep 22, 2021
d2723f5
update changelog
Sep 22, 2021
64fc6b3
Update readme
Sep 22, 2021
f88e225
minor doc updates
Sep 22, 2021
d26baa9
remove tests folder from under collections
Sep 22, 2021
772f3c5
remove test machine
Sep 22, 2021
18063dc
updates to doc generator, update ansible 2.7 references to 2.9, safe_…
Sep 28, 2021
fc18ea8
Test workflow
Sep 29, 2021
26bb8df
set correct httpapi library
meignw2021 Sep 29, 2021
a7c1c7b
testing workflows
meignw2021 Sep 29, 2021
cc5febf
workflow updates
meignw2021 Sep 29, 2021
6cfadd0
update test requirements
meignw2021 Sep 30, 2021
9f30775
fix variable name in config
meignw2021 Sep 30, 2021
d535b23
move unit tests under collection
meignw2021 Sep 30, 2021
3bf2212
adding recommended fixes per ansible-test sanity checks
meignw2021 Sep 30, 2021
04aad2d
readme updates
meignw2021 Sep 30, 2021
0e6be43
testing workflow
meignw2021 Sep 30, 2021
2cf8e68
Update requirements.txt
meignw2021 Sep 30, 2021
709a561
Update requirements.txt
meignw2021 Sep 30, 2021
9721d94
cleanup code per ansible-test sanity recommendation
meignw2021 Sep 30, 2021
6703a91
cleanup based on ansible-test sanity checks
meignw2021 Sep 30, 2021
67b8576
Small Update to Readme
meignw2021 Oct 1, 2021
10d9cf9
readme update
meignw2021 Oct 1, 2021
6311941
fixing sanity tests
meignw2021 Oct 3, 2021
aec07d5
install test requirements
meignw2021 Oct 4, 2021
9dc5fc9
Update ansible-test.yml
meignw2021 Oct 4, 2021
c73951c
Update ansible-test.yml
meignw2021 Oct 4, 2021
c9c3d00
Update ansible-test.yml
meignw2021 Oct 4, 2021
62890ba
Update ansible-test.yml
meignw2021 Oct 4, 2021
77b56c2
Update ansible-test.yml
meignw2021 Oct 4, 2021
16797db
Update ansible-test.yml
meignw2021 Oct 4, 2021
ac453af
Update ansible-test.yml
meignw2021 Oct 4, 2021
e30a5ba
Update ansible-test.yml
meignw2021 Oct 4, 2021
4c4301f
update readme, update pytest to include coverage report
meignw2021 Oct 7, 2021
0136c79
update test requirements
meignw2021 Oct 14, 2021
a350994
code and test updates for pytest and ansible sanity checks
meignw2021 Oct 14, 2021
c160f83
update workflow checks
meignw2021 Oct 14, 2021
e5160c5
readme updates
meignw2021 Oct 14, 2021
9a06120
checking workflow
meignw2021 Oct 14, 2021
af2ca15
add six to test requirements
meignw2021 Oct 14, 2021
27789f5
update coverage version
meignw2021 Oct 14, 2021
50f8360
Update test-requirements.txt
meignw2021 Oct 14, 2021
6104ee6
Update ansible-test.yml
meignw2021 Oct 14, 2021
511596c
Update test-requirements.txt
meignw2021 Oct 14, 2021
4cf5370
debug
meignw2021 Oct 14, 2021
ff22640
Update ansible-test.yml
meignw2021 Oct 14, 2021
e9f7c3e
Update ansible-test.yml
meignw2021 Oct 14, 2021
fab0bb4
Update ansible-test.yml
meignw2021 Oct 14, 2021
5366fb0
Update ansible-test.yml
meignw2021 Oct 14, 2021
ce5f16e
Update ansible-test.yml
meignw2021 Oct 14, 2021
7fb581f
Update ansible-test.yml
meignw2021 Oct 14, 2021
3d291a6
Update ansible-test.yml
meignw2021 Oct 14, 2021
5949719
Create __init__.py
meignw2021 Oct 14, 2021
5de0557
add tests
meignw2021 Oct 17, 2021
dc488a4
add collection
meignw2021 Oct 17, 2021
2ce2a30
Update ansible-test.yml
meignw2021 Oct 17, 2021
c632d09
Update ansible-test.yml
meignw2021 Oct 17, 2021
d6e7270
Update ansible-test.yml
meignw2021 Oct 17, 2021
4a06a31
Update ansible-test.yml
meignw2021 Oct 17, 2021
1141286
Update ansible-test.yml
meignw2021 Oct 17, 2021
4b3f802
Update ansible-test.yml
meignw2021 Oct 17, 2021
828484b
Update ansible-test.yml
meignw2021 Oct 17, 2021
87b1ae2
Update ansible-test.yml
meignw2021 Oct 17, 2021
fa7de77
Update ansible-test.yml
meignw2021 Oct 17, 2021
d96a54d
add tests for python 2.7, 3.5
meignw2021 Oct 20, 2021
81e3e60
add tests for python 2.7, 3.5
meignw2021 Oct 20, 2021
55b4708
add tests for python 2.7, 3.5
meignw2021 Oct 20, 2021
455e91d
wip
meignw2021 Oct 20, 2021
fa9e229
test utf-8 encoding to pass python 2.7, python 3.5
meignw2021 Oct 20, 2021
bd8ee82
remove shebang from non module files
meignw2021 Oct 20, 2021
ed9a1ab
wip
meignw2021 Oct 21, 2021
ce81e78
test
meignw2021 Oct 21, 2021
79d2c9f
Update ansible-test.yml
meignw2021 Oct 21, 2021
f02a48d
attempt to support py26 py27 py35
meignw2021 Oct 21, 2021
0706c26
fix sanity errors
meignw2021 Oct 21, 2021
c4f802b
run all unit tests
meignw2021 Oct 21, 2021
f8044d2
fix unit test
meignw2021 Oct 21, 2021
5e6c88d
fix sanity test
meignw2021 Oct 21, 2021
cf5256e
update tests
meignw2021 Oct 21, 2021
7ac053f
add python 2.6
meignw2021 Oct 21, 2021
19c2c9a
Update ansible-test.yml
meignw2021 Oct 21, 2021
e489705
cleanup unused files
meignw2021 Oct 21, 2021
aacb686
Merge branch 'ftd-7' into ftd-7-support-all
meignw2021 Oct 21, 2021
c2cbf1f
debug
meignw2021 Oct 21, 2021
b287b78
rollback change to super and test
meignw2021 Oct 22, 2021
53047bf
roll back super on put this on test branch
meignw2021 Oct 22, 2021
8bb0822
Test smr changes (#1)
meignw2021 Oct 26, 2021
957bf83
update changelog
meignw2021 Oct 26, 2021
899e625
Update changelog.yaml
meignw2021 Oct 26, 2021
c1a5d24
Update changelog.yaml
meignw2021 Oct 26, 2021
7856b59
readme updates, remove tox
meignw2021 Oct 26, 2021
6f5cda9
ignore failing import tests on python 2.6, 2.7
meignw2021 Oct 26, 2021
65dcd20
remove references to external collections
meignw2021 Oct 26, 2021
9110746
try moving test requirements
meignw2021 Oct 26, 2021
f37ad04
Update README.md
meignw2021 Oct 28, 2021
e48e82e
fixes and updates for github workflow, tests pass, ansible-test sanit…
meignw2021 Nov 2, 2021
73a0909
Update README.md
meignw2021 Nov 9, 2021
52466c9
Script run all integration tests
meignw2021 Nov 9, 2021
f268aad
run integration tests
meignw2021 Nov 9, 2021
c4914ae
remove reference to ansible_collection
meignw2021 Nov 18, 2021
91abd3f
fix upload / download test to pass proper json
meignw2021 Nov 19, 2021
6b8d739
Merge branch 'ftd-7' of https://github.com/meignw2021/FTDAnsible into…
meignw2021 Nov 19, 2021
96f829f
specify path to python interpreter so while running in docker there i…
meignw2021 Nov 24, 2021
30031cd
update ansible.cf, dockerfile for local development
meignw2021 Nov 29, 2021
3933eda
allow python 3.8 for requirements.txt
meignw2021 Nov 29, 2021
181906d
dockerfile for testing integration, update readme
meignw2021 Nov 29, 2021
788646f
Update README.md
meignw2021 Nov 29, 2021
488ebe9
Update README.md
meignw2021 Dec 3, 2021
25b533c
Deprecate ftd_install module
meignw2021 Dec 16, 2021
bb905e6
deprecate ftd_install module
meignw2021 Dec 16, 2021
0d8c38f
add tests from test/unit
meignw2021 Jan 18, 2022
5b9c535
fix errors in sanity test
meignw2021 Jan 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# README FIRST
# 1. replace "NAMESPACE" and "COLLECTION_NAME" with the correct name in the env section (e.g. with 'community' and 'mycollection')
# 2. If you don't have unit tests remove that section
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies"
# If you need help please ask in #ansible-devel on Freenode IRC

name: CI
on:
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
pull_request:
# Run CI once per day (at 06:00 UTC)
# This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version
schedule:
- cron: '0 6 * * *'
env:
NAMESPACE: cisco
COLLECTION_NAME: ftdansible

jobs:

###
# Check Build
#


build:
name: Build collection
runs-on: ubuntu-latest
strategy:
matrix:
ansible: [2.9.17, 2.10.5]
steps:
- name: Check out code
uses: actions/checkout@v2

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

- 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: Build a collection tarball
run: pwd && ls -al && find . && ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"

- name: Store migrated collection artifacts
uses: actions/upload-artifact@v1
with:
name: collection
path: .cache/collection-tarballs

###
# Check Importer
#

importer:
name: Galaxy-importer check
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

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

- name: Download migrated collection artifacts
uses: actions/download-artifact@v1
with:
name: collection
path: .cache/collection-tarballs

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

- name: Install galaxy-importer
run: pip install galaxy-importer

- name: Create galaxy-importer directory
run: sudo mkdir -p /etc/galaxy-importer

- name: Create galaxy-importer.cfg
run: sudo cp /home/runner/.ansible/collections/ansible_collections/cisco/ftdansible/.github/workflows/galaxy-importer.cfg /etc/galaxy-importer/galaxy-importer.cfg

- name: Run galaxy-importer check
run: python -m galaxy_importer.main .cache/collection-tarballs/cisco-*.tar.gz | tee .cache/collection-tarballs/log.txt && sudo cp ./importer_result.json .cache/collection-tarballs/importer_result.json

- name: Check warnings and errors
run: if grep -E 'ERROR' .cache/collection-tarballs/log.txt; then exit 1; else exit 0; fi

- name: Store galaxy_importer check log file
uses: actions/upload-artifact@v1
with:
name: galaxy-importer-log
path: .cache/collection-tarballs/importer_result.json

###
# Sanity tests (REQUIRED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html

sanity:
name: Sanity (Ⓐ${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.9
- stable-2.10
# It's important that Sanity is tested against all stable-X.Y branches
# Testing against `devel` may fail as new tests are added.
# - stable-2.9 # Only if your collection supports Ansible 2.9
runs-on: ubuntu-latest
steps:

# ansible-test requires the collection to be in a directory in the form
# .../ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/

- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Set up Python
uses: actions/setup-python@v2
with:
# it is just required to run that once as "ansible-test sanity" in the docker image
# will run on all python versions it supports.
python-version: 3.8

# Install the head of the given branch (devel, stable-2.10)
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run sanity tests
run: ansible-test sanity --docker -v --color
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

# ansible-test support producing code coverage date
- name: Generate coverage report
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

# See the reports at https://codecov.io/gh/GITHUBORG/REPONAME
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false

###
# Unit tests (REQUIRED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html

units:
name: Unit (Ⓐ${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.9
- stable-2.10
# It's important that Sanity is tested against all stable-X.Y branches
# Testing against `devel` may fail as new tests are added.
# - stable-2.9 # Only if your collection supports Ansible 2.9
runs-on: ubuntu-latest
steps:

# ansible-test requires the collection to be in a directory in the form
# .../ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/

- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Set up Python
uses: actions/setup-python@v2
with:
# it is just required to run that once as "ansible-test sanity" in the docker image
# will run on all python versions it supports.
python-version: 3.8

# Install the head of the given branch (devel, stable-2.10)
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

# Install units
# - name: Install units
# run: pip install units

# Run the unit tests on python 3.5
- name: Run unit tests
run: ansible-test units --docker -v --color
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
9 changes: 9 additions & 0 deletions .github/workflows/galaxy-importer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[galaxy-importer]
LOG_LEVEL_MAIN = INFO
RUN_FLAKE8 = True
RUN_ANSIBLE_DOC = True
RUN_ANSIBLE_LINT = True
RUN_ANSIBLE_TEST = False
ANSIBLE_TEST_LOCAL_IMAGE = False
LOCAL_IMAGE_DOCKER = False
INFRA_OSD = False
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ venv.bak/

# Doc distribution folder
docs/dist
workspace/
tests/output
42 changes: 0 additions & 42 deletions CHANGELOG.md

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
==============================
Cisco.Ftdansible Release Notes
==============================

.. contents:: Topics


v0.3.0
======
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
ARG PYTHON_VERSION=3.6
FROM python:${PYTHON_VERSION}
ARG FTD_ANSIBLE_VERSION=v0.3.1
ARG FTD_ANSIBLE_VERSION=v0.4.1236
ARG FTD_ANSIBLE_FOLDER=ftd-ansible

RUN apt-get update && \
apt-get install -yq sshpass && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN wget https://github.com/CiscoDevNet/FTDAnsible/archive/${FTD_ANSIBLE_VERSION}.tar.gz && \
tar -xvf ${FTD_ANSIBLE_VERSION}.tar.gz
RUN wget https://github.com/meignw2021/FTDAnsible/archive/refs/tags/${FTD_ANSIBLE_VERSION}.tar.gz && \
tar -xvf ${FTD_ANSIBLE_VERSION}.tar.gz

RUN mkdir /${FTD_ANSIBLE_FOLDER}/ && \
export FTD_SOURCE_FOLDER=`find ./ -maxdepth 1 -type d -name '*FTDAnsible-*'` && \
mv $FTD_SOURCE_FOLDER/httpapi_plugins /${FTD_ANSIBLE_FOLDER} && \
mv $FTD_SOURCE_FOLDER/library /${FTD_ANSIBLE_FOLDER} && \
mv $FTD_SOURCE_FOLDER/module_utils /${FTD_ANSIBLE_FOLDER} && \
mv $FTD_SOURCE_FOLDER/requirements.txt /${FTD_ANSIBLE_FOLDER} && \
RUN mkdir -p /${FTD_ANSIBLE_FOLDER}/
RUN export FTD_SOURCE_FOLDER=`find ./ -maxdepth 1 -type d -name '*FTDAnsible-*'` && \
mv $FTD_SOURCE_FOLDER/ansible_collections /${FTD_ANSIBLE_FOLDER}/ && \
mv $FTD_SOURCE_FOLDER/requirements.txt /${FTD_ANSIBLE_FOLDER}/ && \
mv $FTD_SOURCE_FOLDER/ansible.cfg /${FTD_ANSIBLE_FOLDER}

RUN pip install --no-cache-dir -r /${FTD_ANSIBLE_FOLDER}/requirements.txt
Expand Down
28 changes: 28 additions & 0 deletions Dockerfile.ansible29.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG PYTHON_VERSION=3.6
FROM python:${PYTHON_VERSION}

COPY requirements.ansible29.txt /requirements.txt

RUN pip download $(grep ^ansible ./requirements.txt) --no-cache-dir --no-deps -d /tmp/pip && \
mkdir /tmp/ansible && \
tar -C /tmp/ansible -xf /tmp/pip/ansible* && \
mv /tmp/ansible/ansible* /ansible && \
rm -rf /tmp/pip /tmp/ansible

COPY test-requirements.txt /test-requirements.txt

RUN pip install \
--no-cache-dir \
-c /ansible/test/lib/ansible_test/_data/requirements/constraints.txt \
-r /test-requirements.txt \
-r /requirements.txt

ENV PYTHONPATH="$PYTHONPATH:/ansible/lib:/ansible/test"

COPY . /ftd-ansible

WORKDIR /ftd-ansible

ENTRYPOINT ["pytest"]

CMD ["test"]
5 changes: 3 additions & 2 deletions Dockerfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ COPY test-requirements.txt /test-requirements.txt

RUN pip install \
--no-cache-dir \
-c /ansible/test/runner/requirements/constraints.txt \
-c /ansible/ansible_collections/community/general/tests/utils/constraints.txt \
-r /test-requirements.txt \
-r /requirements.txt

ENV PYTHONPATH="$PYTHONPATH:/ansible/lib:/ansible/test"
ENV PYTHONPATH="$PYTHONPATH:/ftd-ansible/ansible/lib:/ftd-ansible/ansible/test"

COPY . /ftd-ansible

Expand All @@ -26,3 +26,4 @@ WORKDIR /ftd-ansible
ENTRYPOINT ["pytest"]

CMD ["test"]

28 changes: 28 additions & 0 deletions Dockerfile_integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG PYTHON_VERSION=3.6
FROM python:${PYTHON_VERSION}
ARG FTD_ANSIBLE_VERSION=v0.4.1236
ARG FTD_ANSIBLE_FOLDER=/root/ansible_collections/cisco/ftdansible

RUN apt-get update && \
apt-get install -yq sshpass && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN mkdir -p ${FTD_ANSIBLE_FOLDER}/

RUN ls -al /tmp

COPY requirements.txt ${FTD_ANSIBLE_FOLDER}/
RUN pip install --no-cache-dir -r /${FTD_ANSIBLE_FOLDER}/requirements.txt

COPY test-requirements.txt ${FTD_ANSIBLE_FOLDER}/
COPY galaxy.yml ${FTD_ANSIBLE_FOLDER}/
COPY meta ${FTD_ANSIBLE_FOLDER}/meta
COPY plugins ${FTD_ANSIBLE_FOLDER}/plugins
COPY samples ${FTD_ANSIBLE_FOLDER}/samples
COPY tests ${FTD_ANSIBLE_FOLDER}/tests


ENV PYTHONPATH="$PYTHONPATH:/${FTD_ANSIBLE_FOLDER}/"
WORKDIR /${FTD_ANSIBLE_FOLDER}
ENTRYPOINT ["ansible-playbook"]
# CMD ["bash"]
Loading