Skip to content

pdksync - Update pdk-templates for gitpod and codespaces support #1206

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

Merged
merged 1 commit into from
Feb 8, 2021
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
99 changes: 99 additions & 0 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: "Auto release"

on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch:

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
HONEYCOMB_DATASET: litmus tests
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
auto_release:
name: "Automatic release prep"
runs-on: ubuntu-20.04

steps:
- name: "Honeycomb: Start recording"
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
with:
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
dataset: ${{ env.HONEYCOMB_DATASET }}
job-status: ${{ job.status }}

- name: "Honeycomb: start first step"
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
with:
fetch-depth: 0
persist-credentials: false

- name: Append PDK to Gemfile
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo "gem 'pdk'" >> Gemfile

- name: Activate Ruby 2.7
uses: ruby/setup-ruby@v1
if: ${{ github.repository_owner == 'puppetlabs' }}
with:
ruby-version: "2.7"
bundler-cache: true

- name: Print bundle environment
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo ::group::bundler environment
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
echo ::endgroup::

- name: "Honeycomb: Record Bundler Setup time"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup'
echo STEP_ID="auto_release_setup" >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV

- name: "PDK Release prep"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
buildevents cmd $TRACE_ID $STEP_ID 'pdk release prep' -- bundle exec pdk release prep --force

- name: "Commit changes"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-Release prep"

- name: "Get Version"
if: ${{ github.repository_owner == 'puppetlabs' }}
id: gv
run: |
echo "::set-output name=ver::$(cat metadata.json | jq .version)"

- name: Create Pull Request
id: cpr
uses: puppetlabs/peter-evans-create-pull-request@v3
if: ${{ github.repository_owner == 'puppetlabs' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
branch: "release-prep"
delete-branch: true
title: "Release prep v${{ steps.gv.outputs.ver }}"
labels: "maintenance"

- name: PR outputs
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
18 changes: 18 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM gitpod/workspace-full
RUN sudo wget https://apt.puppet.com/puppet-tools-release-bionic.deb && \
wget https://apt.puppetlabs.com/puppet6-release-bionic.deb && \
sudo dpkg -i puppet6-release-bionic.deb && \
sudo dpkg -i puppet-tools-release-bionic.deb && \
sudo apt-get update && \
sudo apt-get install -y pdk zsh puppet-agent && \
sudo apt-get clean && \
sudo rm -rf /var/lib/apt/lists/*
RUN sudo usermod -s $(which zsh) gitpod && \
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
echo "plugins=(git gitignore github gem pip bundler python ruby docker docker-compose)" >> /home/gitpod/.zshrc && \
echo 'PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin"' >> /home/gitpod/.zshrc && \
sudo /opt/puppetlabs/puppet/bin/gem install puppet-debugger hub -N && \
mkdir -p /home/gitpod/.config/puppet && \
/opt/puppetlabs/puppet/bin/ruby -r yaml -e "puts ({'disabled' => true}).to_yaml" > /home/gitpod/.config/puppet/analytics.yml
RUN rm -f puppet6-release-bionic.deb puppet-tools-release-bionic.deb
ENTRYPOINT /usr/bin/zsh
9 changes: 9 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
image:
file: .gitpod.Dockerfile

tasks:
- init: pdk bundle install

vscode:
extensions:
- puppet.puppet-vscode@1.0.0:oSzfTkDf6Cmc1jOjgW33VA==
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ spec/spec_helper.rb:
unmanaged: false
.github/workflows/pr_test.yml:
unmanaged: false
.gitpod.Dockerfile:
unmanaged: false
.gitpod.yml:
unmanaged: false
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@
],
"pdk-version": "1.18.1",
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
"template-ref": "heads/main-0-g1862b96"
"template-ref": "heads/main-0-gec9c129"
}