Skip to content

Commit 9f7bef8

Browse files
DavidSsheenaajay
authored andcommitted
Update pdk-templates for gitpod and codespaces support
1 parent 8498326 commit 9f7bef8

File tree

5 files changed

+131
-1
lines changed

5 files changed

+131
-1
lines changed

.github/workflows/auto_release.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: "Auto release"
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 6'
6+
workflow_dispatch:
7+
8+
env:
9+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
10+
HONEYCOMB_DATASET: litmus tests
11+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
13+
jobs:
14+
auto_release:
15+
name: "Automatic release prep"
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: "Honeycomb: Start recording"
20+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
21+
with:
22+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
23+
dataset: ${{ env.HONEYCOMB_DATASET }}
24+
job-status: ${{ job.status }}
25+
26+
- name: "Honeycomb: start first step"
27+
run: |
28+
echo STEP_ID="auto-release" >> $GITHUB_ENV
29+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30+
31+
- name: "Checkout Source"
32+
if: ${{ github.repository_owner == 'puppetlabs' }}
33+
uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- name: Append PDK to Gemfile
39+
if: ${{ github.repository_owner == 'puppetlabs' }}
40+
run: |
41+
echo "gem 'pdk'" >> Gemfile
42+
43+
- name: Activate Ruby 2.7
44+
uses: ruby/setup-ruby@v1
45+
if: ${{ github.repository_owner == 'puppetlabs' }}
46+
with:
47+
ruby-version: "2.7"
48+
bundler-cache: true
49+
50+
- name: Print bundle environment
51+
if: ${{ github.repository_owner == 'puppetlabs' }}
52+
run: |
53+
echo ::group::bundler environment
54+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
55+
echo ::endgroup::
56+
57+
- name: "Honeycomb: Record Bundler Setup time"
58+
if: ${{ github.repository_owner == 'puppetlabs' }}
59+
run: |
60+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup'
61+
echo STEP_ID="auto_release_setup" >> $GITHUB_ENV
62+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
63+
64+
- name: "PDK Release prep"
65+
if: ${{ github.repository_owner == 'puppetlabs' }}
66+
run: |
67+
buildevents cmd $TRACE_ID $STEP_ID 'pdk release prep' -- bundle exec pdk release prep --force
68+
69+
- name: "Commit changes"
70+
if: ${{ github.repository_owner == 'puppetlabs' }}
71+
run: |
72+
git config --local user.email "[email protected]"
73+
git config --local user.name "GitHub Action"
74+
git add .
75+
git commit -m "Auto-Release prep"
76+
77+
- name: "Get Version"
78+
if: ${{ github.repository_owner == 'puppetlabs' }}
79+
id: gv
80+
run: |
81+
echo "::set-output name=ver::$(cat metadata.json | jq .version)"
82+
83+
- name: Create Pull Request
84+
id: cpr
85+
uses: puppetlabs/peter-evans-create-pull-request@v3
86+
if: ${{ github.repository_owner == 'puppetlabs' }}
87+
with:
88+
token: ${{ secrets.GITHUB_TOKEN }}
89+
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
90+
branch: "release-prep"
91+
delete-branch: true
92+
title: "Release prep v${{ steps.gv.outputs.ver }}"
93+
labels: "maintenance"
94+
95+
- name: PR outputs
96+
if: ${{ github.repository_owner == 'puppetlabs' }}
97+
run: |
98+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
99+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.gitpod.Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM gitpod/workspace-full
2+
RUN sudo wget https://apt.puppet.com/puppet-tools-release-bionic.deb && \
3+
wget https://apt.puppetlabs.com/puppet6-release-bionic.deb && \
4+
sudo dpkg -i puppet6-release-bionic.deb && \
5+
sudo dpkg -i puppet-tools-release-bionic.deb && \
6+
sudo apt-get update && \
7+
sudo apt-get install -y pdk zsh puppet-agent && \
8+
sudo apt-get clean && \
9+
sudo rm -rf /var/lib/apt/lists/*
10+
RUN sudo usermod -s $(which zsh) gitpod && \
11+
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
12+
echo "plugins=(git gitignore github gem pip bundler python ruby docker docker-compose)" >> /home/gitpod/.zshrc && \
13+
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 && \
14+
sudo /opt/puppetlabs/puppet/bin/gem install puppet-debugger hub -N && \
15+
mkdir -p /home/gitpod/.config/puppet && \
16+
/opt/puppetlabs/puppet/bin/ruby -r yaml -e "puts ({'disabled' => true}).to_yaml" > /home/gitpod/.config/puppet/analytics.yml
17+
RUN rm -f puppet6-release-bionic.deb puppet-tools-release-bionic.deb
18+
ENTRYPOINT /usr/bin/zsh

.gitpod.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
image:
2+
file: .gitpod.Dockerfile
3+
4+
tasks:
5+
- init: pdk bundle install
6+
7+
vscode:
8+
extensions:
9+
- [email protected]:oSzfTkDf6Cmc1jOjgW33VA==

.sync.yml

+4
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ spec/spec_helper.rb:
4646
unmanaged: false
4747
.github/workflows/pr_test.yml:
4848
unmanaged: false
49+
.gitpod.Dockerfile:
50+
unmanaged: false
51+
.gitpod.yml:
52+
unmanaged: false

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@
8989
],
9090
"pdk-version": "1.18.1",
9191
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
92-
"template-ref": "heads/main-0-g1862b96"
92+
"template-ref": "heads/main-0-gec9c129"
9393
}

0 commit comments

Comments
 (0)