From 4cb3213cf899393b52bd87074f05b6e836976f5c Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Wed, 3 May 2023 10:09:14 -0400 Subject: [PATCH 01/33] Remove the `lint` command from the Molecule configurations The `lint` command was removed in Molecule v5 so we should remove our uses. --- molecule/default/molecule-no-systemd.yml | 5 ----- molecule/default/molecule-with-systemd.yml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/molecule/default/molecule-no-systemd.yml b/molecule/default/molecule-no-systemd.yml index 3dd21dc..ef32c05 100644 --- a/molecule/default/molecule-no-systemd.yml +++ b/molecule/default/molecule-no-systemd.yml @@ -10,11 +10,6 @@ dependency: name: galaxy driver: name: docker -lint: | - set -e - yamllint . - ansible-lint - flake8 platforms: - image: amazonlinux:2023 name: amazonlinux2023 diff --git a/molecule/default/molecule-with-systemd.yml b/molecule/default/molecule-with-systemd.yml index d66ea7c..a0271e6 100644 --- a/molecule/default/molecule-with-systemd.yml +++ b/molecule/default/molecule-with-systemd.yml @@ -9,11 +9,6 @@ dependency: name: galaxy driver: name: docker -lint: | - set -e - yamllint . - ansible-lint - flake8 platforms: - cgroupns_mode: host command: /lib/systemd/systemd From a0bc20bb08292f0d532f52378b8af4f585c94427 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 14:00:52 -0400 Subject: [PATCH 02/33] Add Go hooks to support go code for our projects --- .pre-commit-config.yaml | 56 +++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0dabeb6..65c676b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,17 +31,17 @@ repos: # Text file hooks - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.34.0 hooks: - id: markdownlint args: - --config=.mdl_config.yaml - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier - repo: https://github.com/adrienverge/yamllint - rev: v1.30.0 + rev: v1.31.0 hooks: - id: yamllint args: @@ -49,17 +49,51 @@ repos: # GitHub Actions hooks - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.22.0 + rev: 0.23.0 hooks: - id: check-github-actions - id: check-github-workflows # pre-commit hooks - repo: https://github.com/pre-commit/pre-commit - rev: v3.2.1 + rev: v3.3.1 hooks: - id: validate_manifest + # Go hooks + - repo: https://github.com/TekWizely/pre-commit-golang + rev: v1.0.0-rc.1 + hooks: + # Style Checkers + - id: go-lint + - id: go-critic + # Go Build + - id: go-build-mod + - id: go-build-pkg + - id: go-build-repo-mod + - id: go-build-repo-pkg + + # Go Mod Tidy + - id: go-mod-tidy + - id: go-mod-tidy-repo + + # Go Test + - id: go-test-mod + - id: go-test-pkg + - id: go-test-repo-mod + - id: go-test-repo-pkg + + # Go Vet + - id: go-vet + - id: go-vet-mod + - id: go-vet-pkg + - id: go-vet-repo-mod + - id: go-vet-repo-pkg + # GoSec + - id: go-sec-mod + - id: go-sec-pkg + - id: go-sec-repo-mod + - id: go-sec-repo-pkg # Shell script hooks - repo: https://github.com/cisagov/pre-commit-shfmt rev: v0.0.2 @@ -88,7 +122,7 @@ repos: args: - --config=.bandit.yml - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -102,31 +136,31 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.2.0 hooks: - id: mypy - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.3.2 hooks: - id: pyupgrade # Ansible hooks - repo: https://github.com/ansible-community/ansible-lint - rev: v5.4.0 + rev: v6.15.0 hooks: - id: ansible-lint # files: molecule/default/playbook.yml # Terraform hooks - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.77.1 + rev: v1.78.0 hooks: - id: terraform_fmt - id: terraform_validate # Docker hooks - repo: https://github.com/IamTheFij/docker-pre-commit - rev: v2.1.1 + rev: v3.0.1 hooks: - id: docker-compose-check From 3628e5fa20d334723ca4733a873110b52b07b406 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 14:08:25 -0400 Subject: [PATCH 03/33] Add Staticcheck --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65c676b..b04a130 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,6 +67,11 @@ repos: # Style Checkers - id: go-lint - id: go-critic + # StaticCheck + - id: go-staticcheck-mod + - id: go-staticcheck-pkg + - id: go-staticcheck-repo-mod + - id: go-staticcheck-repo-pkg # Go Build - id: go-build-mod - id: go-build-pkg From 668724f0a5fc2742a5fd9ce7de16753664876d02 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:07:08 -0400 Subject: [PATCH 04/33] Fix indentation Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b04a130..10d005e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -64,7 +64,7 @@ repos: - repo: https://github.com/TekWizely/pre-commit-golang rev: v1.0.0-rc.1 hooks: - # Style Checkers + # Style Checkers - id: go-lint - id: go-critic # StaticCheck From 3d422b8493f09867ce17b2254ba25678a9759d03 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:07:17 -0400 Subject: [PATCH 05/33] Fix indentation Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 10d005e..20e57fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,7 @@ repos: # Style Checkers - id: go-lint - id: go-critic - # StaticCheck + # StaticCheck - id: go-staticcheck-mod - id: go-staticcheck-pkg - id: go-staticcheck-repo-mod From 5571f4756c1499d29da617b6f53afe8bfaebcf8d Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:07:25 -0400 Subject: [PATCH 06/33] Fix indentation Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20e57fa..9d698a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,7 +72,7 @@ repos: - id: go-staticcheck-pkg - id: go-staticcheck-repo-mod - id: go-staticcheck-repo-pkg - # Go Build + # Go Build - id: go-build-mod - id: go-build-pkg - id: go-build-repo-mod From 4fd9501f753e1789261307b9e3829dd19dd3d42f Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:07:44 -0400 Subject: [PATCH 07/33] Fix formatting Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d698a8..4946d17 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -77,7 +77,6 @@ repos: - id: go-build-pkg - id: go-build-repo-mod - id: go-build-repo-pkg - # Go Mod Tidy - id: go-mod-tidy - id: go-mod-tidy-repo From 412101aff6363f06a9155fa21679637d5d5ca7dd Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:08:16 -0400 Subject: [PATCH 08/33] Fix formatting Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4946d17..837d28b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -86,7 +86,6 @@ repos: - id: go-test-pkg - id: go-test-repo-mod - id: go-test-repo-pkg - # Go Vet - id: go-vet - id: go-vet-mod From a346fb5a789040104624eb0b193460463a8d811a Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:10:19 -0400 Subject: [PATCH 09/33] Fix formatting Co-authored-by: Shane Frasier --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 837d28b..9ac7fd1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -80,7 +80,6 @@ repos: # Go Mod Tidy - id: go-mod-tidy - id: go-mod-tidy-repo - # Go Test - id: go-test-mod - id: go-test-pkg From c47038b51d4b537b9bd64b0299c1b99ca0b6e455 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:19:50 -0400 Subject: [PATCH 10/33] Revert updated versions for existing hooks --- .pre-commit-config.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ac7fd1..d14f75a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,17 +31,17 @@ repos: # Text file hooks - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.34.0 + rev: v0.33.0 hooks: - id: markdownlint args: - --config=.mdl_config.yaml - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v3.0.0-alpha.6 hooks: - id: prettier - repo: https://github.com/adrienverge/yamllint - rev: v1.31.0 + rev: v1.30.0 hooks: - id: yamllint args: @@ -49,14 +49,14 @@ repos: # GitHub Actions hooks - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.23.0 + rev: 0.22.0 hooks: - id: check-github-actions - id: check-github-workflows # pre-commit hooks - repo: https://github.com/pre-commit/pre-commit - rev: v3.3.1 + rev: v3.2.1 hooks: - id: validate_manifest @@ -96,6 +96,7 @@ repos: - id: go-sec-pkg - id: go-sec-repo-mod - id: go-sec-repo-pkg + # Shell script hooks - repo: https://github.com/cisagov/pre-commit-shfmt rev: v0.0.2 @@ -124,7 +125,7 @@ repos: args: - --config=.bandit.yml - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -138,31 +139,31 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.2.0 + rev: v1.1.1 hooks: - id: mypy - repo: https://github.com/asottile/pyupgrade - rev: v3.3.2 + rev: v3.3.1 hooks: - id: pyupgrade # Ansible hooks - repo: https://github.com/ansible-community/ansible-lint - rev: v6.15.0 + rev: v5.4.0 hooks: - id: ansible-lint # files: molecule/default/playbook.yml # Terraform hooks - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.78.0 + rev: v1.77.1 hooks: - id: terraform_fmt - id: terraform_validate # Docker hooks - repo: https://github.com/IamTheFij/docker-pre-commit - rev: v3.0.1 + rev: v2.1.1 hooks: - id: docker-compose-check @@ -171,4 +172,4 @@ repos: rev: v0.0.2 hooks: - id: packer_validate - - id: packer_fmt + - id: packer_fmt \ No newline at end of file From eb52678f773e6f05857b6880b34b9f8afdb71dc5 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 16:30:11 -0400 Subject: [PATCH 11/33] Fix formatting --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d14f75a..6e8143b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -172,4 +172,4 @@ repos: rev: v0.0.2 hooks: - id: packer_validate - - id: packer_fmt \ No newline at end of file + - id: packer_fmt From f8179f1aa31be65b2c363fd86badd6bf7883a033 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Fri, 5 May 2023 17:16:19 -0400 Subject: [PATCH 12/33] Remove extra hook ids --- .pre-commit-config.yaml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e8143b..0810309 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -69,33 +69,16 @@ repos: - id: go-critic # StaticCheck - id: go-staticcheck-mod - - id: go-staticcheck-pkg - - id: go-staticcheck-repo-mod - - id: go-staticcheck-repo-pkg # Go Build - id: go-build-mod - - id: go-build-pkg - - id: go-build-repo-mod - - id: go-build-repo-pkg # Go Mod Tidy - id: go-mod-tidy - - id: go-mod-tidy-repo # Go Test - id: go-test-mod - - id: go-test-pkg - - id: go-test-repo-mod - - id: go-test-repo-pkg # Go Vet - id: go-vet - - id: go-vet-mod - - id: go-vet-pkg - - id: go-vet-repo-mod - - id: go-vet-repo-pkg # GoSec - id: go-sec-mod - - id: go-sec-pkg - - id: go-sec-repo-mod - - id: go-sec-repo-pkg # Shell script hooks - repo: https://github.com/cisagov/pre-commit-shfmt From 42820e2e7d1fb492be77faa313de934f1c472cd2 Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Mon, 8 May 2023 09:41:46 -0400 Subject: [PATCH 13/33] Replace hooks with repo based option when available --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0810309..3a798f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,17 +68,17 @@ repos: - id: go-lint - id: go-critic # StaticCheck - - id: go-staticcheck-mod + - id: go-staticcheck-repo-mod # Go Build - - id: go-build-mod + - id: go-build-repo-mod # Go Mod Tidy - - id: go-mod-tidy + - id: go-mod-tidy-repo # Go Test - - id: go-test-mod + - id: go-test-repo-mod # Go Vet - - id: go-vet + - id: go-vet-repo-mod # GoSec - - id: go-sec-mod + - id: go-sec-repo-mod # Shell script hooks - repo: https://github.com/cisagov/pre-commit-shfmt From 32993325e11d482e078e05d27c3269e6401a8f53 Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Tue, 16 May 2023 12:52:05 -0400 Subject: [PATCH 14/33] Update the test requirements Give molecule a version pin since we made changes to support v5 specifically. We can also remove the ansible-lint, flake8, and yamllint requirements since molecule is no longer performing any linting. --- requirements-test.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/requirements-test.txt b/requirements-test.txt index 197b7d2..f2dba15 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,10 +8,11 @@ # We need at least version 6 to correctly identify Amazon Linux 2023 # as using the dnf package manager. ansible>=6,<7 -ansible-lint>=5,<6 -flake8 -molecule +# With the release of molecule v5 there were some breaking changes so +# we need to pin at v5 or newer. However, v5.0.0 had an internal +# dependency issue so we must use the bugfix release as the actual +# lower bound. +molecule>=5.0.1 molecule-plugins[docker] pre-commit pytest-testinfra -yamllint From 7f372e63ac7875b3fb8d25dd094f7b9183e6e42e Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Wed, 7 Jun 2023 11:11:13 -0400 Subject: [PATCH 15/33] Remove the go-lint hook from the pre-commit configuration The golang/lint tool was archived on May 9th, 2021 and based on golang/go#38968 no future work is planned. Coupled with the fact that it is not available from brew we are removing this hook as local development may be hindered by trying to satisfy running this hook. Co-authored-by: Shane Frasier Co-authored-by: dav3r --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3a798f0..4f826b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,7 +65,6 @@ repos: rev: v1.0.0-rc.1 hooks: # Style Checkers - - id: go-lint - id: go-critic # StaticCheck - id: go-staticcheck-repo-mod From b8231113bac671a5d9f026fc519e9d3088eda935 Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Wed, 31 May 2023 12:45:10 -0400 Subject: [PATCH 16/33] Update pre-commit hook versions This is done automatically with the `pre-commit autoupdate` command. --- .pre-commit-config.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0dabeb6..724b3e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,17 +31,17 @@ repos: # Text file hooks - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.34.0 hooks: - id: markdownlint args: - --config=.mdl_config.yaml - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier - repo: https://github.com/adrienverge/yamllint - rev: v1.30.0 + rev: v1.32.0 hooks: - id: yamllint args: @@ -49,14 +49,14 @@ repos: # GitHub Actions hooks - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.22.0 + rev: 0.23.1 hooks: - id: check-github-actions - id: check-github-workflows # pre-commit hooks - repo: https://github.com/pre-commit/pre-commit - rev: v3.2.1 + rev: v3.3.2 hooks: - id: validate_manifest @@ -88,7 +88,7 @@ repos: args: - --config=.bandit.yml - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -102,31 +102,31 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.3.0 hooks: - id: mypy - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade # Ansible hooks - repo: https://github.com/ansible-community/ansible-lint - rev: v5.4.0 + rev: v6.17.0 hooks: - id: ansible-lint # files: molecule/default/playbook.yml # Terraform hooks - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.77.1 + rev: v1.80.0 hooks: - id: terraform_fmt - id: terraform_validate # Docker hooks - repo: https://github.com/IamTheFij/docker-pre-commit - rev: v2.1.1 + rev: v3.0.1 hooks: - id: docker-compose-check From b770fc687a7a954d5e0cc12ae264fcda62a3355a Mon Sep 17 00:00:00 2001 From: Jason Odoom Date: Wed, 31 May 2023 12:29:10 -0400 Subject: [PATCH 17/33] Add apostrophe to Qapla --- setup-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-env b/setup-env index f526cdb..436d163 100755 --- a/setup-env +++ b/setup-env @@ -186,5 +186,5 @@ else: END_OF_LINE )" -# Qapla +# Qapla' echo "Success!" From 24a0008be136a946c2d742542ddb78dceb128073 Mon Sep 17 00:00:00 2001 From: arcsector <26469747+arcsector@users.noreply.github.com> Date: Wed, 17 May 2023 16:01:54 -0700 Subject: [PATCH 18/33] detecting virtualenv installation successfully --- setup-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-env b/setup-env index 436d163..129102f 100755 --- a/setup-env +++ b/setup-env @@ -65,7 +65,7 @@ done eval set -- "$PARAMS" # Check to see if pyenv is installed -if [ -z "$(command -v pyenv)" ] || [ -z "$(command -v pyenv-virtualenv)" ]; then +if [ -z "$(command -v pyenv)" ] || { [ -z "$(command -v pyenv-virtualenv)" ] && [ ! -f "$(pyenv root)/plugins/pyenv-virtualenv/bin/pyenv-virtualenv" ] ; }; then echo "pyenv and pyenv-virtualenv are required." if [[ "$OSTYPE" == "darwin"* ]]; then cat << 'END_OF_LINE' From f01965a1e56c2a6743eec95e9daa724037e7699d Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Fri, 19 May 2023 11:46:28 -0400 Subject: [PATCH 19/33] Whitespace change to make shfmt linter happy --- setup-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-env b/setup-env index 129102f..77926bf 100755 --- a/setup-env +++ b/setup-env @@ -65,7 +65,7 @@ done eval set -- "$PARAMS" # Check to see if pyenv is installed -if [ -z "$(command -v pyenv)" ] || { [ -z "$(command -v pyenv-virtualenv)" ] && [ ! -f "$(pyenv root)/plugins/pyenv-virtualenv/bin/pyenv-virtualenv" ] ; }; then +if [ -z "$(command -v pyenv)" ] || { [ -z "$(command -v pyenv-virtualenv)" ] && [ ! -f "$(pyenv root)/plugins/pyenv-virtualenv/bin/pyenv-virtualenv" ]; }; then echo "pyenv and pyenv-virtualenv are required." if [[ "$OSTYPE" == "darwin"* ]]; then cat << 'END_OF_LINE' From 43d588fe56c9522535bc341a4664569be798c6c4 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Tue, 25 Apr 2023 09:17:14 -0400 Subject: [PATCH 20/33] Fix two broken links Resolves cisagov/skeleton-generic#131. --- .ansible-lint | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 0e80b05..4ffc0ef 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,10 +1,9 @@ --- -# See https://ansible-lint.readthedocs.io/en/latest/configuring.html -# for a list of the configuration elements that can exist in this -# file. +# See https://ansible-lint.readthedocs.io/configuring/ for a list of +# the configuration elements that can exist in this file. enable_list: # Useful checks that one must opt-into. See here for more details: - # https://ansible-lint.readthedocs.io/en/latest/rules.html + # https://ansible-lint.readthedocs.io/rules/ - fcqn-builtins - no-log-password - no-same-owner From e0982552895542bd267696744548aeba18fee2d5 Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Wed, 31 May 2023 13:39:14 -0400 Subject: [PATCH 21/33] Disable caching for the setup-go Action The cache key used relies on the existence of a go.sum file. Since we have no expectation for Go source code, including that file, and since we already include the Go cache in our job caching, we can safely disable caching in the Action. --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdd8c98..4351bd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,9 @@ jobs: - id: setup-go uses: actions/setup-go@v4 with: + # There is no expectation for actual Go code so we disable caching as + # it relies on the existence of a go.sum file. + cache: false go-version: "1.19" - name: Lookup Go cache directory id: go-cache From edf133832040ef12c407b0772c40f18f64076eb8 Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Wed, 31 May 2023 13:41:03 -0400 Subject: [PATCH 22/33] Bump Go from 1.19 to 1.20 Bump the version of Go used in our GitHub Actions configuration to the latest stable Go release. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4351bd2..c992e8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: # There is no expectation for actual Go code so we disable caching as # it relies on the existence of a go.sum file. cache: false - go-version: "1.19" + go-version: "1.20" - name: Lookup Go cache directory id: go-cache run: | From 51b9cc6411388f5742bf2627a160739a72287e9f Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Tue, 16 May 2023 12:43:38 -0400 Subject: [PATCH 23/33] Fix the Amazon Linux 2023 platform entry in the role meta This aligns with the appropriate values found on Ansible Galaxy and is required for this role to pass linting using ansible-lint v6. --- meta/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 371d37b..5a33970 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -15,9 +15,9 @@ galaxy_info: min_ansible_version: "2.10" namespace: cisagov platforms: - - name: Amazon Linux 2023 + - name: Amazon Linux versions: - - any + - "2023" - name: Debian versions: - buster From fdef3101b86fa181387d61c39e4e90efc09b20fe Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Fri, 9 Jun 2023 13:47:32 -0400 Subject: [PATCH 24/33] Use the FQCN for `become_method` plugins Use the fully-qualified collection name when declaring the plugin that will be used with the `become_method` argument. --- molecule/default/upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/upgrade.yml b/molecule/default/upgrade.yml index 1c67c8c..67c299e 100644 --- a/molecule/default/upgrade.yml +++ b/molecule/default/upgrade.yml @@ -2,7 +2,7 @@ - hosts: all name: Upgrade base image become: yes - become_method: sudo + become_method: ansible.builtin.sudo tasks: - name: Upgrade system packages ansible.builtin.include_role: From 1f29ed0c23802c12c5e7aa42a71191fd23b94569 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Mon, 12 Jun 2023 09:58:50 -0400 Subject: [PATCH 25/33] Update author email from Trio to GWE Trio is dead. Long live GWE! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea213ff..3b7bf8b 100644 --- a/README.md +++ b/README.md @@ -71,4 +71,4 @@ with this waiver of copyright interest. ## Author Information ## -First Last - +First Last - From c1f86afadfd9009b8c01917fe04e944e5ddc6ea7 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Mon, 12 Jun 2023 10:07:17 -0400 Subject: [PATCH 26/33] Remove support for Ubuntu Bionic Ubuntu Bionic reached end-of-life in May 31, 2023: https://ubuntu.com/blog/ubuntu-18-04-eol-for-devices --- meta/main.yml | 1 - molecule/default/molecule-no-systemd.yml | 3 --- molecule/default/molecule-with-systemd.yml | 9 --------- 3 files changed, 13 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 371d37b..716b85a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -32,7 +32,6 @@ galaxy_info: - "2023" - name: Ubuntu versions: - - bionic - focal - jammy role_name: skeleton diff --git a/molecule/default/molecule-no-systemd.yml b/molecule/default/molecule-no-systemd.yml index 3dd21dc..b80ca84 100644 --- a/molecule/default/molecule-no-systemd.yml +++ b/molecule/default/molecule-no-systemd.yml @@ -37,9 +37,6 @@ platforms: - image: fedora:37 name: fedora37 platform: amd64 - - image: ubuntu:bionic - name: ubuntu18 - platform: amd64 - image: ubuntu:focal name: ubuntu20 platform: amd64 diff --git a/molecule/default/molecule-with-systemd.yml b/molecule/default/molecule-with-systemd.yml index d66ea7c..5c8713f 100644 --- a/molecule/default/molecule-with-systemd.yml +++ b/molecule/default/molecule-with-systemd.yml @@ -78,15 +78,6 @@ platforms: privileged: yes volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw - - cgroupns_mode: host - command: /lib/systemd/systemd - image: geerlingguy/docker-ubuntu1804-ansible:latest - name: ubuntu-18-systemd - platform: amd64 - pre_build_image: yes - privileged: yes - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:rw - cgroupns_mode: host command: /lib/systemd/systemd image: geerlingguy/docker-ubuntu2004-ansible:latest From ac1f14215ff6d935a1023bada300aa00597314c4 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Tue, 13 Jun 2023 16:16:06 -0400 Subject: [PATCH 27/33] Add a comment explaining why we can't use a long form of a CLI option --- update_molecule_images.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/update_molecule_images.sh b/update_molecule_images.sh index 54ccbca..46013f9 100755 --- a/update_molecule_images.sh +++ b/update_molecule_images.sh @@ -42,4 +42,7 @@ fi check_dependencies +# Note that we can't use --max-args in place of -n in the xargs +# command since the version of xargs distributed with OSX does not +# support it. yq '.platforms[].image' < "$source_file" | xargs -n 1 docker pull From 23bbd1465fdd0b06fd67ed49eb806b1111a7ba29 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Tue, 13 Jun 2023 19:38:45 -0400 Subject: [PATCH 28/33] Use the preferred name for Apple's OS Co-authored-by: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> --- update_molecule_images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_molecule_images.sh b/update_molecule_images.sh index 46013f9..2c8cccc 100755 --- a/update_molecule_images.sh +++ b/update_molecule_images.sh @@ -43,6 +43,6 @@ fi check_dependencies # Note that we can't use --max-args in place of -n in the xargs -# command since the version of xargs distributed with OSX does not +# command since the version of xargs distributed with macOS does not # support it. yq '.platforms[].image' < "$source_file" | xargs -n 1 docker pull From 8a6856d74727cf16f89ecddcf9705a56c24f8f0c Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Thu, 18 May 2023 12:06:31 -0400 Subject: [PATCH 29/33] Remove Fedora 36 and add Fedora 38 - Fedora 36 is EOL as of May 16, 2023 (https://docs.fedoraproject.org/en-US/releases/eol/) - Fedora 38 was released on April 18, 2023 (https://fedoramagazine.org/announcing-fedora-38/) --- meta/main.yml | 2 +- molecule/default/molecule-no-systemd.yml | 6 +++--- molecule/default/molecule-with-systemd.yml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index ac97ad3..3190d65 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -25,8 +25,8 @@ galaxy_info: - bookworm - name: Fedora versions: - - "36" - "37" + - "38" - name: Kali versions: - "2023" diff --git a/molecule/default/molecule-no-systemd.yml b/molecule/default/molecule-no-systemd.yml index 6342659..d7555d4 100644 --- a/molecule/default/molecule-no-systemd.yml +++ b/molecule/default/molecule-no-systemd.yml @@ -26,12 +26,12 @@ platforms: - image: kalilinux/kali-rolling name: kali platform: amd64 - - image: fedora:36 - name: fedora36 - platform: amd64 - image: fedora:37 name: fedora37 platform: amd64 + - image: fedora:38 + name: fedora38 + platform: amd64 - image: ubuntu:focal name: ubuntu20 platform: amd64 diff --git a/molecule/default/molecule-with-systemd.yml b/molecule/default/molecule-with-systemd.yml index bcf5d94..1b9b052 100644 --- a/molecule/default/molecule-with-systemd.yml +++ b/molecule/default/molecule-with-systemd.yml @@ -57,8 +57,8 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:rw - cgroupns_mode: host command: /lib/systemd/systemd - image: geerlingguy/docker-fedora36-ansible:latest - name: fedora36-systemd + image: geerlingguy/docker-fedora37-ansible:latest + name: fedora37-systemd platform: amd64 pre_build_image: yes privileged: yes @@ -66,8 +66,8 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:rw - cgroupns_mode: host command: /lib/systemd/systemd - image: geerlingguy/docker-fedora37-ansible:latest - name: fedora37-systemd + image: geerlingguy/docker-fedora38-ansible:latest + name: fedora38-systemd platform: amd64 pre_build_image: yes privileged: yes From d2522189da60b3aa4d3174dbd2633291226c9474 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Wed, 21 Jun 2023 16:55:26 -0400 Subject: [PATCH 30/33] Add an ansible-galaxy requirements file Also make sure that any roles and collections in the file are installed via the GitHub Actions build workflow. --- .github/workflows/build.yml | 4 ++++ requirements.yml | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 requirements.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c992e8e..438e780 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,6 +94,10 @@ jobs: run: | python -m pip install --upgrade pip setuptools wheel pip install --upgrade --requirement requirements-test.txt + - name: Install Ansible collections and roles + run: | + ansible-galaxy role install --force --role-file requirements.yml + ansible-galaxy collection install --force --requirements-file requirements.yml - name: Set up pre-commit hook environments run: pre-commit install-hooks - name: Run pre-commit on all files diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..ad0afd8 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,4 @@ +--- +collections: + - name: ansible.posix +roles: [] From 9d65a2010eae715ec31bba75607cb2105557ef53 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Wed, 21 Jun 2023 16:57:14 -0400 Subject: [PATCH 31/33] Move a when clause to just before the block to which it applies ansible-lint now requires this. --- create/playbook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create/playbook.yml b/create/playbook.yml index deb6f52..b453ee7 100644 --- a/create/playbook.yml +++ b/create/playbook.yml @@ -23,6 +23,7 @@ key: "{{ ssh_public_key }}" - name: Allow user to use sudo without password + when: allow_sudo | bool block: - name: Ensure sudo-nopw group exists ansible.builtin.group: @@ -41,4 +42,3 @@ ansible.builtin.user: name: "{{ username }}" groups: sudo-nopw - when: allow_sudo|bool From ab3307af8fd7282108dd669b0d5bba4d40779b9a Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Wed, 21 Jun 2023 16:58:42 -0400 Subject: [PATCH 32/33] Add names to the create and destroy playbooks This is now required by ansible-lint. --- create/playbook.yml | 3 ++- delete/playbook.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/create/playbook.yml b/create/playbook.yml index b453ee7..604c301 100644 --- a/create/playbook.yml +++ b/create/playbook.yml @@ -1,7 +1,8 @@ --- # tasks file for create user -- hosts: all +- name: Create user + hosts: all vars: # Default to false; this can be overridden via: # ansible-playbook --extra-vars="allow_sudo=true" diff --git a/delete/playbook.yml b/delete/playbook.yml index 1f4d041..cd07816 100644 --- a/delete/playbook.yml +++ b/delete/playbook.yml @@ -1,7 +1,8 @@ --- # tasks file for delete user -- hosts: all +- name: Delete user + hosts: all tasks: - name: Delete account for user ansible.builtin.user: From 9fb6b65d5083a6d1b54320b57fd568c51e732bce Mon Sep 17 00:00:00 2001 From: Shane Frasier Date: Mon, 26 Jun 2023 12:16:03 -0400 Subject: [PATCH 33/33] Remove extraneous space Co-authored-by: Jeremy Morrow --- create/playbook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create/playbook.yml b/create/playbook.yml index 604c301..77d01f5 100644 --- a/create/playbook.yml +++ b/create/playbook.yml @@ -5,7 +5,7 @@ hosts: all vars: # Default to false; this can be overridden via: - # ansible-playbook --extra-vars="allow_sudo=true" + # ansible-playbook --extra-vars="allow_sudo=true" allow_sudo: false tasks: - name: Create account for user