seperate validate runner reload
This commit is contained in:
parent
a6649b0e9f
commit
62b353d5f6
@ -6,6 +6,11 @@ on:
|
||||
stack_name:
|
||||
required: true
|
||||
type: string
|
||||
delayed_silent:
|
||||
description: Delay the webhook call using a detached container and always succeed. Used when rebuilding the runner executing the webhook.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
deploy-gitainer:
|
||||
@ -18,6 +23,11 @@ jobs:
|
||||
|
||||
- name: Call Gitainer stack webhooks
|
||||
continue-on-error: true
|
||||
run: curl --request POST http://192.168.1.150:9080/api/stacks/${{ inputs.stack_name }}?pretty &
|
||||
with:
|
||||
workflow-status: ${{ steps.check-step.outcome }}
|
||||
run: |
|
||||
if [ "${{ inputs.delayed_silent }}" = "true" ]; then
|
||||
echo "Delaying the webhook call by 10s using a detached container."
|
||||
echo "This gives the runner time to report job completion and clean up before it restarts."
|
||||
docker run --rm -d alpine sh -c "apk add --no-cache curl && sleep 10 && curl --request POST 'http://192.168.1.150:9080/api/stacks/${{ inputs.stack_name }}?pretty'"
|
||||
else
|
||||
curl --request POST "http://192.168.1.150:9080/api/stacks/${{ inputs.stack_name }}?pretty"
|
||||
fi
|
||||
|
||||
@ -17,11 +17,5 @@ jobs:
|
||||
uses: martin/chromart-gitea-actions/.gitea/workflows/gitainer-deploy.yaml@main
|
||||
with:
|
||||
stack_name: gitea_act_runner
|
||||
|
||||
notify:
|
||||
needs: diff
|
||||
if: ${{ needs.diff.outputs.is_changed == 'false' }}
|
||||
uses: martin/chromart-gitea-actions/.gitea/workflows/apprise-notify.yaml@main
|
||||
with:
|
||||
title: Skipped deploy on chromart-gitea-actions
|
||||
message: No changes to deploy
|
||||
# use this because this action kills the runner
|
||||
delayed_silent: true
|
||||
|
||||
24
.gitea/workflows/validate-runner.yaml
Normal file
24
.gitea/workflows/validate-runner.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
name: Validate Runner Reload
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Reload Act Runner Stack to clear cache for workflows"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Wait for Gitainer to restart the runner
|
||||
run: sleep 30
|
||||
|
||||
- name: Check runner age is under 2 minutes
|
||||
run: |
|
||||
runner_start=$(docker run --rm --pid=host alpine stat -c %Y /proc/1)
|
||||
now=$(date +%s)
|
||||
age_seconds=$((now - runner_start))
|
||||
echo "Runner age: $age_seconds seconds"
|
||||
if [ "$age_seconds" -gt 120 ]; then
|
||||
echo "Validation Failed! Runner did not restart."
|
||||
exit 1
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user