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

Adds a puppetfile workflow that uses ra10ke #16

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
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
46 changes: 46 additions & 0 deletions .github/workflows/puppetfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Puppetfile checks

on:
workflow_call:
inputs:
container_image:
description: Image to use when running tests
default: 'puppet/puppet-dev-tools:2022-04-21-e44b72b'
required: false
type: string
jobs:
r10k_validate:
runs-on: ubuntu-latest
container: ${{ inputs.container_image }}
steps:
- uses: actions/checkout@v2
- name: validate Puppetfile
run: rake -f /Rakefile r10k:validate
r10k_check_dups:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there are reason you're not using multiple steps but a new job for every step? This means starting a new container every time + a new checkout, which is slower. You could even run rake -f /Rakefile r10k:validate r10k:duplicates r10k:syntax r10k:deprecations in a single job.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steps do not run in parallel and some of the rake tasks take some time to complete so it could end up taking longer to combine all of them. Using jobs, runs all the rake tasks in parallel which is faster if the jobs take longer. Additionally, each job can be restarted independently.

Without breaking out the jobs I would expect the overall time to either be the same or longer. Although this really depends on the number of jobs.

It does start a new container and when run on unique runners, pulls the container image for every job (not ideal). Which at least happens in parallel. If a custom runner was supplied this container image would be cached.

runs-on: ubuntu-latest
container: ${{ inputs.container_image }}
steps:
- uses: actions/checkout@v2
- name: Check for puppetfile duplicates
run: rake -f /Rakefile r10k:duplicates
r10k_syntax:
runs-on: ubuntu-latest
container: ${{ inputs.container_image }}
steps:
- uses: actions/checkout@v2
- name: Check for puppetfile syntax correctness
run: rake -f /Rakefile r10k:syntax
r10k_deprecation:
runs-on: ubuntu-latest
container: ${{ inputs.container_image }}
steps:
- uses: actions/checkout@v2
- name: Check for puppetfile module deprecations
run: rake -f /Rakefile r10k:deprecation
r10k_find_outdated:
runs-on: ubuntu-latest
container: ${{ inputs.container_image }}
steps:
- uses: actions/checkout@v2
- name: Check for outdated modules
run: rake -f /Rakefile r10k:dependencies
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,26 @@ jobs:
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
working-directory: ./site/profiles
```

## Puppetfile checks
You can use the puppetfile workflow to check various POI on your puppetfile. To use this workflow do the following

```yaml
# This is a basic workflow to help you get started with Actions

name: Puppetfile checks

# Controls when the workflow will run
on:
push:
workflow_dispatch:

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
puppetfile:
name: puppetfile
uses: voxpupuli/gha-puppet/.github/workflows//puppetfile.yml@master
```