Skip to content

Commit 5a896ed

Browse files
authored
Merge pull request #98 from voxpupuli/ghostbuster
feat: add ghostbuster
2 parents a6f932f + 5aa4554 commit 5a896ed

File tree

7 files changed

+52
-25
lines changed

7 files changed

+52
-25
lines changed

.github/workflows/build_container.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli-acceptance }}
5151
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli-release }}
5252
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli-test }}
53+
RUBYGEM_PUPPET_GHOSTBUSTER=${{ matrix.rubygem_puppet-ghostbuster }}
5354
build_arch: linux/amd64
5455
docker_username: voxpupulibot
5556
docker_password: ${{ secrets.DOCKERHUB_BOT_PASSWORD }}
@@ -83,6 +84,7 @@ jobs:
8384
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli-acceptance }}
8485
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli-release }}
8586
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli-test }}
87+
RUBYGEM_PUPPET_GHOSTBUSTER=${{ matrix.rubygem_puppet-ghostbuster }}
8688
build_arch: linux/arm64
8789
docker_username: voxpupulibot
8890
docker_password: ${{ secrets.DOCKERHUB_BOT_PASSWORD }}

.github/workflows/ci.yaml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli-acceptance }}
5656
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli-release }}
5757
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli-test }}
58+
RUBYGEM_PUPPET_GHOSTBUSTER=${{ matrix.rubygem_puppet-ghostbuster }}
5859
5960
- name: Clone voxpupuli/puppet-example repository
6061
uses: actions/checkout@v4
@@ -63,18 +64,15 @@ jobs:
6364

6465
- name: Test container
6566
run: |
66-
# get ids from runner user
67-
RUNNER_UID=$(id -u)
68-
RUNNER_GID=$(id -g)
69-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
70-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
71-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
72-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
73-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
74-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
75-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
76-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
77-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies
67+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
68+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
69+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
70+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies
71+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
72+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
73+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
74+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
75+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
7876
7977
build-ARM-container:
8078
name: 'Build ARM CI container'
@@ -108,6 +106,7 @@ jobs:
108106
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli-acceptance }}
109107
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli-release }}
110108
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli-test }}
109+
RUBYGEM_PUPPET_GHOSTBUSTER=${{ matrix.rubygem_puppet-ghostbuster }}
111110
112111
- name: Clone voxpupuli/puppet-example repository
113112
uses: actions/checkout@v4
@@ -116,18 +115,15 @@ jobs:
116115

117116
- name: Test container
118117
run: |
119-
# get ids from runner user
120-
RUNNER_UID=$(id -u)
121-
RUNNER_GID=$(id -g)
122-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
123-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
124-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
125-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
126-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
127-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
128-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
129-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
130-
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies
118+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
119+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
120+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
121+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies
122+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
123+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
124+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
125+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
126+
docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
131127
132128
tests:
133129
needs:

.github/workflows/security_scanning.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli-acceptance }}
5757
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli-release }}
5858
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli-test }}
59+
RUBYGEM_PUPPET_GHOSTBUSTER=${{ matrix.rubygem_puppet-ghostbuster }}
5960
6061
- name: Scan image with Anchore Grype
6162
uses: anchore/scan-action@v6

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ ENV RUBYGEM_ONCEOVER=${RUBYGEM_ONCEOVER:-4.0.0}
4242
ARG RUBYGEM_RSPEC_JUNIT_FORMATTER
4343
ENV RUBYGEM_RSPEC_JUNIT_FORMATTER=${RUBYGEM_RSPEC_JUNIT_FORMATTER:-0.6.0}
4444

45+
ARG RUBYGEM_PUPPET_GHOSTBUSTER
46+
ENV RUBYGEM_PUPPET_GHOSTBUSTER=${RUBYGEM_PUPPET_GHOSTBUSTER:-1.2.1}
47+
4548
COPY voxbox/Gemfile /
4649

4750
RUN apk update \

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,30 @@ If you want to execute curl change the entrypoint to `curl` and pass a query/par
256256
podman run -it --rm -v $PWD:/repo:Z --entrypoint curl ghcr.io/voxpupuli/voxbox:8 --help
257257
```
258258

259+
## puppet-ghostbuster
260+
261+
If you want to execute puppet-ghostbuster change the entrypoint to `ash` and pass the command to the container.
262+
Ghostbuster needs a connection to the puppetdb, so you have to provide the environment variables.
263+
You can find them in the documentation of the [puppet-ghostbuster](https://github.com/voxpupuli/puppet-ghostbuster) repository.
264+
265+
Ghostbuster supports the following checks:
266+
267+
- ghostbuster_classes
268+
- ghostbuster_defines
269+
- ghostbuster_facts
270+
- ghostbuster_files
271+
- ghostbuster_functions
272+
- ghostbuster_hiera_files
273+
- ghostbuster_templates
274+
- ghostbuster_types
275+
276+
They can be combined with `--only-checks` and listed in a comma separated list.
277+
278+
```shell
279+
podman run -it --rm -v $PWD:/repo:Z --entrypoint ash ghcr.io/voxpupuli/voxbox:8
280+
find . -type f -exec puppet-lint --only-checks ghostbuster_classes,ghostbuster_facts {} \+
281+
```
282+
259283
## Example Gitlab CI configuration
260284

261285
see [.gitlab-ci.yml](.gitlab-ci.yml)

build_versions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ include:
1515
rubygem_voxpupuli-acceptance: '3.2.0'
1616
rubygem_voxpupuli-release: '3.1.0'
1717
rubygem_voxpupuli-test: '9.2.0'
18+
rubygem_puppet-ghostbuster: '1.2.1'

voxbox/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ gem 'voxpupuli-test', ENV['RUBYGEM_VOXPUPULI_TEST']
1414
gem 'rubocop-performance', ENV['RUBYGEM_RUBOCOP_PERFORMANCE']
1515
gem 'onceover', ENV['RUBYGEM_ONCEOVER']
1616
gem 'rspec_junit_formatter', ENV['RUBYGEM_RSPEC_JUNIT_FORMATTER']
17-
17+
gem 'puppet-ghostbuster', ENV['RUBYGEM_PUPPET_GHOSTBUSTER']
1818
# CVE fixes
1919
gem 'cgi', '~> 0.4.1' # cgi 0.1.0 has CVEs - remove default and install upstream replacement
2020
gem 'stringio', '~> 3.1' # stringio 0.1.0 has CVEs - remove default and install upstream replacement

0 commit comments

Comments
 (0)