Skip to content

Commit ecdd7c0

Browse files
committed
Clean runner state before AMI creation and add push trigger
- Stop runner service and remove registration/credentials - Clear temp files and bash history - Add push trigger for testing on ji/ami-prebuild branch Signed-off-by: Claude <[email protected]>
1 parent 5ac2076 commit ecdd7c0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/actions/build-ami/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ runs:
5959
cargo install cargo-hack --locked
6060
cargo install grcov --locked
6161
62+
- name: Clean runner state before AMI creation
63+
shell: bash
64+
run: |
65+
# Stop the GitHub Actions runner service
66+
sudo systemctl stop actions.runner.* || true
67+
68+
# Remove runner registration and credentials
69+
sudo rm -rf /home/runner/actions-runner/.runner || true
70+
sudo rm -rf /home/runner/actions-runner/.credentials* || true
71+
sudo rm -rf /home/runner/actions-runner/_diag || true
72+
sudo rm -rf /home/runner/actions-runner/_work || true
73+
74+
# Clear any cached runner state
75+
sudo rm -rf /tmp/* || true
76+
sudo rm -rf /var/tmp/* || true
77+
78+
# Clear bash history
79+
cat /dev/null > ~/.bash_history || true
80+
history -c || true
81+
82+
echo "Runner state cleaned for AMI creation"
83+
6284
- name: Create AMI
6385
id: create-ami
6486
shell: bash

.github/workflows/ami-prebuild.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: AMI Prebuild
33
# Schedule to run every 15 days to keep runner agent up to date
44
# GitHub stops routing jobs to runners with agents older than 30 days
55
on:
6+
# TODO: Remove push trigger after testing
7+
push:
8+
branches: [ji/ami-prebuild]
9+
paths:
10+
- ".github/workflows/ami-prebuild.yml"
11+
- ".github/actions/build-ami/**"
612
schedule:
713
# Run at 00:00 UTC on the 1st and 16th of each month (~15 days apart)
814
- cron: "0 0 1,16 * *"

0 commit comments

Comments
 (0)