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

⚠️ CONFLICT! Lineage pull request for: skeleton #40

Merged
merged 42 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
771490a
Update the bandit configuration in pre-commit
mcdonnnj Apr 20, 2024
33947a6
Change the license so that it is an SPDX string
jsf9k Apr 22, 2024
07e2b60
Pin ansible-core when running the ansible-lint linter
jsf9k May 4, 2024
c74e5db
Remove unnecessary line
jsf9k May 4, 2024
2e53e0d
Explain why ansible may need to be added as a dependency for ansible-…
jsf9k May 7, 2024
c000a6d
Add `community.docker` as a requirement for molecule testing
mcdonnnj May 29, 2024
82e9264
Merge pull request #196 from cisagov/bug/specify_collection_version_r…
mcdonnnj Jun 1, 2024
670748b
Modify the ansible-core pin to ensure a good version is used
jsf9k May 21, 2024
db61055
Update ansible pin
jsf9k May 31, 2024
fc7b883
Restore externally managed Python environment indicator
mcdonnnj Apr 26, 2024
4958184
Determine Python version on host dynamically
mcdonnnj May 1, 2024
4e1659e
Streamline logic checking for applicable host platforms
mcdonnnj May 1, 2024
b967e9d
Fix typo in comment
mcdonnnj May 21, 2024
b25f1fc
Improve explanatory comment
mcdonnnj May 21, 2024
706151e
Add support for Ubuntu 24.04 (Noble Numbat)
mcdonnnj Apr 26, 2024
e7d3969
Add support for Fedora 40
jsf9k Apr 26, 2024
5c97685
Merge pull request #193 from cisagov/improvement/remove-ansible-core-pin
mcdonnnj Jun 1, 2024
14e069b
Merge pull request #190 from cisagov/improvement/restore_externally_m…
mcdonnnj Jun 1, 2024
ec431ef
Merge pull request #189 from cisagov/improvement/add_support_for_ubun…
mcdonnnj Jun 1, 2024
59d8cd6
Merge pull request #188 from cisagov/improvement/add-support-for-fedo…
mcdonnnj Jun 1, 2024
5689f30
Merge pull request #187 from cisagov/improvement/make-license-entry-spdx
mcdonnnj Jun 1, 2024
81839d9
Merge pull request #185 from cisagov/bug/update_pre-commit_configurat…
mcdonnnj Jun 1, 2024
581a55c
Add GH actions to setup QEMU and buildx
jsf9k Apr 22, 2024
5759b77
Add Molecule testing support for aarch where possible
jsf9k Apr 22, 2024
234ac03
Alphabetize platforms
jsf9k Apr 22, 2024
77f62e3
Add support for the aarch64 platform for Fedora 39, Fedora 40, and AL…
jsf9k Apr 27, 2024
6158bae
Prefer the name arm64 to aarch64
jsf9k May 31, 2024
357a701
Assign a name to the test job in the build GHA workflow
jsf9k May 31, 2024
4d2653d
Update the `update_molecule_images.sh` helper script
mcdonnnj May 31, 2024
ba48f71
Add new dependabot ignore directives
mcdonnnj Jun 2, 2024
9e3015c
Merge pull request #174 from cisagov/improvement/add-aarch64-platforms
mcdonnnj Jun 2, 2024
f51fe62
Update pre-commit hook versions
mcdonnnj May 11, 2024
8e55b8e
Manually update the prettier hook
mcdonnnj Jun 6, 2024
c617bb9
Correct commented-out ansible pin
jsf9k Jun 6, 2024
de92c3c
Merge pull request #183 from cisagov/maintenance/update_pre-commit_hooks
mcdonnnj Jun 6, 2024
7ddea47
Merge pull request #182 from cisagov/improvement/pin-packages-for-ans…
mcdonnnj Jun 6, 2024
92a2ef7
Merge https://github.com/cisagov/skeleton-generic into lineage/skeleton
Jun 6, 2024
bcdf7a8
Merge pull request #198 from cisagov/lineage/skeleton
mcdonnnj Jun 7, 2024
9252218
Merge remote-tracking branch 'skeleton-ansible-role/develop' into lin…
jsf9k Jun 11, 2024
7dd4f9f
Uncomment new Dependabot ignore directives from upstream
jsf9k Jun 11, 2024
17182f5
Remove Debian 13 (Trixie) from build workflow
jsf9k Jun 11, 2024
f8f0fdf
Account for the possibility of a non-zero return code
jsf9k Jun 11, 2024
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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ updates:
- dependency-name: mxschmitt/action-tmate
- dependency-name: step-security/harden-runner
# Managed by cisagov/skeleton-ansible-role
- dependency-name: docker/setup-buildx-action
- dependency-name: docker/setup-qemu-action
- dependency-name: github/codeql-action
package-ecosystem: github-actions
schedule:
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,33 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: env.RUN_TMATE
test:
name: >-
test (${{ matrix.scenario }}) -
${{ matrix.platform }}-${{ matrix.architecture }}
needs:
- diagnostics
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
architecture:
- amd64
- arm64
platform:
- amazonlinux2023-systemd
- debian10-systemd
- debian11-systemd
- debian12-systemd
# Docker does not yet officially support Debian Trixie. See
# https://docs.docker.com/engine/install/debian/ for more
# details.
# - debian13-systemd
- fedora39-systemd
- fedora40-systemd
- kali-systemd
- ubuntu-20-systemd
- ubuntu-22-systemd
- ubuntu-24-systemd
scenario:
- default
steps:
Expand Down Expand Up @@ -204,8 +225,15 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install --upgrade --requirement requirements-test.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run molecule tests
run: molecule test --scenario-name ${{ matrix.scenario }}
run: >-
molecule test
--platform-name ${{ matrix.platform }}-${{ matrix.architecture }}
--scenario-name ${{ matrix.scenario }}
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: env.RUN_TMATE
51 changes: 35 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand All @@ -31,7 +31,7 @@ repos:

# Text file hooks
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.41.0
hooks:
- id: markdownlint
args:
Expand All @@ -46,7 +46,7 @@ repos:
# mirror does not pull tags for old major versions once a new major
# version tag is published.
additional_dependencies:
- prettier@3.2.5
- prettier@3.3.1
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand All @@ -56,14 +56,14 @@ repos:

# GitHub Actions hooks
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
rev: 0.28.4
hooks:
- id: check-github-actions
- id: check-github-workflows

# pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit
rev: v3.6.2
rev: v3.7.1
hooks:
- id: validate_manifest

Expand Down Expand Up @@ -98,7 +98,7 @@ repos:

# Shell script hooks
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-4
rev: v3.8.0-1
hooks:
- id: shfmt
args:
Expand All @@ -116,21 +116,22 @@ repos:
# Redirect operators are followed by a space
- --space-redirects
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
rev: v0.10.0.1
hooks:
- id: shellcheck

# Python hooks
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
rev: 1.7.8
hooks:
- id: bandit
# Bandit complains about the use of assert() in tests
exclude: molecule/(default|systemd_enabled)/tests
# Bandit complains about the use of assert() in tests. This should cover
# the tests/ subdirectory for any molecule scenario.
exclude: molecule/[^/]+/tests
args:
- --config=.bandit.yml
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -144,24 +145,42 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v3.15.2
hooks:
- id: pyupgrade

# Ansible hooks
- repo: https://github.com/ansible/ansible-lint
rev: v24.2.0
rev: v24.6.0
hooks:
- id: ansible-lint
# files: molecule/default/playbook.yml
additional_dependencies:
# On its own ansible-lint does not pull in ansible, only
# ansible-core. Therefore, if an Ansible module lives in
# ansible instead of ansible-core, the linter will complain
# that the module is unknown. In these cases it is
# necessary to add the ansible package itself as an
# additional dependency, with the same pinning as is done in
# requirements-test.txt of cisagov/skeleton-ansible-role.
# - ansible>=9,<10
# ansible-core 2.16.3 through 2.16.6 suffer from the bug
# discussed in ansible/ansible#82702, which breaks any
# symlinked files in vars, tasks, etc. for any Ansible role
# installed via ansible-galaxy. Hence we never want to
# install those versions.
#
# Note that any changes made to this dependency must also be
# made in requirements.txt in cisagov/skeleton-packer and
# requirements-test.txt in cisagov/skeleton-ansible-role.
- ansible-core>=2.16.7

# Terraform hooks
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.0
rev: v1.90.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
5 changes: 3 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ galaxy_info:
galaxy_tags:
- cyhy
- mailer
license: CC0
license: CC0-1.0
# With the release of version 2.10, Ansible finally correctly
# identifies Kali Linux as being the Kali distribution of the Debian
# OS family. This simplifies a lot of things for roles that support
Expand All @@ -37,14 +37,15 @@ galaxy_info:
# - trixie
- name: Fedora
versions:
- "38"
- "39"
- "40"
- name: Kali
versions:
- "2023"
- name: Ubuntu
versions:
- focal
- jammy
- noble
role_name: cyhy_mailer
standalone: true
49 changes: 49 additions & 0 deletions molecule/default/externally-managed-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# This is in place to restore a destructive action in geerlingguy's Ansible
# Docker images that we use for testing. The change is fine for the intended
# purpose of the images but not for how we use them.
- name: Ensure Python is marked as externally managed if appropriate
hosts: all
become: true
become_method: ansible.builtin.sudo
tasks:
- name: Ensure Python is marked as externally managed
when:
- ansible_distribution in ["Debian", "Ubuntu"]
- ansible_distribution_release not in ["bullseye", "buster", "focal", "jammy"]
block:
- name: Gather package facts
ansible.builtin.package_facts:
manager: auto

- name: Ensure the EXTERNALLY-MANAGED file is present if Python 3 is installed
when: '"python3" in ansible_facts.packages'
block:
# This gets a unique list of installed Python packages in the form of major.minor
# by taking the list of installed Python packages and:
# 1. Extracting the version from each package's information
# 2. Removing any version information after the major.minor version
# 3. Ensuring there are no duplicates
#
# NOTE:
# Since the value of python_versions is a multiline string, the regex expressions used in
# the regex_replace filter must use single backslashes for special sequences. If the value
# of python_versions were to be changed from a multiline string, the special sequences
# must be modified to use double backslashes instead. This is due to how the YAML is
# processed when Ansible reads the playbook.
- name: Extract version information about installed Python packages
ansible.builtin.set_fact:
python_versions: >-
{{
ansible_facts.packages["python3"]
| map(attribute="version")
| map("regex_replace", "^(\d+\.\d+)\.\d+.*$", "\1")
| unique
}}

- name: Restore EXTERNALLY-MANAGED file for Python
ansible.builtin.template:
dest: /usr/lib/python{{ item }}/EXTERNALLY-MANAGED
mode: 0644
src: EXTERNALLY-MANAGED.j2
loop: "{{ python_versions }}"
Loading
Loading