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

Updated pdk version #147

Merged
merged 11 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion .github/workflows/build-test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
severity: 'CRITICAL,HIGH,MEDIUM'
vuln-type: os
timeout: 10m0s
skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb"
skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb,/opt/puppetlabs/pdk/share/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb"
- name: Run tests
run: cd tests; ./run_tests.sh
- name: Tag Docker images
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
severity: 'CRITICAL,HIGH,MEDIUM'
vuln-type: os
timeout: 10m0s
skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb"
skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb,/opt/puppetlabs/pdk/share/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb"
- name: Run tests
working-directory: ${{ github.workspace }}/tests
run: ./run_tests.sh
18 changes: 9 additions & 9 deletions .github/workflows/publish-4x-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
workflow_dispatch:
inputs:
image_tag:
description: Image tag on dockerhub to promote to the puppet-dev-tools 4.x image tag (ie. 2021-06-29-da6666a)
description: Image tag on dockerhub to promote to the puppet-dev-tools pdk3 image tag (ie. 2021-06-29-da6666a)
required: true
image_tag_rootless:
description: Image tag on dockerhub to promote to the puppet-dev-tools 4.x-rootless image tag (ie. 2021-06-29-da6666a-rootless)
description: Image tag on dockerhub to promote to the puppet-dev-tools pdk3-rootless image tag (ie. 2021-06-29-da6666a-rootless)
required: true

jobs:
publish-4x-image:
publish-5x-image:
runs-on: ubuntu-latest
env:
IMAGE_BASE: "${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools"
Expand All @@ -33,16 +33,16 @@ jobs:
vuln-type: os
timeout: 10m0s
skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb"
- name: Publish standard image to 4.x
- name: Publish standard image to pdk3
env:
IMAGE_TAG: ${{ github.event.inputs.image_tag }}
run: |
docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:4.x
docker push ${IMAGE_BASE}:4.x
- name: Publish rootless image to 4.x-rootless
docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:pdk3
docker push ${IMAGE_BASE}:pdk3
- name: Publish rootless image to pdk3-rootless
env:
IMAGE_TAG: ${{ github.event.inputs.image_tag_rootless }}
run: |
docker pull ${IMAGE_BASE}:${IMAGE_TAG}
docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:4.x-rootless
docker push ${IMAGE_BASE}:4.x-rootless
docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:pdk3-rootless
docker push ${IMAGE_BASE}:pdk3-rootless
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# specifying the platform here allows builds to work
# correctly on Apple Silicon machines
FROM --platform=amd64 ruby:2.7.4-slim-buster as base
FROM --platform=amd64 ruby:3.1.0-slim-buster as base

ARG VCS_REF
ARG GH_USER=puppetlabs
Expand All @@ -26,7 +26,7 @@ RUN apt-get install -y apt-utils \
&& wget https://apt.puppet.com/puppet-tools-release-buster.deb \
&& dpkg -i puppet-tools-release-buster.deb \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends pdk=2.7.1.0-1buster \
&& apt-get install -y --no-install-recommends pdk=3.0.1.3-1buster \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/httpclient-2.8.3/sample/ssl/* \
Expand All @@ -41,11 +41,11 @@ RUN ln -s /bin/mkdir /usr/bin/mkdir
#
# Simply running "bundle install" against the module is not enough,
# as PDK has further dependencies to pull in.
COPY pdk_1_18_1_dependencies /test_module
RUN cd test_module \
COPY testmod /testmod
RUN cd testmod \
&& pdk validate \
&& cd .. \
&& rm -rf test_module
&& rm -rf testmod

RUN groupadd --gid 1001 puppetdev \
&& useradd --uid 1001 --gid puppetdev --create-home puppetdev
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
source 'https://rubygems.org'

gem 'puppet', '~> 8.4'
gem 'onceover', '~> 3.22'
gem 'ffi', '~> 1.12', '>= 1.12.2'
gem 'hiera-eyaml', '~> 3.2', '>= 3.2.1'
gem 'json', '~> 2.3'
gem 'nokogiri', '~> 1.10', '>= 1.10.9'
gem 'onceover', '~> 3.20', '>= 3.20.0'
gem 'onceover-codequality', '~> 0.8', '>= 0.8.0'
gem 'onceover-octocatalog-diff', '~> 0.1', '>= 0.1.8'
gem 'onceover-lookup', '~> 0.1', '>= 0.1.1'
Expand All @@ -20,7 +21,6 @@ gem 'puppet-lint-version_comparison-check', '~> 1.0'
gem 'puppet-lint', '~> 2.4'
gem 'puppet-strings', '~> 2.6'
gem 'puppet-syntax', '~> 3.2.0'
gem 'puppet', '~> 7.5'
gem 'puppetlabs_spec_helper', '~> 5.0'
gem 'r10k', '~> 3.8'
gem 'ra10ke', '~> 1.0'
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ You can use this container by running `docker run --rm -v $(pwd):/repo puppet/pu
## Supported Commands

1. PDK - `pdk`
- run `docker run --rm puppet/puppet-dev-tools:4.x pdk --help` to see builtin help
- see the [PDK command reference](https://puppet.com/docs/pdk/1.x/pdk_reference.html) for details
- run `docker run --rm puppet/puppet-dev-tools:puppet8 pdk --help` to see builtin help
- see the [PDK command reference](https://www.puppet.com/docs/pdk/3.x/pdk_reference.html) for details
2. Onceover - `onceover`
- run `docker run --rm puppet/puppet-dev-tools:4.x onceover --help` to see builtin help
- run `docker run --rm puppet/puppet-dev-tools:puppet8 onceover --help` to see builtin help
- see [Onceover's readme](https://github.com/dylanratcliffe/onceover/blob/master/README.md) for details
3. Rake tasks from the installed gems (see below)
- run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:4.x rake -f /Rakefile lint`
- run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:4.x rake -f /Rakefile lint syntax yamllint`
- run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 rake -f /Rakefile lint`
- run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 rake -f /Rakefile lint syntax yamllint`

### A note on Onceover usage

If your control repository contains a Gemfile you will likely want to modify the commands listed above to something like this:

```bash
docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:latest \
docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 \
/bin/bash -c "bundle install && bundle exec onceover run spec --force --trace --parallel"
```

Expand Down
144 changes: 0 additions & 144 deletions pdk_1_18_1_dependencies/.rubocop.yml

This file was deleted.

72 changes: 0 additions & 72 deletions pdk_1_18_1_dependencies/Gemfile

This file was deleted.

6 changes: 6 additions & 0 deletions testmod/.fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file can be used to install module dependencies for unit testing
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
5 changes: 5 additions & 0 deletions testmod/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
28 changes: 28 additions & 0 deletions testmod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/*
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
Loading