clinar

command module
v0.0.0-...-fd40029 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

:imagesdir: doc

# clinar - A tool to cleanup stale gitlab runners

image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link="http://www.apache.org/licenses/LICENSE-2.0"]
image:https://github.com/steffakasid/clinar/actions/workflows/codeql-analysis.yml/badge.svg[link:https://github.com/steffakasid/clinar/actions/workflows/codeql-analysis.yml]
image:https://github.com/steffakasid/clinar/actions/workflows/release.yml/badge.svg[link:https://github.com/steffakasid/clinar/actions/workflows/release.yml]
image:https://github.com/steffakasid/clinar/actions/workflows/go-test.yml/badge.svg[link:https://github.com/steffakasid/clinar/actions/workflows/go-test.yml]
image:coverage_badge.png[]

This tool basically get's all offline runners which a user can administer. If you don't provide the `--approve` flag the tool just shows all runners which are offline with some additional information. After you provide the `--approve` flag all offline runners are deleted.

## Installation

On OSX or Linux just use brew to install:

.How to brew install
[source,sh]
----
brew install steffakasid/clinar/clinar
# or
brew tap steffakasid/clinar 
#and then 
brew install clinar
----

Checkout `brew help`, `man brew`

## Flags and Config Options

.Usage
  clinar [flags]

.Environment Variables

GITLAB_HOST:: set the GitLab host to be able to run against self hosted GitLab instances [Default: https://gitlab.com]
GITLAB_TOKEN:: GitLab token to access the GitLab API. To view runners read_api should be sufficient. To cleanup stale runners you must have full API access.

.Flags

--approve, -a:: Boolean flag to toggle approve. If you provide this flag stale runners are deleted.
--exclude, -e:: String[] flag (can be provided multiple times). Define projects/ groups based on their names or ids which are excluded. This flag takes precedences before include. If one group/ project is excluded the full runner is excluded from the cleanup list.
--include, -i:: String flag to define a regular expressions for projects/ groups which should be included. If one group/ project is included the runner is included into the cleanup list.

## Using sops encrypted config file

You can now provide a link:https://github.com/mozilla/sops[sops] encrypted config file. To create one you need any supported encryption key e.g. gpg and encrypt your file like the following:

.Encrpting config
[source,sh]
----
❯ sops --pgp=<GPG Fingerprint> --input-type yaml --output-type yaml $HOME/.clinar
----

NOTE: You can also add the yaml extension to the filename: $HOME/.clinar.yaml in that case you don't need to specify `--input-type` and `--output-type`

GPG Fingerprint:: Your gpg fingerprint you can find out with `gpg --list-keys`

You can set any flag or env var within the config e.g.:
.Content of config file
[source.yaml]
----
GITLAB_TOKEN: <gitlab personal token>
GITLAB_HOST: <custom gitlab host>
----
gitlab personal token:: A gitlab personal token can be created in your user profile in GitLab
custom gitlab host:: If necessary you can set a custom gitlab host (e.g. a company private one)

== Development

=== Generate Coverage Badge

The badge is generated using: https://github.com/jpoles1/gopherbadger

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL