-
Notifications
You must be signed in to change notification settings - Fork 16
Adds basic workflow for pdk based modules #15
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
base: v1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: PDK basic | ||
|
|
||
| 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: | ||
| validate: | ||
logicminds marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
| container: ${{ inputs.container_image }} | ||
| outputs: | ||
| puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} | ||
| github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: action-pdk-validate-puppet-7 | ||
| run: pdk validate --puppet-version=7 | ||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd make version 7 an input with a default as well. That allows users to trivially override it. Also means switching 7 to 8 is just a one line change instead of two. |
||
| - run: gem install puppet_metadata --no-document | ||
| - name: Setup Test Matrix | ||
| id: get-outputs | ||
| run: metadata2gha --use-fqdn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The FQDN part is only relevant for Beaker. Doesn't hurt, but it doesn't add anything either. I wonder if I should push it into beaker-hostgenerator itself, perhaps even make it the default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for the default |
||
|
|
||
|
|
||
| unit-puppet: | ||
| needs: | ||
| - validate | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: ${{fromJson(needs.validate.outputs.puppet_unit_test_matrix)}} | ||
| container: ${{ inputs.container_image }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: action-pdk-test-unit-puppet-${{ matrix.puppet }} | ||
| run: pdk test unit --puppet-version=${{ matrix.puppet }} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -214,3 +214,31 @@ jobs: | |||||||||||||||
| uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 | ||||||||||||||||
| working-directory: ./site/profiles | ||||||||||||||||
| ``` | ||||||||||||||||
|
|
||||||||||||||||
| ## Cloning private repos | ||||||||||||||||
| If your CI pipline will clone private repos via the .fixtures.yml or Puppetfile | ||||||||||||||||
| you will need to supply a ssh private key for the runner to use during the job. | ||||||||||||||||
|
|
||||||||||||||||
| That ssh private key can be a machine user's ssh key, or github deploy key. As long | ||||||||||||||||
| as the key has access to the repos it will need to clone. | ||||||||||||||||
|
|
||||||||||||||||
| You will need to create a github secret for the private key named `PRIVATE_SSH_KEY` | ||||||||||||||||
|
|
||||||||||||||||
| An example CI workflow is below for this kind of setup. | ||||||||||||||||
|
|
||||||||||||||||
| For reference: https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| ```yaml | ||||||||||||||||
| name: CI | ||||||||||||||||
|
|
||||||||||||||||
| on: pull_request | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| puppet: | ||||||||||||||||
| - name: Setup deploy key | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it should be a secret that the workflow accepts. Here is where we have an example for the release workflow: gha-puppet/.github/workflows/release.yml Lines 17 to 23 in 238b8d0
(see https://github.com/voxpupuli/gha-puppet#calling-the-release-workflow for how to call it): Then you can add it as a |
||||||||||||||||
| run: eval `ssh-agent -s` && ssh-add - <<< '${{ secrets.PRIVATE_SSH_KEY }}' | ||||||||||||||||
| - name: Puppet | ||||||||||||||||
| uses: voxpupuli/gha-puppet/.github/workflows/pdk-basic.yml@master | ||||||||||||||||
|
Comment on lines
+240
to
+242
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're missing indenting
Suggested change
|
||||||||||||||||
|
|
||||||||||||||||
| ``` | ||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.