Skip to content

Commit b952878

Browse files
authored
Merge pull request puppetlabs#622 from puppetlabs/pdksync_CONT-229-Implement_reusable_workflows
pdksync - CONT-229-Implement reusable workflows
2 parents 3176fcf + 0a8ecc6 commit b952878

File tree

6 files changed

+94
-589
lines changed

6 files changed

+94
-589
lines changed

.github/workflows/auto_release.yml

Lines changed: 4 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,88 +3,8 @@ name: "Auto release"
33
on:
44
workflow_dispatch:
55

6-
env:
7-
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
8-
HONEYCOMB_DATASET: litmus tests
9-
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
116
jobs:
12-
auto_release:
13-
name: "Automatic release prep"
14-
runs-on: ubuntu-20.04
15-
16-
steps:
17-
18-
- name: "Honeycomb: Start recording"
19-
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
20-
with:
21-
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
22-
dataset: ${{ env.HONEYCOMB_DATASET }}
23-
job-status: ${{ job.status }}
24-
25-
- name: "Honeycomb: start first step"
26-
run: |
27-
echo STEP_ID="auto-release" >> $GITHUB_ENV
28-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
29-
- name: "Checkout Source"
30-
if: ${{ github.repository_owner == 'puppetlabs' }}
31-
uses: actions/checkout@v2
32-
with:
33-
fetch-depth: 0
34-
persist-credentials: false
35-
36-
- name: "PDK Release prep"
37-
uses: docker://puppet/pdk:2.6.1.0
38-
with:
39-
args: 'release prep --force'
40-
env:
41-
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
43-
- name: "Get Version"
44-
if: ${{ github.repository_owner == 'puppetlabs' }}
45-
id: gv
46-
run: |
47-
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
48-
49-
- name: "Check if a release is necessary"
50-
if: ${{ github.repository_owner == 'puppetlabs' }}
51-
id: check
52-
run: |
53-
git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true"
54-
55-
- name: "Commit changes"
56-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
57-
run: |
58-
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
59-
git config --local user.name "GitHub Action"
60-
git add .
61-
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
62-
63-
- name: Create Pull Request
64-
id: cpr
65-
uses: puppetlabs/peter-evans-create-pull-request@v3
66-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
67-
with:
68-
token: ${{ secrets.GITHUB_TOKEN }}
69-
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
70-
branch: "release-prep"
71-
delete-branch: true
72-
title: "Release prep v${{ steps.gv.outputs.ver }}"
73-
body: |
74-
Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}.
75-
Please verify before merging:
76-
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
77-
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
78-
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
79-
labels: "maintenance"
80-
81-
- name: PR outputs
82-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
83-
run: |
84-
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
85-
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
86-
87-
- name: "Honeycomb: Record finish step"
88-
if: ${{ always() }}
89-
run: |
90-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'
7+
release_prep:
8+
name: "Release Prep"
9+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release_prep.yml@main"
10+
secrets: "inherit"

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "ci"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
workflow_dispatch:
8+
9+
jobs:
10+
Spec:
11+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
12+
secrets: "inherit"
13+
14+
Integration:
15+
needs: "Spec"
16+
runs-on: ubuntu-20.04
17+
strategy:
18+
fail-fast: false
19+
matrix: {'platform':['centos-7'],'collection':['puppet6-nightly', 'puppet7-nightly']}
20+
21+
steps:
22+
- name: Checkout Source
23+
uses: actions/checkout@v2
24+
25+
- name: Activate Ruby 2.7
26+
uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: "2.7"
29+
bundler-cache: true
30+
31+
- name: Print bundle environment
32+
run: |
33+
echo ::group::bundler environment
34+
bundle env
35+
echo ::endgroup::
36+
37+
- name: Create the fixtures directory
38+
run: |
39+
echo ::group::Create the fixtures directory
40+
bundle exec rake spec_prep
41+
echo ::endgroup::
42+
43+
- name: Provision test environment
44+
run: |
45+
bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::provision_cluster image_type=${{ matrix.platform }}
46+
FILE='spec/fixtures/litmus_inventory.yaml'
47+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
48+
echo INVENTORY_PATH=$FILE >> $GITHUB_ENV
49+
50+
- name: Puppet server setup
51+
run: |
52+
bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::puppetserver_setup collection='${{ matrix.collection }}' -i ./$INVENTORY_PATH
53+
54+
- name: Install agent
55+
run: |
56+
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
57+
58+
- name: Install module
59+
run: |
60+
bundle exec rake 'litmus:install_module'
61+
62+
- name: Run integration tests
63+
run: |
64+
bundle exec rake kubernetes:integration
65+
66+
- name: Remove test environment
67+
if: ${{ always() }}
68+
continue-on-error: true
69+
run: |
70+
bundle exec rake 'litmus:tear_down'

.github/workflows/integration_test.yml

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)