From 3351ca9260118c439991cf4f0559c815fdceeff8 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 6 Jul 2025 12:18:13 +1000 Subject: [PATCH 1/3] feat: add ci build task - a ci workflow for build tests - run pre-commit against all files --- .gitea/workflows/build.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..0ea6ace --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,19 @@ +name: Build + +on: + pull_request: + +jobs: + precommit: + runs-on: almalinux-8 + container: + image: git.query.consul/unkin/almalinux9-runnerdnd:latest + options: --privileged + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Pre-Commit All Files + run: | + uvx pre-commit run --all-files -- 2.47.3 From 46beea21d259dc577a61fd8847d1a9c4b9db40d9 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 7 Jul 2025 20:28:24 +1000 Subject: [PATCH 2/3] chore: update docker url - update docker url to use git.unkin.net - add steps to prepare container --- .gitea/workflows/build.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 0ea6ace..4a2586a 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -7,13 +7,18 @@ jobs: precommit: runs-on: almalinux-8 container: - image: git.query.consul/unkin/almalinux9-runnerdnd:latest + image: git.unkin.net/unkin/almalinux9-actionsdind:latest options: --privileged steps: - name: Checkout code uses: actions/checkout@v3 + - name: Install requirements + run: | + dnf groupinstall -y "Development Tools" -y + dnf install rubygems ruby-devel gcc make redhat-rpm-config glibc-headers glibc-devel -y + - name: Pre-Commit All Files run: | uvx pre-commit run --all-files -- 2.47.3 From 8745c6bcb877d0f4aa1e5cda334c458dcc8fb7c1 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Tue, 8 Jul 2025 19:53:53 +1000 Subject: [PATCH 3/3] fix: resolve warnings/errors - modules/libs/lib/facter/pve_nodelist.rb:11:5: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/BlockNesting.a - site/profiles/manifests/puppet/puppetboard.pp - WARNING: there should be a single space before '=>' on line 158, column 14 on line 158 (check: space_before_arrow) - site/profiles/manifests/consul/client.pp - WARNING: there should be a single space before '=>' on line 93, column 13 on line 93 (check: space_before_arrow) - site/profiles/manifests/ntp/client.pp - WARNING: there should be a single space before '=>' on line 44, column 16 on line 44 (check: space_before_arrow) - site/profiles/manifests/puppet/enc.pp - WARNING: there should be a single space before '=>' on line 14, column 11 on line 14 (check: space_before_arrow) - site/profiles/manifests/puppet/enc.pp - WARNING: there should be a single space before '=>' on line 18, column 11 on line 18 (check: space_before_arrow) - set max block nesting to 4 --- .rubocop.yml | 3 +++ modules/libs/lib/facter/pve_nodelist.rb | 3 --- site/profiles/manifests/consul/client.pp | 2 +- site/profiles/manifests/ntp/client.pp | 2 +- site/profiles/manifests/puppet/enc.pp | 8 ++++---- site/profiles/manifests/puppet/puppetboard.pp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ac0c163..30b5dab 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,3 +8,6 @@ Style/Documentation: Layout/LineLength: Max: 140 + +Metrics/BlockNesting: + Max: 4 diff --git a/modules/libs/lib/facter/pve_nodelist.rb b/modules/libs/lib/facter/pve_nodelist.rb index 4e16d81..2ff8fa3 100644 --- a/modules/libs/lib/facter/pve_nodelist.rb +++ b/modules/libs/lib/facter/pve_nodelist.rb @@ -8,7 +8,6 @@ Facter.add('pve_nodelist') do conf_file = '/etc/pve/corosync.conf' node_list = {} current_node = nil - # rubocop:disable Metrics/BlockNesting if File.exist?(conf_file) File.foreach(conf_file) do |line| @@ -28,8 +27,6 @@ Facter.add('pve_nodelist') do end end - # rubocop:enable Metrics/BlockNesting - node_list.empty? ? nil : node_list end end diff --git a/site/profiles/manifests/consul/client.pp b/site/profiles/manifests/consul/client.pp index 2fc80ec..8d8d6ee 100644 --- a/site/profiles/manifests/consul/client.pp +++ b/site/profiles/manifests/consul/client.pp @@ -90,7 +90,7 @@ class profiles::consul::client ( # cleanup /usr/local/bin/consul which was created by url install method if $facts['os']['family'] == 'RedHat' { file {'/usr/local/bin/consul': - ensure => absent, + ensure => absent, } } } diff --git a/site/profiles/manifests/ntp/client.pp b/site/profiles/manifests/ntp/client.pp index c09cff2..516ad20 100644 --- a/site/profiles/manifests/ntp/client.pp +++ b/site/profiles/manifests/ntp/client.pp @@ -41,7 +41,7 @@ class profiles::ntp::client ( } } else { class { 'chrony': - servers => sort($ntpserver_array), + servers => sort($ntpserver_array), } } } diff --git a/site/profiles/manifests/puppet/enc.pp b/site/profiles/manifests/puppet/enc.pp index 4b986fa..b0c7d59 100644 --- a/site/profiles/manifests/puppet/enc.pp +++ b/site/profiles/manifests/puppet/enc.pp @@ -1,8 +1,8 @@ # Class: profiles::puppet::enc # -# This class manages a Git repository at /opt/puppetlabs/enc. It includes a +# This class manages a Git repository at /opt/puppetlabs/enc. It includes a # systemd service and timer to keep the repository updated every minute. -# The Git package is installed if not present, and the repository at the given +# The Git package is installed if not present, and the repository at the given # location will always reflect the state of the remote Git repository. class profiles::puppet::enc ( String $repo, @@ -11,11 +11,11 @@ class profiles::puppet::enc ( ) { file { '/opt/puppetlabs/bin/enc': - ensure => absent, + ensure => absent, } file { '/opt/puppetlabs/bin/puppet-enc': - ensure => absent, + ensure => absent, } $_timer = @(EOT) diff --git a/site/profiles/manifests/puppet/puppetboard.pp b/site/profiles/manifests/puppet/puppetboard.pp index 121f39b..197ba72 100644 --- a/site/profiles/manifests/puppet/puppetboard.pp +++ b/site/profiles/manifests/puppet/puppetboard.pp @@ -155,7 +155,7 @@ class profiles::puppet::puppetboard ( # call the nginx selinux class class { 'profiles::selinux::nginx': - require => Class['Nginx'], + require => Class['Nginx'], } } } -- 2.47.3