Skip to content

Commit

Permalink
Merge pull request #1 from planetscale/joem/gha-release
Browse files Browse the repository at this point in the history
ci(gha): initial release workflow
  • Loading branch information
joemiller authored Aug 16, 2024
2 parents 9c56e78 + a68b19b commit eaae9a0
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
changelog:
categories:
- title: 🏕 Changes
labels:
- "*"
exclude:
labels:
- dependencies
- title: 👒 Dependencies
labels:
- dependencies
4 changes: 0 additions & 4 deletions .github/workflows/licensing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version-file: go.mod

- run: sudo gem install license_finder
- run: license_finder
60 changes: 60 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Update README.md and create release
on:
push:
branches:
- main
paths-ignore:
- README.md
- .buildkite/**
- .github/**
- docker-compose.yml

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: login to ghcr.io
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0

- name: Update README.md
run: |
curl -sL https://git.io/autotag-install | sh -s -- -b "${RUNNER_TEMP}/bin"
set -x
version=$(${RUNNER_TEMP}/bin/autotag -n)
sed -i'' -Ee "s/telemetry#v(.*):/telemetry#v${version}:/" README.md
- name: Commit README.md
uses: planetscale/ghcommit-action@c7915d6c18d5ce4eb42b0eff3f10a29fe0766e4c # v0.1.44
with:
commit_message: "🤖 Update README.md"
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
file_pattern: README.md
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Release
run: |
set -eou pipefail
set -x
git reset --hard && git clean -ffdx && git pull
version=$(${RUNNER_TEMP}/bin/autotag -n)
gh release create "v${version}" --target main --title "v${version}" --generate-notes
docker build -t ghcr.io/planetscale/telemetry:v${version} .
docker push ghcr.io/planetscale/telemetry:v${version}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ RUN apt-get -qy update && apt-get install -qy \

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

ENTRYPOINT ["/usr/bin/dstat"]
ENTRYPOINT ["/bin/sh", "-c"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Buildkite Job Telemetry Collector
# Buildkite Job Telemetry Reporter

TODO

Expand Down
6 changes: 4 additions & 2 deletions hooks/post-command
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ set -eou pipefail
# TODO: proper tempdir scoped to this invocation

docker stop -t1 dstat
echo "+++ Telemetry +++"
cat /tmp/dstat-experiment.txt
echo "+++ :bar_chart: Telemetry:"
cat "$BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"

rm -rf -- "$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR"
5 changes: 2 additions & 3 deletions hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ docker run \
--pid host \
--net host \
--userns host \
-v /tmp:/tmp \
--entrypoint="/bin/bash" \
-v "$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR:$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR" \
ghcr.io/planetscale/telemetry-buildkite-plugin:latest \
-c "dstat -t -c -m -n --disk-tps --disk --color --noupdate 10 > /tmp/dstat-experiment.txt"
"dstat -t -c -m -n --disk-tps --disk --color --noupdate 10 > $BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"

docker ps -a
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Buildkite job telemetry collector
name: Buildkite Job Telemetry Reporter
description: Collect telemetry data from Buildkite jobs and display results at the end of the build.
author: https://github.com/planetscale
requirements:
Expand Down

0 comments on commit eaae9a0

Please sign in to comment.