Skip to content

Commit 53c23d0

Browse files
committed
Add a workflow to remove datasets volume
1 parent 6ac0f49 commit 53c23d0

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Clean Datasets
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
schedule:
7+
# Run every month on the 1st day at 3 am
8+
- cron: "0 3 1 * *"
9+
10+
concurrency:
11+
group: continuous-benchmark
12+
13+
# This removes the ci-datasets volume from client machine.
14+
# The next run of Continuous Benchmark will create the volume again and download all the datasets.
15+
jobs:
16+
removeDatasetsVolume:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: webfactory/[email protected]
21+
with:
22+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
23+
- name: Benches
24+
id: benches
25+
run: |
26+
export HCLOUD_TOKEN=${{ secrets.HCLOUD_TOKEN }}
27+
28+
set +e
29+
30+
timeout 10m bash -x tools/run_client_remove_volume.sh
31+
32+
set -e
33+
- name: Send Notification
34+
if: failure()
35+
uses: slackapi/[email protected]
36+
with:
37+
payload: |
38+
{
39+
"text": "Failed to remove the datasets volume (removeDatasetsVolume), run status: ${{ job.status }}",
40+
"blocks": [
41+
{
42+
"type": "section",
43+
"text": {
44+
"type": "mrkdwn",
45+
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
46+
}
47+
}
48+
]
49+
}
50+
env:
51+
SLACK_WEBHOOK_URL: ${{ secrets.CI_ALERTS_CHANNEL_WEBHOOK_URL }}
52+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

tools/run_client_remove_volume.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
PS4='ts=$(date "+%Y-%m-%dT%H:%M:%SZ") level=DEBUG line=$LINENO file=$BASH_SOURCE '
4+
set -euo pipefail
5+
6+
CLOUD_NAME=${CLOUD_NAME:-"hetzner"}
7+
SERVER_USERNAME=${SERVER_USERNAME:-"root"}
8+
9+
SCRIPT=$(realpath "$0")
10+
SCRIPT_PATH=$(dirname "$SCRIPT")
11+
12+
BENCH_CLIENT_NAME=${CLIENT_NAME:-"benchmark-client-1"}
13+
14+
IP_OF_THE_CLIENT=$(bash "${SCRIPT_PATH}/${CLOUD_NAME}/get_public_ip.sh" "$BENCH_CLIENT_NAME")
15+
16+
echo "Remove ci-datasets volume from client"
17+
RUN_CMD="docker volume rm -f ci-datasets || true"
18+
19+
ssh -tt -o ServerAliveInterval=120 -o ServerAliveCountMax=10 "${SERVER_USERNAME}@${IP_OF_THE_CLIENT}" "${RUN_CMD}"

0 commit comments

Comments
 (0)