Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-5] Add github workflow #1645

Merged
Merged
42 changes: 42 additions & 0 deletions .github/workflows/all_green_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: all_green

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
branches:
- main
- 'stable-*'
tags:
- '*'

jobs:
changelog-and-linters:
uses: ./.github/workflows/changelog_and_linters.yml # use the callable changelog-and-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:
- changelog-and-linters
- sanity
- units
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.changelog-and-linters.result }}',
'${{ needs.sanity.result }}',
'${{ needs.units.result }}'
]) == {'success'}"
17 changes: 17 additions & 0 deletions .github/workflows/ansible-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ansible bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useless here, this can of workflow are defined on the default branch

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
10 changes: 10 additions & 0 deletions .github/workflows/changelog_and_linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: changelog and linters

on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
linters:
uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
12 changes: 12 additions & 0 deletions .github/workflows/galaxy-importer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Galaxy Importer
on:
push:
branches:
- main
- stable-*
pull_request:
schedule:
- cron: '0 13 * * *'
jobs:
importer:
uses: ansible-network/github_actions/.github/workflows/galaxy_importer.yml@main
64 changes: 64 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: sanity tests

on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
with:
matrix_include: "[]"
matrix_exclude: >-
[
{
"ansible-version": "stable-2.9"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.7"
},
{
"ansible-version": "milestone",
"python-version": "3.8"
},
{
"ansible-version": "devel",
"python-version": "3.7"
},
{
"ansible-version": "devel",
"python-version": "3.8"
}
]
64 changes: 64 additions & 0 deletions .github/workflows/units.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: unit 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
with:
matrix_exclude: >-
[
{
"python-version": "3.11"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.7"
},
{
"ansible-version": "milestone",
"python-version": "3.8"
},
{
"ansible-version": "devel",
"python-version": "3.7"
},
{
"ansible-version": "devel",
"python-version": "3.8"
}
]
collection_pre_install: ''
17 changes: 17 additions & 0 deletions .github/workflows/update-variables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: update collection variables

concurrency:
group: '${{ github.workflow }} @ ${{ github.sha }}'
cancel-in-progress: true

on:
push:
branches:
- main
- 'stable-*'
pull_request_target:

jobs:
update-variables:
uses: ansible-network/github_actions/.github/workflows/update_aws_variables.yml@main
4 changes: 4 additions & 0 deletions changelogs/fragments/20230704-add_github_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trivial:
- "Add sanity, units and linters and changelog GitHub workflows."
- "Fix linting and validation errors across several modules."
- "Remove Python < 3.6 compatibility code for unit tests."
2 changes: 1 addition & 1 deletion plugins/modules/autoscaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ def create_autoscaling_group(connection):
else:
ag['LaunchTemplate'] = launch_object['LaunchTemplate']
else:
module.fail_json_aws(e, msg="Missing LaunchConfigurationName or LaunchTemplate")
module.fail_json(msg="Missing LaunchConfigurationName or LaunchTemplate")

try:
create_asg(connection, **ag)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cloudwatch_metric_alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
you to create an alarm based on the result of a metric math expression.
type: list
required: false
default: []
version_added: "5.5.0"
elements: dict
suboptions:
Expand Down Expand Up @@ -216,7 +217,6 @@
- U(https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension)
required: false
type: dict
default: {}
alarm_actions:
description:
- A list of the names action(s) taken when the alarm is in the C(alarm) status, denoted as Amazon Resource Name(s).
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ec2_eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def associate_ip_and_device(ec2, module, address, private_ip_address, device_id,
msg = "Couldn't associate Elastic IP address with network interface '{0}'".format(device_id)
module.fail_json_aws(e, msg=msg)
if not res:
module.fail_json_aws(e, msg='Association failed.')
module.fail_json(msg='Association failed.')

return {'changed': True}

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/lambda_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def delete_layer_version(lambda_client, params, check_mode=False):
try:
lambda_client.delete_layer_version(LayerName=name, VersionNumber=layer["version"])
except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
LambdaLayerFailure(e, "Failed to delete layer version LayerName={0}, VersionNumber={1}.".format(name, version))
raise LambdaLayerFailure(e, "Failed to delete layer version LayerName={0}, VersionNumber={1}.".format(name, version))
return {"changed": changed, "layer_versions": deleted_versions}


Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/route53_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_native

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pytest
pytest-forked
pytest-mock
pytest-xdist
pytest-ansible-units ; python_version > '3.8'

# Needed for ansible.utils.ipaddr in tests
netaddr
Expand Down
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this
Loading