Skip to content

Commit 61e708b

Browse files
authored
feat: Improve Ansible/Jinja2 validation (#752)
1 parent eed6af8 commit 61e708b

File tree

7 files changed

+73
-63
lines changed

7 files changed

+73
-63
lines changed

.github/workflows/f5-cla.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
2-
name: F5 CLA
3-
on:
4-
issue_comment:
5-
types: [created]
6-
pull_request_target:
7-
types: [opened, closed, synchronize]
8-
permissions: read-all
9-
jobs:
10-
f5-cla:
11-
name: F5 CLA
12-
runs-on: ubuntu-24.04
13-
permissions:
14-
actions: write
15-
pull-requests: write
16-
statuses: write
17-
steps:
18-
- name: Run F5 Contributor License Agreement (CLA) assistant
19-
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target'
20-
uses: contributor-assistant/github-action@9340315624c6e16cef1f2c63bdeb0f0c49c6f474 # v2.4.0
21-
with:
22-
# Any pull request targeting the following branch will trigger a CLA check.
23-
branch: main
24-
# Path to the CLA document.
25-
path-to-document: https://github.com/f5/.github/blob/main/CLA/cla-markdown.md
26-
# Custom CLA messages.
27-
custom-notsigned-prcomment: '🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) and reply on a new comment with the following text to agree:'
28-
custom-pr-sign-comment: 'I have hereby read the F5 CLA and agree to its terms'
29-
custom-allsigned-prcomment: '✅ All required contributors have signed the F5 CLA for this PR. Thank you!'
30-
# Remote repository storing CLA signatures.
31-
remote-organization-name: f5
32-
remote-repository-name: f5-cla-data
33-
path-to-signatures: signatures/signatures.json
34-
# Comma separated list of usernames for maintainers or any other individuals who should not be prompted for a CLA.
35-
allowlist: alessfg, oxpa, bot*
36-
# Do not lock PRs after a merge.
37-
lock-pullrequest-aftermerge: false
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
PERSONAL_ACCESS_TOKEN: ${{ secrets.F5_CLA_TOKEN }}
2+
name: F5 CLA
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_target:
7+
types: [opened, closed, synchronize]
8+
permissions: read-all
9+
jobs:
10+
f5-cla:
11+
name: F5 CLA
12+
runs-on: ubuntu-24.04
13+
permissions:
14+
actions: write
15+
pull-requests: write
16+
statuses: write
17+
steps:
18+
- name: Run F5 Contributor License Agreement (CLA) assistant
19+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target'
20+
uses: contributor-assistant/github-action@9340315624c6e16cef1f2c63bdeb0f0c49c6f474 # v2.4.0
21+
with:
22+
# Any pull request targeting the following branch will trigger a CLA check.
23+
branch: main
24+
# Path to the CLA document.
25+
path-to-document: https://github.com/f5/.github/blob/main/CLA/cla-markdown.md
26+
# Custom CLA messages.
27+
custom-notsigned-prcomment: '🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) and reply on a new comment with the following text to agree:'
28+
custom-pr-sign-comment: 'I have hereby read the F5 CLA and agree to its terms'
29+
custom-allsigned-prcomment: '✅ All required contributors have signed the F5 CLA for this PR. Thank you!'
30+
# Remote repository storing CLA signatures.
31+
remote-organization-name: f5
32+
remote-repository-name: f5-cla-data
33+
path-to-signatures: signatures/signatures.json
34+
# Comma separated list of usernames for maintainers or any other individuals who should not be prompted for a CLA.
35+
allowlist: alessfg, oxpa, bot*
36+
# Do not lock PRs after a merge.
37+
lock-pullrequest-aftermerge: false
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
PERSONAL_ACCESS_TOKEN: ${{ secrets.F5_CLA_TOKEN }}

.github/workflows/release.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
name: Release Drafter
3-
on:
4-
push:
5-
branches: [main]
6-
pull_request_target:
7-
types: [opened, reopened, synchronize]
8-
permissions: read-all
9-
jobs:
10-
release-draft:
11-
name: Update release draft
12-
runs-on: ubuntu-24.04
13-
permissions:
14-
contents: write
15-
pull-requests: write
16-
steps:
17-
- name: Run release drafter
18-
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
19-
env:
20-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2+
name: Release Drafter
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request_target:
7+
types: [opened, reopened, synchronize]
8+
permissions: read-all
9+
jobs:
10+
release-draft:
11+
name: Update release draft
12+
runs-on: ubuntu-24.04
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- name: Run release drafter
18+
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ FEATURES:
1212
- Add support for installing NGINX Open Source on Alpine Linux 3.20.
1313
- Add support for installing NGINX Agent on Ubuntu noble.
1414
- Add validation tasks to check the Ansible version, the Jinja2 version, and whether the required Ansible collections for this role are installed.
15+
- Bump the minimum version of Ansible supported to `2.16`, whilst clarifying that Ansible `2.18` is not supported at this stage.
1516
- Bump the Ansible `community.general` collection to `9.2.0`, `community.crypto` collection to `2.21.1` and `community.docker` collection to `3.11.0`.
1617

1718
DOCUMENTATION:
@@ -28,6 +29,7 @@ CI/CD:
2829
- Update GitHub Actions to Ubuntu 24.04.
2930
- Switch GitHub Actions from using tags to release hashes.
3031
- Remove commented out Molecule platforms and GitHub Actions QEMU step for the time being. These changes will be reverted if multi-arch testing can be reinstated in GitHub Actions.
32+
- Bump the minimum version of Ansible supported on Ansible Galaxy to `2.16`.
3133
- Remove platform metadata from the Ansible Galaxy role metadata since platforms are no longer supported in Ansible Galaxy NG.
3234
- Implement OSSF Scorecard.
3335

@@ -62,7 +64,7 @@ CI/CD:
6264
- Add Molecule tests for NGINX Amplify.
6365
- Update the RHEL based tests to use the latest UBI release.
6466
- Use the local role name (`ansible-role-nginx`) instead of the fully qualified role name (`nginxinc.nginx`) in Molecule to ensure tests always work as intended in environments where the role has been already installed beforehand.
65-
- Implement F5 CLA signatures.
67+
- Implement F5 CLA.
6668
- Hardcode version of Python requests module given its propensity to break the Docker Python SDK.
6769

6870
## 0.24.2 (October 3rd, 2023)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Follow this project's [Installation Guide](/README.md#Installation) to install A
2121

2222
### Project Structure
2323

24-
- The NGINX Ansible role is written in `yaml` and supports NGINX Open Source, NGINX Plus, NGINX Agent and NGINX Amplify.
24+
- The NGINX Ansible role is written in [`yaml`](https://yaml.org) and supports NGINX Open Source, NGINX Plus, NGINX Agent and NGINX Amplify.
2525
- The project follows the standard [Ansible role directory structure](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html):
2626
- The main "codebase" is found in the [`tasks/`](/tasks/) directory.
2727
- Variables can be found in [`defaults/main/`](/defaults/main/). The filenames in this directory highlight which variables are contained in each file.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ This will also ensure you are deploying/running this role with a fully tested ve
4545
#### Ansible core
4646

4747
- This role is developed and tested with [maintained](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html) versions of Ansible core and Python.
48+
49+
***Note:** Ansible `2.18` does no longer support the `yum` module and as such, is not supported by this role until Amazon Linux 2 reaches EoL.*
4850
- When using Ansible core, you will also need to install the following Ansible collections:
4951

5052
```yaml

tasks/validate/validate.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
- name: Verify you are using a supported Ansible version on your Ansible host
33
ansible.builtin.assert:
4-
that: ansible_version['full'] is version('2.16', '>=')
4+
that:
5+
- ansible_version['full'] is version(nginx_ansible_version, '>=')
6+
- ansible_version['full'] is version('2.18', '<')
57
success_msg: Ansible {{ ansible_version['full'] }} is supported.
6-
fail_msg: Ansible {{ ansible_version['full'] }} has reached End of Life (EoL). Please upgrade to a supported Ansible release. Check the README for more details.
8+
fail_msg: ({{ ansible_version['full'] is version('2.18', '>=') }} | ternary('Ansible {{ ansible_version['full'] }} is not yet supported. Please downgrade to a supported Ansible release', 'Ansible {{ ansible_version['full'] }} has reached End of Life (EoL). Please upgrade to a supported Ansible release.') Check the README for more details.
79
delegate_to: localhost
810
ignore_errors: true # noqa ignore-errors
911

@@ -16,7 +18,7 @@
1618

1719
- name: Verify that you are using a supported Jinja2 version on your Ansible host
1820
ansible.builtin.assert:
19-
that: (jinja2_version['stdout'] | regex_search('jinja version = ([\\d.]+)', '\\1') | first) is version('3.1', '>=')
21+
that: (jinja2_version['stdout'] | regex_search('jinja version = ([\\d.]+)', '\\1') | first) is version(nginx_jinja2_version, '>=')
2022
success_msg: Jinja2 {{ jinja2_version['stdout'] | regex_search('jinja version = ([\d.]+)', '\1') | first }} is supported.
2123
fail_msg: Jinja2 {{ jinja2_version['stdout'] | regex_search('jinja version = ([\d.]+)', '\1') | first }} is not supported. Please upgrade to Jinja2 3.1. Check the README for more details.
2224
delegate_to: localhost

vars/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
# Set the minimum version required for Ansible and Jinja2
3+
nginx_ansible_version: 2.16
4+
nginx_jinja2_version: 3.1
5+
26
# Set the values allowed for various variables
37
nginx_setup_vars: [install, uninstall, upgrade]
48

0 commit comments

Comments
 (0)