{"id":15470425,"url":"https://github.com/iteratec/gitlab-sanity-cli","last_synced_at":"2026-04-27T23:38:04.568Z","repository":{"id":57635158,"uuid":"414887917","full_name":"iteratec/gitlab-sanity-cli","owner":"iteratec","description":"Cleanup tool for GItLab Server","archived":false,"fork":false,"pushed_at":"2022-03-18T16:53:31.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T12:44:16.110Z","etag":null,"topics":["artefacts","automation","devops","devsecops","gitlab","gitlab-api","gitlab-runner","go","golang","repository","sanity"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iteratec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-08T07:25:49.000Z","updated_at":"2021-12-21T07:52:06.000Z","dependencies_parsed_at":"2022-09-26T20:20:52.834Z","dependency_job_id":null,"html_url":"https://github.com/iteratec/gitlab-sanity-cli","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/iteratec/gitlab-sanity-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iteratec%2Fgitlab-sanity-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iteratec%2Fgitlab-sanity-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iteratec%2Fgitlab-sanity-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iteratec%2Fgitlab-sanity-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iteratec","download_url":"https://codeload.github.com/iteratec/gitlab-sanity-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iteratec%2Fgitlab-sanity-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artefacts","automation","devops","devsecops","gitlab","gitlab-api","gitlab-runner","go","golang","repository","sanity"],"created_at":"2024-10-02T02:04:38.420Z","updated_at":"2026-04-27T23:38:04.538Z","avatar_url":"https://github.com/iteratec.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitLab Sanity CLI\n\nGitLab Sanity CLI is a command line tool to cleanup GitLab server.\n\n## Motivation\n\nWhy this tool ?\n\nThis CLI was made to automate sanity jobs (like remove old unused GitLab Runners registrations) which is currently not possible by GitLab server WebUI.\n\nThe main purpose was to save time for cleanup tousend of runners, group-runners registrations and old projects.\n\n## Features\n\nThe CLI is able to list, remove and archive a set of resources.\n\n### Parameter Matrix\n\n|Parameter|Type|Default Value|Description|\n|---|---|---|---|\n|-u, --url|`string`|''|The Gitlab API URL|\n|--insecure|`boolean`|false|Skip certificate Verfication for Gitlab API URL|\n|-t, --token|`string`|''|The GitLab API Access Token|\n|-o, --operation|`string`|''|Action to run (see below)|\n|-r, --resource|`string`|''|GitLab Resource to interact with|\n|-p, --project-type|`string`|internal|Set the project visibility filter (internal, private, public)|\n|-i, --identifier|`int`|''|Specific Resource ID|\n|-a, --age|`int`|36|Filter by last activity in months|\n|-q, --query|`string`|''|Search by name|\n|-s, --state|`string`|''|Filter list by state|\n|-d, --dry-run|`boolean`|false|Dry run, does not change/delete any resources|\n|-n, --num-concurrent-api-calls|`int`|10|Limit the amount of concurrent go routines to call the GitLab API|\n\n\n| Action | Resource | Query filter applicable | Age filter applicable | Status filter applicable | Example |\n|---|---|---|---|---|---|\n|list|user|YES|-|-| List user with name admin: \u003cbr\u003e `gitlab-sanity-cli -o list -r user -q admin`|\n|list|project|YES|YES|-| List internal projects older two years: \u003cbr\u003e `gitlab-sanity-cli -o list -r project -a 24 -p public`|\n|list|runner|YES|-|YES| List docker based runner: \u003cbr\u003e `gitlab-sanity-cli -o list -r runner -q docker`|\n|list|groupRunner|YES|-|YES| List online kubernetes based runner: \u003cbr\u003e `gitlab-sanity-cli -o list -r groupRunner -q kubernetes -s online` |\n|list|pipeline|-|YES|-| List all Pipelines from specific project id: \u003cBR\u003e `gitlab-sanity-cli -o list -r pipeline -i 1337 -a 0` |\n|delete|user|-|-|-| \u003cb\u003eDelete is not capable on users\u003c/b\u003e |\n|delete|project|-|-|-| Remove project with ID 123: \u003cbr\u003e  `gitlab-sanity-cli -o delete -r project -i 123`|\n|delete|runner|-|-|-| Remove runner with ID 123: \u003cbr\u003e  `gitlab-sanity-cli -o delete -r runner -i 123`|\n|delete|groupRunner|-|-|-| Remove runner with ID 123: \u003cbr\u003e `gitlab-sanity-cli -o delete -r groupRunner -i 123`|\n|delete|pipeline|-|-|-| Remove Pipeline with ID 123 from project: \u003cBR\u003e `gitlab-sanity-cli -o delete -r pipeline -i 1337 --pipelineId 123` |\n|delete-all|user|-|-|-|\u003cb\u003eDelete-All is not capable on users\u003c/b\u003e |\n|delete-all|project|YES|YES|-| Remove all projects with name testing: \u003cbr\u003e`gitlab-sanity-cli -o delete-all -r project -a 0 -q testing` \u003cbr\u003e\u003cbr\u003e Remove all projects older than five years: \u003cbr\u003e `gitlab-sanity-cli -o delete-all -r project -a 60`|\n|delete-all|runner|YES|-|YES| Remove all offline runner: \u003cbr\u003e`gitlab-sanity-cli -o delete-all -r runner -s offline`|\n|delete-all|groupRunner|YES|-|YES| Remove all groupRunner (offline and online): \u003cbr\u003e`gitlab-sanity-cli -o delete-all -r groupRunner` |\n|delete-all|pipeline|-|YES|-| Remove all Pipelines from project: \u003cBR\u003e `gitlab-sanity-cli -o delete-all -r pipeline -i 1337` |\n|archive|project|-|-|-|Archive project with ID 123:\u003cbr\u003e`gitlab-sanity-cli -o archive -r project -i 123`|\n|archive-all|project|YES|YES|-|Archive project with name testing:\u003cbr\u003e`gitlab-sanity-cli -o archive-all -r project -q testing -a 0 -p private`|\n## How to run\n\n### Requirements\n\n- [GitLab Access Token for api and repository access](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)\n\n### 1. Download binary version\n\nOn Linux/MacOS/FreeBSD\n\n```sh\nexport OS=`uname -s | tr '[A-Z]' '[a-z]'`\ncurl -L -O https://github.com/iteratec/gitlab-sanity-cli/releases/latest/download/gitlab-sanity-cli.${OS}.amd64.tar.gz\ncurl -L -O https://github.com/iteratec/gitlab-sanity-cli/releases/latest/download/gitlab-sanity-cli.${OS}.amd64.tar.gz.sha256\n```\n\nOn Windows (open Powershell or Cmd and run follow commands)\n\n```cmd\ncurl -L -O https://github.com/iteratec/gitlab-sanity-cli/releases/latest/download/gitlab-sanity-cli.windows.amd64.zip\ncurl -L -O https://github.com/iteratec/gitlab-sanity-cli/releases/latest/download/gitlab-sanity-cli.windows.sha256\n```\n\n### 2. Verify Download\n\nOn Linux\n\n```sh\nsha256sum -c gitlab-sanity-cli.${OS}.amd64.tar.gz.sha256\n```\n\nOn MacOS/FreeBSD\n\n```sh\nshasum -a 256 -c gitlab-sanity-cli.${OS}.amd64.tar.gz.sha256\n```\n\nOn Windows\n\n```cmd\nCertUtil -hashfile gitlab-sanity-cli.windows.amd64.zip.sha256 SHA256\n```\n\n```powershell\nGet-FileHash gitlab-sanity-cli.windows.amd64.zip.sha256 -Algorithm SHA256\n```\n\n\u003cb\u003eSecurity Note: \u003cfont color=red\u003ePlease continue only if the hash verification was OK, otherwise don't use the tool!\u003c/font\u003e\u003c/b\u003e\n\n### 3. Extract Binary from archive\n\nOn Linux/MacOS/FreeBSD\n\n```sh\ntar xvzf gitlab-sanity-cli.${OS}.amd64.tar.gz\nmv gitlab-sanity-cli.${OS} gitlab-sanity-cli\nchmod 0755 ./gitlab-sanity-cli\n```\n\nOn Windows\n\n```sh\npowershell -command \"Expand-Archive -Force 'gitlab-sanity-cli.windows.amd64.zip' '.'\"\n```\n\nCheck binary version\n\n```sh\n./gitlab-sanity-cli -v\n\nGitlab Sanity CLI (@iteratec)\nVERSION: x.y.z\n```\n\nTest\n\n```sh\n./gitlab-sanity-cli -u gitlabserver.tld -t apitoken -o list -r project\n```\n\nSee [Parameter Matrix](#parameter-matrix) from above for examples\n\n## How to run from source\n\n### Requirements\n\n- [go](https://golang.org)\n- [GitLab Access Token with api, repository access](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)\n\nFirst Run\n\n```sh\ngo get -d -v ./...\n```\n\nRun command without building binary\n\n```sh\ngo run cmd/main.go -h\n```\n\n## How to build \n\n### Requirements\n\n- [go](https://golang.org)\n- [gnumake](https://www.gnu.org/software/make/)\n\nUse make to create the binaries\n\nFor Windows x86_64\n\n```sh\nmake windows\n```\n\nFor Linux x86_64\n\n```sh\nmake linux\n```\n\nFor MacOS x86_64\n\n```sh\nmake darwin\n```\n\nFor FreeBSD x86_64\n\n```sh\nmake freebsd\n```\n\nFor any other OS and Architecture:\n\nSee https://golang.org/doc/install/source#environment)\n\n```sh\n#\n# MacOS (M1/arm64) Example\n#\nexport target_os=\"darwin\"\nexport target_arch=\"arm64\"\nenv GOOS=${target_os} GOARCH=${target_arch} go build -ldflags \"-extldflags '-static'\" -o ./gitlab-sanity-cli.${target_os}.${target_arch} cmd/main.go\n```\n\n\n## Update go modules\n\n```sh\n# List all used modules\ngo list -m all\n\n# List all available versions from module\ngo list -m -versions github.com/xanzy/go-gitlab\n\n# Get specific version from module\ngo get github.com/xanzy/go-gitlab@v0.50.4\n```\n\n# Use the Code\n\n[see architecture](architecture.md)\n\n# Sources\n\n- [GitLab API](https://docs.gitlab.com/ee/api)\n- [go-gitlab](https://github.com/xanzy/go-gitlab)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiteratec%2Fgitlab-sanity-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiteratec%2Fgitlab-sanity-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiteratec%2Fgitlab-sanity-cli/lists"}