Skip to content

Commit

Permalink
add action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Sep 18, 2024
1 parent e0c8506 commit a529e25
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 32 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Caddy to proxy Prometheus
run: |
docker run -d --name promproxy -p 9090:9090 caddy caddy reverse-proxy --from :9090 --to https://${{ secrets.PROMETHEUS_REMOTE_WRITE_DESTINATION }} --change-host-header
- name: Run Netdata
uses: .
with:
exporting-config: |
[prometheus_remote_write:prom]
enabled = yes
destination = 127.0.0.1:9090
username = ${{ secrets.PROMETHEUS_REMOTE_WRITE_USERNAME }}
password = ${{ secrets.PROMETHEUS_REMOTE_WRITE_PASSWORD }}
remote write URL path = /api/v1/write
update every = 5
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Run Netdata
run: |
echo '[prometheus_remote_write:prom]
enabled = yes
destination = ${{ secrets.PROMETHEUS_REMOTE_WRITE_DESTINATION }}
username = ${{ secrets.PROMETHEUS_REMOTE_WRITE_USERNAME }}
password = ${{ secrets.PROMETHEUS_REMOTE_WRITE_PASSWORD }}
remote write URL path = /api/v1/write
update every = 5
' > exporting.conf
docker run -d --rm \
--name netdata \
--hostname gha${{ github.repository_id }}-${{ github.run_id }}-${{ github.run_attempt }} \
--pid host \
--network host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-v /:/host/root:ro,rslave \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /etc/os-release:/host/etc/os-release:ro \
-v /var/log:/host/var/log:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /run/dbus:/run/dbus:ro \
-v $PWD/exporting.conf:/etc/netdata/exporting.conf:ro \
netdata/netdata
- name: Install Playwright and dependencies
run: pnpx playwright install --with-deps
- name: Print netdata logs
run: docker logs netdata
45 changes: 45 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Netdata
description: Runs Netdata to collect performance metrics during the test run
inputs:
exporting-config:
required: true
description: Contents of netdata/exporting.conf
outputs:
host-id:
description: The randomly-generated host ID
value: ${{ steps.netdata.outputs.hostid }}
runs:
using: "composite"
steps:
- name: Write configuration
env:
EXPORTING_CONFIG: ${{ inputs.exporting-config }}
run: |
echo "$EXPORTING_CONFIG" > $RUNNER_TEMP/netdata_exporting.conf
shell: bash
- name: Start netdata
id: netdata
run: |
hostid=$(openssl rand -hex 4)
echo "hostid=$hostid" | tee -a "$GITHUB_OUTPUT"
docker run -d --rm \
--name netdata \
--hostname gha${{ github.repository_id }}-${{ github.run_id }}-${{ github.run_attempt }}-$hostid \
--pid host \
--network host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-v /:/host/root:ro,rslave \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /etc/os-release:/host/etc/os-release:ro \
-v /var/log:/host/var/log:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /run/dbus:/run/dbus:ro \
-v $RUNNER_TEMP/netdata_exporting.conf:/etc/netdata/exporting.conf:ro \
netdata/netdata
shell: bash

0 comments on commit a529e25

Please sign in to comment.