Skip to content

Commit

Permalink
Bring CI/CD up to date and resolve Python 3 cryptography issue (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessfg authored Jan 17, 2024
1 parent de262dc commit f26729c
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 40 deletions.
4 changes: 3 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
exclude_paths:
- .github/
offline: true
skip_list:
- args[module]
- name[template]
- schema[meta]
- yaml[line-length]
1 change: 1 addition & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
include-pre-releases: true
categories:
- title: "💣 Breaking Changes"
labels:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out the codebase
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,36 @@ on:
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
ansible-lint:
name: Ansible Lint
runs-on: ubuntu-22.04
steps:
- name: Check out the codebase
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install Ansible Lint
run: pip3 install -r .github/workflows/requirements/requirements_ansible_lint.txt

- name: Install Ansible collection dependencies
run: ansible-galaxy install -r .github/workflows/requirements/requirements_ansible.yml

- name: Run Ansible Lint
run: ansible-lint --force-color

molecule:
name: Molecule
runs-on: ubuntu-22.04
needs: ansible-lint
env:
NGINX_CRT: ${{ secrets.NGINX_CRT }}
NGINX_KEY: ${{ secrets.NGINX_KEY }}
RHEL_USERNAME: ${{ secrets.RHEL_USERNAME }}
RHEL_PASSWORD: ${{ secrets.RHEL_PASSWORD }}
strategy:
fail-fast: false
matrix:
Expand All @@ -27,10 +54,10 @@ jobs:
- uninstall
steps:
- name: Check out the codebase
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

Expand All @@ -46,7 +73,4 @@ jobs:
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
NGINX_CRT: ${{ secrets.NGINX_CRT }}
NGINX_KEY: ${{ secrets.NGINX_KEY }}
RHEL_USERNAME: ${{ secrets.RHEL_USERNAME }}
RHEL_PASSWORD: ${{ secrets.RHEL_PASSWORD }}

10 changes: 5 additions & 5 deletions .github/workflows/requirements/requirements_ansible.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
collections:
- name: ansible.posix
version: 1.4.0
- name: community.crypto
version: 2.10.0
version: 1.5.4
- name: community.general
version: 6.2.0
version: 6.4.0
- name: community.crypto
version: 2.14.1
- name: community.docker # Only required if you plan to use Molecule
version: 3.4.0
version: 3.4.7
5 changes: 5 additions & 0 deletions .github/workflows/requirements/requirements_ansible_lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ansible-core==2.16.2
jinja2==3.1.3
ansible-compat==4.1.11
yamllint==1.33.0
ansible-lint==6.22.1
2 changes: 1 addition & 1 deletion .github/workflows/requirements/requirements_galaxy.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ansible-core==2.14.4
ansible-core==2.16.2
12 changes: 6 additions & 6 deletions .github/workflows/requirements/requirements_molecule.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ansible-core==2.14.4
Jinja2==3.1.2
ansible-lint==6.15.0
yamllint==1.30.0
molecule[docker]==4.0.4
docker==6.0.1
ansible-core==2.16.2
jinja2==3.1.3
ansible-compat==4.1.11
molecule==6.0.3
molecule-plugins[docker]==23.5.0
docker==7.0.0
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.9.1 (Unreleased)

ENHANCEMENTS:

- Bump the Ansible `ansible.posix` collection to `1.5.4`, `community.general` collection to `6.4.0`, `community.crypto` collection to `2.14.1` and `community.docker` collection to `3.4.7`.
- Oracle Linux 8 requires the Python `python3.11-cryptography` package for validating the NGINX App Protect repository certificate.

CI/CD:

- Split Ansible Lint into its own GitHub Actions job since Molecule no longer runs linters natively.
- Replace `molecule[docker]` with `molecule` and `molecule-plugins[docker]`.
- Add pre-releases to Release Drafter.

## 0.9.0 (January 29, 2023)

FEATURES:
Expand Down
3 changes: 0 additions & 3 deletions molecule/advanced/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ dependency:
role-file: molecule/advanced/requirements.yml
driver:
name: docker
lint: |
set -e
ansible-lint --force-color
platforms:
- name: test-workload
image: nginxdemos/hello
Expand Down
5 changes: 2 additions & 3 deletions molecule/common/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
ansible.builtin.wait_for_connection:
delay: 1
timeout: 2
register: connection
ignore_errors: true
register: container

- name: Containers are not up, quit from here
ansible.builtin.fail:
when: connection.failed
when: container['failed'] | bool

- name: Gather facts
ansible.builtin.setup:
Expand Down
3 changes: 0 additions & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
driver:
name: docker
lint: |
set -e
ansible-lint --force-color
platforms:
- name: amazonlinux-2
image: amazonlinux:2
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@

- name: Ensure /etc/app_protect/conf/test-security-profile.json exists
ansible.builtin.assert:
that: log_profile.stat.exists | bool
that: log_profile['stat']['exists'] | bool
3 changes: 0 additions & 3 deletions molecule/dos/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
driver:
name: docker
lint: |
set -e
ansible-lint --force-color
platforms:
- name: alpine-3.15
image: alpine:3.15
Expand Down
3 changes: 0 additions & 3 deletions molecule/specific-version/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
driver:
name: docker
lint: |
set -e
ansible-lint --force-color
platforms:
- name: amazonlinux-2
image: amazonlinux:2
Expand Down
3 changes: 0 additions & 3 deletions molecule/uninstall/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
driver:
name: docker
lint: |
set -e
ansible-lint --force-color
platforms: # Ubuntu bionic results in a segmentation fault error as of Ansible core 2.13
- name: centos-7
image: centos:7
Expand Down
8 changes: 8 additions & 0 deletions tasks/common/install/setup-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
- name: (Debian/Red Hat OSs) Install cryptography package
ansible.builtin.package:
name: "{{ (ansible_python['version']['major'] == 3) | ternary('python3-cryptography', 'python2-cryptography') }}"
when: not (ansible_facts['distribution'] == "OracleLinux" and ansible_facts['distribution_major_version'] == "8")

- name: (OracleLinux 8) Install cryptography package
ansible.builtin.package:
name: "python3.11-cryptography"
when:
- ansible_facts['distribution'] == "OracleLinux"
- ansible_facts['distribution_major_version'] == "8"

- name: (Debian/Red Hat OSs) Check that NGINX App Protect WAF/DoS certificate is valid
community.crypto.x509_certificate_info:
Expand Down

0 comments on commit f26729c

Please sign in to comment.