From c32d2b48fff29f6e352d914bfd41fd0f98fce1a9 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 26 Jul 2022 13:39:17 +0000 Subject: [PATCH] commit c16e315630c988930ed7cf8c2368512bcf8f147e Author: Robert Kaussow Date: Tue Jul 26 14:01:11 2022 +0200 feat: add reaper sub command to cleanup faulty agents (#4) --- _index.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/_index.md b/_index.md index a0db801..6bc5c32 100644 --- a/_index.md +++ b/_index.md @@ -48,16 +48,18 @@ USAGE: drone-admin [global options] command [command options] [arguments...] VERSION: - 4039a9c + 00d2c63 COMMANDS: - build manage builds - help, h Shows a list of commands or help for one command + build manage build + autoscaler manage autoscaler + help, h Shows a list of commands or help for one command GLOBAL OPTIONS: + --dry-run disable api calls (default: false) [$DRONE_ADMIN_DRY_RUN] --help, -h show help (default: false) --log-level value log level (default: "info") [$DRONE_ADMIN_LOG_LEVEL] - --server value, -s value server address [$DRONE_ADMIN_SERVER] + --server value, -s value server address (accepts multiple inputs) [$DRONE_ADMIN_SERVER] --token value, -t value server auth token [$DRONE_ADMIN_TOKEN] --version, -v print the version (default: false) ``` @@ -73,3 +75,13 @@ INFO[0001] skip 'example/repo_1', number of 9 builds lower than min value INFO[0002] prune 1/105 builds from 'example/demo' INFO[0002] prune 0/56 builds from 'example/cool_project' ``` + +### Cleanup autoscaler agents + +When using the autoscaler, agents sometimes remain in error state in the DB (even if the Drone CI Reaper is enabled). This command tries the destroy agents in error state two times and forces it on the third attempt. For this command the `--server` flag must be set to the address of the autoscaler server(s). + +```Shell +drone-admin --token my-secret-token --server https://drone-scaler.excample.com autoscaler reaper +INFO[0000] lookup agents in error state error=1 ok=1 server="https://drone-scaler.excample.com" +INFO[0000] destroy agent agent=agent-G8hHyA0A force=false server="https://drone-scaler.excample.com" triage=1 +```