0
0
mirror of https://github.com/thegeeklab/drone-admin.git synced 2024-11-24 21:20:42 +00:00
drone-admin/_index.md
Robert Kaussow 9e290db01a commit 9b5652627d
Author: Robert Kaussow <mail@thegeeklab.de>
Date:   Wed Jul 20 17:38:42 2022 +0200

    fix ci
2022-07-21 08:06:19 +00:00

3.0 KiB

title
drone-admin

Build Status Docker Hub Quay.io Go Report Card GitHub contributors Source: GitHub License: Apache-2.0

Admin Tools for Drone.

{{< toc >}}

Build

Build the binary with the following command:

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on

make build

Build the Docker image with the following command:

docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-admin .

Usage

drone-admin --help
NAME:
   drone-admin - drone admin tools

USAGE:
   drone-admin [global options] command [command options] [arguments...]

VERSION:
   4039a9c

COMMANDS:
   build    manage builds
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --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]
   --token value, -t value   server auth token [$DRONE_ADMIN_TOKEN]
   --version, -v             print the version (default: false)

Prune Builds

The build prune subcommand removes all builds older than the specified time limit (seconds, minutes or hours) from all repositories. This command should be used with an admin token, otherwise only repositories to which the user has access can be removed. It is also possible to define a minimum number of builds for each repository, even if the time limit has been exceeded. This can be useful to keep a minimum number of builds for repositories with low frequency.

drone-admin --token my-secret-token --server https://drone.excample.com build prune --older-than 720h
INFO[0001] prune builds older than 720h, keep min 10
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'