Add manual runner removal
Runners can now be manually removed using the CLI. Some restrictions apply: * A runner must be idle in github. Github will not allow us to remove a runner that is running a workflow. * The runner status must be "running" Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
1f419d0abc
commit
5390efbaab
20 changed files with 336 additions and 120 deletions
|
|
@ -24,7 +24,8 @@ function sendStatus() {
|
|||
|
||||
function success() {
|
||||
MSG="$1"
|
||||
call "{\"status\": \"idle\", \"message\": \"$MSG\"}"
|
||||
ID=$2
|
||||
call "{\"status\": \"idle\", \"message\": \"$MSG\", \"agent_id\": $ID}"
|
||||
}
|
||||
|
||||
function fail() {
|
||||
|
|
@ -57,5 +58,11 @@ sendStatus "installing runner service"
|
|||
sendStatus "starting service"
|
||||
./svc.sh start || fail "failed to start service"
|
||||
|
||||
success "runner successfully installed"
|
||||
set +e
|
||||
AGENT_ID=$(grep "agentId" /home/{{ .RunnerUsername }}/actions-runner/.runner | tr -d -c 0-9)
|
||||
if [ $? -ne 0 ];then
|
||||
fail "failed to get agent ID"
|
||||
fi
|
||||
set -e
|
||||
|
||||
success "runner successfully installed" $AGENT_ID
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ function sendStatus() {
|
|||
|
||||
function success() {
|
||||
MSG="$1"
|
||||
call "{\"status\": \"idle\", \"message\": \"$MSG\"}"
|
||||
ID=$2
|
||||
call "{\"status\": \"idle\", \"message\": \"$MSG\", \"agent_id\": $ID}"
|
||||
}
|
||||
|
||||
function fail() {
|
||||
|
|
@ -57,5 +58,11 @@ sendStatus "installing runner service"
|
|||
sendStatus "starting service"
|
||||
./svc.sh start || fail "failed to start service"
|
||||
|
||||
success "runner successfully installed"
|
||||
set +e
|
||||
AGENT_ID=$(grep "agentId" /home/{{ .RunnerUsername }}/actions-runner/.runner | tr -d -c 0-9)
|
||||
if [ $? -ne 0 ];then
|
||||
fail "failed to get agent ID"
|
||||
fi
|
||||
set -e
|
||||
|
||||
success "runner successfully installed" $AGENT_ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue