Skip to content

Commit 00700d3

Browse files
authored
Merge pull request #9 from cisagov/lineage/skeleton
⚠️ CONFLICT! Lineage pull request for: skeleton
2 parents 923f21c + 702d94d commit 00700d3

17 files changed

+628
-82
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ updates:
2020
- dependency-name: mxschmitt/action-tmate
2121
- dependency-name: step-security/harden-runner
2222
# Managed by cisagov/skeleton-ansible-role
23+
- dependency-name: docker/setup-buildx-action
24+
- dependency-name: docker/setup-qemu-action
2325
- dependency-name: github/codeql-action
2426
package-ecosystem: github-actions
2527
schedule:

.github/workflows/build.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,50 @@ jobs:
168168
uses: mxschmitt/action-tmate@v3
169169
if: env.RUN_TMATE
170170
test:
171+
name: >-
172+
test (${{ matrix.scenario }}) -
173+
${{ matrix.platform }}-${{ matrix.architecture }}
171174
needs:
172175
- diagnostics
173176
runs-on: ubuntu-latest
174177
strategy:
175178
fail-fast: false
176179
matrix:
180+
architecture:
181+
- amd64
182+
- arm64
183+
exclude:
184+
# TODO: Starting with systemd version 253 or 254 (I'm not
185+
# sure which) it is no longer possible to start
186+
# systemd-resolved.service under QEMU emulation. We
187+
# support this case, but we cannot test it until we have
188+
# native ARM64 runners.
189+
#
190+
# See issue #10 for more details.
191+
- architecture: arm64
192+
platform: debian13-systemd
193+
- architecture: arm64
194+
platform: fedora39-systemd
195+
- architecture: arm64
196+
platform: fedora40-systemd
197+
- architecture: arm64
198+
platform: kali-systemd
199+
- architecture: arm64
200+
platform: ubuntu-24-systemd
201+
platform:
202+
- amazonlinux2023-systemd
203+
# These platforms do not provide systemd-resolved.
204+
# - debian10-systemd
205+
# - debian11-systemd
206+
- debian12-systemd
207+
- debian13-systemd
208+
- fedora39-systemd
209+
- fedora40-systemd
210+
- kali-systemd
211+
# These platforms do not provide systemd-resolved.
212+
# - ubuntu-20-systemd
213+
# - ubuntu-22-systemd
214+
- ubuntu-24-systemd
177215
scenario:
178216
- default
179217
- disable_stub_resolver
@@ -206,8 +244,15 @@ jobs:
206244
run: |
207245
python -m pip install --upgrade pip
208246
pip install --upgrade --requirement requirements-test.txt
247+
- name: Set up QEMU
248+
uses: docker/setup-qemu-action@v3
249+
- name: Set up Docker Buildx
250+
uses: docker/setup-buildx-action@v3
209251
- name: Run molecule tests
210-
run: molecule test --scenario-name ${{ matrix.scenario }}
252+
run: >-
253+
molecule test
254+
--platform-name ${{ matrix.platform }}-${{ matrix.architecture }}
255+
--scenario-name ${{ matrix.scenario }}
211256
- name: Setup tmate debug session
212257
uses: mxschmitt/action-tmate@v3
213258
if: env.RUN_TMATE

.pre-commit-config.yaml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default_language_version:
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.5.0
8+
rev: v4.6.0
99
hooks:
1010
- id: check-case-conflict
1111
- id: check-executables-have-shebangs
@@ -31,7 +31,7 @@ repos:
3131

3232
# Text file hooks
3333
- repo: https://github.com/igorshubovych/markdownlint-cli
34-
rev: v0.39.0
34+
rev: v0.41.0
3535
hooks:
3636
- id: markdownlint
3737
args:
@@ -46,7 +46,7 @@ repos:
4646
# mirror does not pull tags for old major versions once a new major
4747
# version tag is published.
4848
additional_dependencies:
49-
- prettier@3.2.5
49+
- prettier@3.3.1
5050
- repo: https://github.com/adrienverge/yamllint
5151
rev: v1.35.1
5252
hooks:
@@ -56,14 +56,14 @@ repos:
5656

5757
# GitHub Actions hooks
5858
- repo: https://github.com/python-jsonschema/check-jsonschema
59-
rev: 0.28.0
59+
rev: 0.28.4
6060
hooks:
6161
- id: check-github-actions
6262
- id: check-github-workflows
6363

6464
# pre-commit hooks
6565
- repo: https://github.com/pre-commit/pre-commit
66-
rev: v3.6.2
66+
rev: v3.7.1
6767
hooks:
6868
- id: validate_manifest
6969

@@ -98,7 +98,7 @@ repos:
9898

9999
# Shell script hooks
100100
- repo: https://github.com/scop/pre-commit-shfmt
101-
rev: v3.7.0-4
101+
rev: v3.8.0-1
102102
hooks:
103103
- id: shfmt
104104
args:
@@ -116,21 +116,22 @@ repos:
116116
# Redirect operators are followed by a space
117117
- --space-redirects
118118
- repo: https://github.com/shellcheck-py/shellcheck-py
119-
rev: v0.9.0.6
119+
rev: v0.10.0.1
120120
hooks:
121121
- id: shellcheck
122122

123123
# Python hooks
124124
- repo: https://github.com/PyCQA/bandit
125-
rev: 1.7.7
125+
rev: 1.7.8
126126
hooks:
127127
- id: bandit
128-
# Bandit complains about the use of assert() in tests
129-
exclude: molecule/(default|disable_stub_resolver|specify_resolv_conf_target)/tests
128+
# Bandit complains about the use of assert() in tests. This should cover
129+
# the tests/ subdirectory for any molecule scenario.
130+
exclude: molecule/[^/]+/tests
130131
args:
131132
- --config=.bandit.yml
132133
- repo: https://github.com/psf/black-pre-commit-mirror
133-
rev: 24.2.0
134+
rev: 24.4.2
134135
hooks:
135136
- id: black
136137
- repo: https://github.com/PyCQA/flake8
@@ -144,38 +145,42 @@ repos:
144145
hooks:
145146
- id: isort
146147
- repo: https://github.com/pre-commit/mirrors-mypy
147-
rev: v1.8.0
148+
rev: v1.10.0
148149
hooks:
149150
- id: mypy
150151
- repo: https://github.com/asottile/pyupgrade
151-
rev: v3.15.1
152+
rev: v3.15.2
152153
hooks:
153154
- id: pyupgrade
154155

155156
# Ansible hooks
156157
- repo: https://github.com/ansible/ansible-lint
157-
rev: v24.2.0
158+
rev: v24.6.0
158159
hooks:
159160
- id: ansible-lint
160161
additional_dependencies:
161-
# Per the documentation and the pre-commit hook
162-
# configuration, ansible-lint does not know about modules
163-
# that live outside of ansible-core. See these links for
164-
# more details:
165-
# - https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/rules/syntax_check.md#syntax-checkunknown-module
166-
# - https://github.com/ansible/ansible-lint/blob/ad0157eb38059b02d57458504340209f221e3189/.pre-commit-hooks.yaml#L14-L19
162+
# On its own ansible-lint does not pull in ansible, only
163+
# ansible-core. Therefore, if an Ansible module lives in
164+
# ansible instead of ansible-core, the linter will complain
165+
# that the module is unknown. In these cases it is
166+
# necessary to add the ansible package itself as an
167+
# additional dependency, with the same pinning as is done in
168+
# requirements-test.txt of cisagov/skeleton-ansible-role.
169+
- ansible>=9,<10
170+
# ansible-core 2.16.3 through 2.16.6 suffer from the bug
171+
# discussed in ansible/ansible#82702, which breaks any
172+
# symlinked files in vars, tasks, etc. for any Ansible role
173+
# installed via ansible-galaxy. Hence we never want to
174+
# install those versions.
167175
#
168-
# Since ansible.posix.mount lives inside of the ansible
169-
# package itself, we must include that package here.
170-
#
171-
# Note also that for consistency's sake we pull in the same
172-
# version of ansible that is used in requirements-test.txt.
173-
- ansible>=8,<10
174-
# files: molecule/default/playbook.yml
176+
# Note that any changes made to this dependency must also be
177+
# made in requirements.txt in cisagov/skeleton-packer and
178+
# requirements-test.txt in cisagov/skeleton-ansible-role.
179+
- ansible-core>=2.16.7
175180

176181
# Terraform hooks
177182
- repo: https://github.com/antonbabenko/pre-commit-terraform
178-
rev: v1.88.0
183+
rev: v1.90.0
179184
hooks:
180185
- id: terraform_fmt
181186
- id: terraform_validate

meta/main.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ galaxy_info:
1313
- resolved
1414
- systemd
1515
- systemdresolved
16-
license: CC0
16+
license: CC0-1.0
1717
# With the release of version 2.10, Ansible finally correctly
1818
# identifies Kali Linux as being the Kali distribution of the Debian
1919
# OS family. This simplifies a lot of things for roles that support
@@ -34,15 +34,16 @@ galaxy_info:
3434
- trixie
3535
- name: Fedora
3636
versions:
37-
- "38"
3837
- "39"
38+
- "40"
3939
- name: Kali
4040
versions:
4141
- "2023"
42-
# These platforms do not provide systemd-resolved.
43-
# - name: Ubuntu
44-
# versions:
45-
# - focal
46-
# - jammy
42+
- name: Ubuntu
43+
versions:
44+
# These platforms do not provide systemd-resolved.
45+
# - focal
46+
# - jammy
47+
- noble
4748
role_name: systemd_resolved
4849
standalone: true
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
# This is in place to restore a destructive action in geerlingguy's Ansible
3+
# Docker images that we use for testing. The change is fine for the intended
4+
# purpose of the images but not for how we use them.
5+
- name: Ensure Python is marked as externally managed if appropriate
6+
hosts: all
7+
become: true
8+
become_method: ansible.builtin.sudo
9+
tasks:
10+
- name: Ensure Python is marked as externally managed
11+
when:
12+
- ansible_distribution in ["Debian", "Ubuntu"]
13+
- ansible_distribution_release not in ["bullseye", "buster", "focal", "jammy"]
14+
block:
15+
- name: Gather package facts
16+
ansible.builtin.package_facts:
17+
manager: auto
18+
19+
- name: Ensure the EXTERNALLY-MANAGED file is present if Python 3 is installed
20+
when: '"python3" in ansible_facts.packages'
21+
block:
22+
# This gets a unique list of installed Python packages in the form of major.minor
23+
# by taking the list of installed Python packages and:
24+
# 1. Extracting the version from each package's information
25+
# 2. Removing any version information after the major.minor version
26+
# 3. Ensuring there are no duplicates
27+
#
28+
# NOTE:
29+
# Since the value of python_versions is a multiline string, the regex expressions used in
30+
# the regex_replace filter must use single backslashes for special sequences. If the value
31+
# of python_versions were to be changed from a multiline string, the special sequences
32+
# must be modified to use double backslashes instead. This is due to how the YAML is
33+
# processed when Ansible reads the playbook.
34+
- name: Extract version information about installed Python packages
35+
ansible.builtin.set_fact:
36+
python_versions: >-
37+
{{
38+
ansible_facts.packages["python3"]
39+
| map(attribute="version")
40+
| map("regex_replace", "^(\d+\.\d+)\.\d+.*$", "\1")
41+
| unique
42+
}}
43+
44+
- name: Restore EXTERNALLY-MANAGED file for Python
45+
ansible.builtin.template:
46+
dest: /usr/lib/python{{ item }}/EXTERNALLY-MANAGED
47+
mode: 0644
48+
src: EXTERNALLY-MANAGED.j2
49+
loop: "{{ python_versions }}"

0 commit comments

Comments
 (0)