-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fernando
committed
Jul 3, 2024
0 parents
commit 468ea8c
Showing
506 changed files
with
36,708 additions
and
0 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,41 @@ | ||
--- | ||
name: all_green | ||
|
||
on: | ||
push: # run on every push on folliwing branches | ||
branches: | ||
- main | ||
- stable-1.x | ||
- devel | ||
- dev | ||
# run on all prs | ||
pull_request: | ||
|
||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ | ||
github.event.pull_request.number || github.sha | ||
}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linters: | ||
uses: ./.github/workflows/linters.yml # use the callable linters job to run tests | ||
sanity: | ||
uses: ./.github/workflows/sanity.yml # use the callable sanity job to run tests | ||
units: | ||
uses: ./.github/workflows/units.yml # use the callable units job to run tests | ||
all_green: | ||
if: ${{ always() }} | ||
needs: | ||
- linters | ||
- sanity | ||
- units | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: >- | ||
python -c "assert set([ | ||
'${{ needs.linters.result }}', | ||
'${{ needs.sanity.result }}', | ||
'${{ needs.units.result }}' | ||
]) == {'success'}" |
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,17 @@ | ||
--- | ||
name: ansible bot | ||
on: | ||
issues: | ||
types: | ||
- opened | ||
- reopened | ||
jobs: | ||
add_label: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
steps: | ||
- uses: actions-ecosystem/action-add-labels@v1 | ||
with: | ||
labels: needs_triage |
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,118 @@ | ||
name: Integration tests, dependencies from source | ||
# this workflow is not run in any action | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
integration_source: | ||
env: | ||
PY_COLORS: "1" | ||
source_directory: "./source" | ||
collection_base_dir: "/home/runner/collections" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ansible-version: | ||
- stable-2.15 | ||
- stable-2.16 | ||
- stable-2.17 | ||
- milestone | ||
- devel | ||
python-version: | ||
- "3.10" | ||
- "3.11" | ||
- "3.12" | ||
exclude: | ||
- ansible-version: stable-2.15 | ||
python-version: "3.12" | ||
continue-on-error: ${{ matrix.ansible-version == 'devel' }} | ||
name: "py${{ matrix.python-version }} / ${{ matrix.ansible-version }}" | ||
steps: | ||
- name: Checkout the collection repository | ||
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main | ||
with: | ||
path: ${{ env.source_directory }} | ||
fetch-depth: "0" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install ansible-core (${{ matrix.ansible-version }}) | ||
run: | | ||
python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check | ||
- name: Pre install collections dependencies first so the collection install does not | ||
if: ${{ inputs.collection_pre_install != '' }} | ||
run: | | ||
ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p ${{ env.collection_base_dir }} | ||
- name: Read collection metadata from galaxy.yml | ||
id: identify | ||
uses: ansible-network/github_actions/.github/actions/identify_collection@main | ||
with: | ||
source_path: ${{ env.source_directory }} | ||
|
||
- name: Build and install the collection | ||
uses: ansible-network/github_actions/.github/actions/build_install_collection@main | ||
with: | ||
install_python_dependencies: true | ||
source_path: ${{ env.source_directory }} | ||
collection_path: ${{ steps.identify.outputs.collection_path }} | ||
tar_file: ${{ steps.identify.outputs.tar_file }} | ||
ansible_version: ${{ matrix.ansible-version }} | ||
|
||
- name: Print the ansible version | ||
run: ansible --version | ||
|
||
- name: Print the python dependencies | ||
run: python3 -m pip list | ||
|
||
- name: Create integration_config.yml | ||
run: | | ||
cd ${{ steps.identify.outputs.collection_path }}/tests/integration | ||
cat <<EOF > integration_config.yml | ||
tenable_access_key: ${{ secrets.TENABLE_ACCESS_KEY }} | ||
tenable_secret_key: ${{ secrets.TENABLE_SECRET_KEY }} | ||
EOF | ||
- name: Run api integration tests and excluding the ones that depend on assets | ||
run: | | ||
. /tmp/venv_${{ matrix.python-version }}_${{ matrix.ansible-version.replace('.', '_') }}/bin/activate | ||
excludeList=( | ||
"add_agent_to_group/" | ||
"create_report/" | ||
"get_agent_details/" | ||
"get_asset_activity_log/" | ||
"get_asset_information/" | ||
"get_asset_vulnerability_details/" | ||
"get_report_status/" | ||
"list_agents_by_group/" | ||
"list_asset_vulnerabilities/" | ||
"list_asset_vulnerabilities_for_plugin/" | ||
"list_tags_for_an_asset/" | ||
"rename_agent/" | ||
"update_agent_group_name/" | ||
"upload_file/" | ||
"get_scanner_details/" | ||
"launch_scan/" | ||
"list_agents/" | ||
"stop_scan/" | ||
"update_scan/" | ||
"add_or_remove_asset_tags/" | ||
"get_asset_details/" | ||
"create_network/" | ||
"delete_network/" | ||
"get_network_asset_count/" | ||
"get_network_details/" | ||
"list_networks/" | ||
"list_network_scanners/" | ||
"list_assignable_scanners/" | ||
"update_network/" | ||
) | ||
excludeArgs=$(printf " --exclude %s" "${excludeList[@]}") | ||
ansible-test integration $excludeArgs -v | ||
working-directory: ${{ steps.identify.outputs.collection_path }} |
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,13 @@ | ||
name: CI for Linter Checks using tox, isort, flake, ansible-lint | ||
|
||
|
||
on: [workflow_call] # allow this workflow to be called from other workflows | ||
|
||
|
||
jobs: | ||
linters: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
uses: ansible-network/github_actions/.github/workflows/tox.yml@main | ||
with: | ||
envname: "" | ||
labelname: "lint" |
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,8 @@ | ||
name: CI for Sanity Checks of ansible-test sanity | ||
|
||
on: [workflow_call] # allow this workflow to be called from other workflows | ||
|
||
jobs: | ||
sanity: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main |
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,7 @@ | ||
name: unti tests | ||
|
||
on: [workflow_call] # allow this workflow to be called from other workflows | ||
|
||
jobs: | ||
unit-source: | ||
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main |
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,33 @@ | ||
.tox/ | ||
__pycache__/ | ||
tests/output/ | ||
secrets.yml | ||
integration_config.yml | ||
tests/integration/targets/*/vars/main.yml/* | ||
molecule/ | ||
docs/ | ||
dest/ | ||
machines/ | ||
dockerfiles/ | ||
htmlcov/ | ||
containers/ | ||
assets_list.json | ||
assets_tenable.json | ||
agents.json | ||
dest/ | ||
others/ | ||
.coverage | ||
.azure-pipelines/Dockerfile | ||
.azure-pipelines/dockerfile_simple | ||
networks | ||
assets | ||
agents.json | ||
assets_list2.json | ||
assets_list.json | ||
valkiriaaquatica-tenable-[0-9]*.tar.gz | ||
MANIFEST.json | ||
inventario.json | ||
scripts_dev/ | ||
tox-ansible.ini | ||
review_tox | ||
test_tfg/ |
Empty file.
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,11 @@ | ||
# CI | ||
|
||
## Tenable Nessus Agent Collections | ||
|
||
GitHub Actions are used to run the Continuous Integration for valkiriaaquatica.tenable collection. The workflows used for the CI can be found in the /.github/workflow/ directory. These workflows include jobs to run the integration tests, sanity tests, linters, check and doc related checks. The following table lists the python and ansible versions against which these jobs are run. | ||
|
||
| Jobs | Description | Python Versions | Ansible Versions | | ||
| ------ |-------| ------ | -----------| | ||
| Linters | Runs 'black', 'flake8','isort','ansible-linter' on plugins and tests | ||
| Unit tests | Executes the unit test cases | 3.9, 3.10, 3.11.0, 3.12.0 | Stable-2.15+ | | ||
| Integration tests | Executes the integration test suites. To run them, it is necessary to adjust in the integration_config.yml file the credentials or if it is run on GitHub actions defined them as secret variables | 3.9, 3.10, 3.11.0, 3.12.0 | Stable-2.15+ | |
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,88 @@ | ||
# Contributing | ||
|
||
## Tenable Nessus Agent Collection | ||
|
||
|
||
### valkiriaaquatica.tenable | ||
Contains most of the interactions that can be donde with Tenable.IO API usefull for the nessus agent. | ||
|
||
|
||
## Submitting Issues | ||
|
||
For any new module idea, code review, change or whatever please pr on this repository on a new patch branch. | ||
Also any issue can be open to improve, delete, change or any idea sbmitted on any part of the collection. | ||
|
||
## Writing New Code and Testing (recommended but not mandatory) | ||
|
||
Please follow the Ansible Documentation on [these instructions](https://docs.ansible.com/ansible/latest/community/create_pr_quick_start.html) | ||
for developing the new code for the collection. | ||
Also any Documentation can be change or improve. | ||
|
||
It is recommended to execute this on a python virtual enviroment. | ||
1. Create the virtual enviroment (recommended) | ||
``` | ||
python3 -m venv env | ||
``` | ||
2. Install testing requirements | ||
``` | ||
pip install -r test-requirements.txt | ||
``` | ||
3. Write your code and your tests (recommended but not mandatory) | ||
|
||
- Sanity tests: | ||
``` | ||
ansible-test sanity --docker -v | ||
``` | ||
|
||
- Unit tests: | ||
``` | ||
ansible-test unit --docker -v | ||
``` | ||
|
||
- Integration tests: | ||
``` | ||
ansible-test integration name_of_the_test_module --docker -v | ||
``` | ||
|
||
If you get stuck with any of this tests, when the PR is sbmitted it will automatically test for sanity and unit tests. | ||
|
||
## Check for pending Tests to be done | ||
In the collection directory there is the check_pending_tests.sh file. | ||
Follow this steps to output the pending and done tests. | ||
``` | ||
chmod +x check_pending_tests.sh | ||
``` | ||
|
||
``` | ||
./check_pending_tests.sh | ||
``` | ||
|
||
## Blessed Contributions on Pending Developments | ||
- Tests: not all modules have integration tests written, feel free to try. | ||
- Not all plugins/modules have the RETURN specified, feel free to complete. | ||
- Docs: there are nod docs written for reading the collection outside GitHub, feel free to help documenting. | ||
- Recheck CI: i'm working on a recheck option to actual execute all_green CI when a recheck or RECHECK is written on a pull request. | ||
(As a Jenkins user GitHub actions is a bit new for me) | ||
- Help a shared library for Jenkins to implement the actual GitHub actions like sanity, units or linter but with Jenkins. | ||
|
||
## More information about contributing | ||
|
||
General information about setting up your Python environment, testing modules, | ||
Ansible coding styles, and more can be found in the [Ansible Community Guide]( | ||
https://docs.ansible.com/ansible/latest/community/index.html). | ||
|
||
|
||
For general information on running the integration tests see | ||
[this page](https://docs.ansible.com/ansible/latest/community/collection_contributors/test_index.html) and | ||
[Integration Tests page of the Module Development Guide](https://docs.ansible.com/ansible/devel/dev_guide/testing_integration.html#non-destructive-tests). | ||
Ignore the part about `source hacking/env-setup`. That's only applicable for working on `ansible-core`. | ||
You should be able to use the `ansible-test` that's installed with Ansible generally. | ||
Look at [the section on configuration for cloud tests](https://docs.ansible.com/ansible/devel/dev_guide/testing_integration.html#other-configuration-for-cloud-tests). | ||
|
||
- [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) - Details on contributing to Ansible | ||
- [Contributing to Collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections) - How to check out collection git repositories correctly | ||
|
||
|
||
|
||
### Communication | ||
At the moment there is no communication channel, I'm sorry for that :( |
Oops, something went wrong.