38 changes: 38 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# devcontainer


For format details, see https://aka.ms/devcontainer.json.

For config options, see the README at:
https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet

``` json
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pdk --version",
}
```



16 changes: 5 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pdk --version",
}
24 changes: 16 additions & 8 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-20.04

steps:

- name: "Honeycomb: Start recording"
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
with:
Expand All @@ -25,18 +26,19 @@ jobs:
run: |
echo STEP_ID="auto-release" >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
- name: "Checkout Source"
if: ${{ github.repository_owner == 'puppetlabs' }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

# We use the dev tools image here because the PDK image does not have the
# build tools necessary to compile native extensions.
- name: "PDK Release prep"
uses: docker://puppet/iac_release:ci
uses: docker://puppet/puppet-dev-tools:4.x
with:
args: 'release prep --force'
args: 'pdk release prep --force --debug'
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -46,8 +48,14 @@ jobs:
run: |
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
- name: "Commit changes"
- name: "Check if a release is necessary"
if: ${{ github.repository_owner == 'puppetlabs' }}
id: check
run: |
git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true"
- name: "Commit changes"
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
run: |
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
git config --local user.name "GitHub Action"
Expand All @@ -57,7 +65,7 @@ jobs:
- name: Create Pull Request
id: cpr
uses: puppetlabs/peter-evans-create-pull-request@v3
if: ${{ github.repository_owner == 'puppetlabs' }}
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
Expand All @@ -73,11 +81,11 @@ jobs:
labels: "maintenance"

- name: PR outputs
if: ${{ github.repository_owner == 'puppetlabs' }}
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: "Honeycomb: Record finish step"
if: ${{ always() }}
run: |
Expand Down
69 changes: 0 additions & 69 deletions .github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml

This file was deleted.

139 changes: 139 additions & 0 deletions .github/workflows/dispatch_unit_tests_with_nightly_puppet_gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
name: '[Dispatched] Unit Tests with nightly Puppet gem'

on:
workflow_dispatch:
inputs:
pa_ref:
description: 'Puppet Agent SHA to use in this run'
required: true

jobs:
set_output_data:
name: 'Prepare input and output data'
runs-on: 'ubuntu-latest'
outputs:
puppet_sha: ${{ steps.setup_world.outputs.puppet_sha }}
ruby_version: ${{ steps.setup_world.outputs.ruby_version }}
puppet_version: ${{ steps.setup_world.outputs.puppet_version }}
puppet_short_commit: ${{ steps.setup_world.outputs.puppet_short_commit }}

steps:
- name: Gather and set data
id: setup_world
run: |
pa_ref=${{ github.event.inputs.pa_ref }}
res=$(curl -s https://raw.githubusercontent.com/puppetlabs/puppet-agent/${pa_ref}/configs/components/puppet.json)
puppet_remote=$(echo $res | cut -d '"' -f 4)
puppet_sha=$(echo $res | cut -d '"' -f 8)
mkdir puppet
pushd puppet
git init
git remote add origin ${puppet_remote}
git fetch
puppet_short_commit=$(git describe ${puppet_sha} | sed -r 's/-/./g' | rev | cut -c 4- | rev)
puppet_version=${puppet_short_commit:0:1}
popd
rm -rf puppet
case $puppet_version in
6)
ruby_version='2.5'
;;
7)
ruby_version='2.7'
;;
esac
echo "::set-output name=puppet_sha::$puppet_sha"
echo "::set-output name=ruby_version::$ruby_version"
echo "::set-output name=puppet_version::$puppet_version"
echo "::set-output name=puppet_short_commit::$puppet_short_commit"
- name: "Puppet Agent SHA: ${{ github.event.inputs.pa_ref }}"
run: "echo ${{ github.event.inputs.pa_ref }}"

- name: "Puppet SHA: ${{ steps.setup_world.outputs.puppet_sha }}"
run: "echo ${{ steps.setup_world.outputs.puppet_sha }}"

- name: "Puppet Short Commit: ${{ steps.setup_world.outputs.puppet_short_commit }}"
run: "echo ${{ steps.setup_world.outputs.puppet_short_commit }}"

- name: "Puppet Version: ${{ steps.setup_world.outputs.puppet_version }}"
run: "echo ${{ steps.setup_world.outputs.puppet_version }}"

- name: "Ruby Version: ${{ steps.setup_world.outputs.ruby_version }}"
run: "echo ${{ steps.setup_world.outputs.ruby_version }}"

unit_tests_with_nightly_puppet_gem:
name: ${{ matrix.os_type }} / Puppet${{ needs.set_output_data.outputs.puppet_version }} gem / Ruby${{ needs.set_output_data.outputs.ruby_version }}
needs: set_output_data
env:
puppet_version: ${{ needs.set_output_data.outputs.puppet_version }}
ruby_version: ${{ needs.set_output_data.outputs.ruby_version }}

strategy:
matrix:
os: [ 'ubuntu-20.04', 'macos-latest', 'windows-2019' ]
include:
- os: 'ubuntu-20.04'
os_type: 'Linux'
env_set_cmd: 'export '
gem_file_postfix: '.gem'
- os: 'macos-latest'
os_type: 'macOS'
env_set_cmd: 'export '
gem_file_postfix: '-universal-darwin.gem'
- os: 'windows-2019'
os_type: 'Windows'
env_set_cmd: '$env:'
gem_file_postfix: '-x64-mingw32.gem'

runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install ruby version ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}

- name: Install the given nightly puppet${{ env.puppet_version }} gem
run: |
sleep_time=0
until [ $sleep_time -ge 15 ]
do
curl --location http://nightlies.puppet.com/downloads/gems/puppet${{ env.puppet_version }}-nightly/puppet-${{ needs.set_output_data.outputs.puppet_short_commit }}${{ matrix.gem_file_postfix }} --output puppet.gem
gem install puppet.gem -N && break
sleep_time=$((sleep_time*2+1))
echo "Retrying download and install of gem in $sleep_time seconds..."
sleep $sleep_time
done
shell: bash

- name: Prepare testing environment with bundler
run: |
git config --global core.longpaths true
bundle config set system 'true'
bundle config set --local without 'release'
${{ matrix.env_set_cmd }}PUPPET_GEM_VERSION=${{ needs.set_output_data.outputs.puppet_short_commit }}
bundle update --jobs 4 --retry 3
- name: Run unit tests
run: bundle exec rake parallel_spec

notify-via-slack:
name: Notify workflow conclusion via Slack
if: ${{ always() }}
needs: [set_output_data, unit_tests_with_nightly_puppet_gem]
runs-on: 'ubuntu-latest'
steps:
- uses: luchihoratiu/notify-via-slack@v1.0.0
with:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
NOTIFY_ONLY_ON_CONCLUSION_CHANGE: 'true'
EXTRA_INFORMATION: ':github_actions: Run number: ${{ github.run_id }} \n
:puppet: Puppet Agent SHA: ${{ github.event.inputs.pa_ref }} \n
:puppet: Puppet SHA: ${{ needs.set_output_data.outputs.puppet_sha }} \n
:puppet: Puppet Short Commit: ${{ needs.set_output_data.outputs.puppet_short_commit }} \n
:puppet: Puppet Version: ${{ needs.set_output_data.outputs.puppet_version }} \n
:ruby: Ruby Version: ${{ needs.set_output_data.outputs.ruby_version }} \n'
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
clean: true
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
clean: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
ruby_version: 2.6
extra_checks: check:symlinks check:git_ignore check:dot_underscore check:test_file

runs-on: 'ubuntu-18.04'
runs-on: 'ubuntu-20.04'
steps:
- name: Checkout current PR code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
Loading