Skip to content

Commit eaae9a0

Browse files
authored
Merge pull request #1 from planetscale/joem/gha-release
ci(gha): initial release workflow
2 parents 9c56e78 + a68b19b commit eaae9a0

File tree

8 files changed

+80
-12
lines changed

8 files changed

+80
-12
lines changed

.github/release.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
changelog:
2+
categories:
3+
- title: 🏕 Changes
4+
labels:
5+
- "*"
6+
exclude:
7+
labels:
8+
- dependencies
9+
- title: 👒 Dependencies
10+
labels:
11+
- dependencies

.github/workflows/licensing.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,5 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020

21-
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
22-
with:
23-
go-version-file: go.mod
24-
2521
- run: sudo gem install license_finder
2622
- run: license_finder

.github/workflows/release.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Update README.md and create release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- README.md
8+
- .buildkite/**
9+
- .github/**
10+
- docker-compose.yml
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- name: login to ghcr.io
21+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Update README.md
32+
run: |
33+
curl -sL https://git.io/autotag-install | sh -s -- -b "${RUNNER_TEMP}/bin"
34+
set -x
35+
version=$(${RUNNER_TEMP}/bin/autotag -n)
36+
sed -i'' -Ee "s/telemetry#v(.*):/telemetry#v${version}:/" README.md
37+
38+
- name: Commit README.md
39+
uses: planetscale/ghcommit-action@c7915d6c18d5ce4eb42b0eff3f10a29fe0766e4c # v0.1.44
40+
with:
41+
commit_message: "🤖 Update README.md"
42+
repo: ${{ github.repository }}
43+
branch: ${{ github.head_ref || github.ref_name }}
44+
file_pattern: README.md
45+
env:
46+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
47+
48+
- name: Release
49+
run: |
50+
set -eou pipefail
51+
set -x
52+
53+
git reset --hard && git clean -ffdx && git pull
54+
version=$(${RUNNER_TEMP}/bin/autotag -n)
55+
gh release create "v${version}" --target main --title "v${version}" --generate-notes
56+
57+
docker build -t ghcr.io/planetscale/telemetry:v${version} .
58+
docker push ghcr.io/planetscale/telemetry:v${version}
59+
env:
60+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ RUN apt-get -qy update && apt-get install -qy \
77

88
RUN cd /var/lib/pcp/pmns && ./Rebuild
99

10-
ENTRYPOINT ["/usr/bin/dstat"]
10+
ENTRYPOINT ["/bin/sh", "-c"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Buildkite Job Telemetry Collector
1+
# Buildkite Job Telemetry Reporter
22

33
TODO
44

hooks/post-command

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ set -eou pipefail
66
# TODO: proper tempdir scoped to this invocation
77

88
docker stop -t1 dstat
9-
echo "+++ Telemetry +++"
10-
cat /tmp/dstat-experiment.txt
9+
echo "+++ :bar_chart: Telemetry:"
10+
cat "$BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"
11+
12+
rm -rf -- "$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR"

hooks/pre-command

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ docker run \
1313
--pid host \
1414
--net host \
1515
--userns host \
16-
-v /tmp:/tmp \
17-
--entrypoint="/bin/bash" \
16+
-v "$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR:$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR" \
1817
ghcr.io/planetscale/telemetry-buildkite-plugin:latest \
19-
-c "dstat -t -c -m -n --disk-tps --disk --color --noupdate 10 > /tmp/dstat-experiment.txt"
18+
"dstat -t -c -m -n --disk-tps --disk --color --noupdate 10 > $BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"
2019

2120
docker ps -a

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Buildkite job telemetry collector
1+
name: Buildkite Job Telemetry Reporter
22
description: Collect telemetry data from Buildkite jobs and display results at the end of the build.
33
author: https://github.com/planetscale
44
requirements:

0 commit comments

Comments
 (0)