{"id":17356525,"url":"https://github.com/nickshine/glt","last_synced_at":"2026-01-21T16:33:36.107Z","repository":{"id":38176017,"uuid":"175346239","full_name":"nickshine/glt","owner":"nickshine","description":"A cli for GitLab tasks","archived":false,"fork":false,"pushed_at":"2023-01-07T18:56:13.000Z","size":4516,"stargazers_count":2,"open_issues_count":13,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T17:15:55.891Z","etag":null,"topics":["cli","command-line-interface","gitlab","gitlab-ci"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickshine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-13T04:28:16.000Z","updated_at":"2021-04-20T20:06:53.000Z","dependencies_parsed_at":"2023-02-07T21:46:13.169Z","dependency_job_id":null,"html_url":"https://github.com/nickshine/glt","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickshine%2Fglt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickshine%2Fglt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickshine%2Fglt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickshine%2Fglt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickshine","download_url":"https://codeload.github.com/nickshine/glt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247671731,"owners_count":20976815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","command-line-interface","gitlab","gitlab-ci"],"created_at":"2024-10-15T18:40:16.764Z","updated_at":"2026-01-21T16:33:35.290Z","avatar_url":"https://github.com/nickshine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# glt\n\n\n[![pipeline status](https://gitlab.com/nickshine/glt/badges/master/pipeline.svg)](https://gitlab.com/nickshine/glt/commits/master)\n[![coverage report](https://gitlab.com/nickshine/glt/badges/master/coverage.svg)](https://gitlab.com/nickshine/glt/commits/master)\n[![npm](https://img.shields.io/npm/v/glt.svg)](https://www.npmjs.com/package/glt)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)\n\nhttps://gitlab.com/nickshine/glt\n\n\u003eA command-line interface for GitLab tasks.\n\n---\n\n* [Install](#install)\n* [Usage](#usage)\n* [Tasks](#tasks)\n  * [`glt ci cancel`](#glt-ci-cancel)\n  * [`glt env clean`](#glt-env-clean)\n  * [`glt env stop`](#glt-env-stop)\n* [Examples](#examples)\n  * [Cancel Redundant Pipelines From GitLab CI](#cancel-running-pipelines)  \n  * [Cancel Running Pipelines](#cancel-running-pipelines)\n  * [Stop Environments Older than One Week From GitLab CI](#stop-environments-older-than-one-week-from-gitlab-ci)\n* [Contributing](#contributing)\n\n## Install\n\n```bash\nnpm install -g glt\n\n# or\nnpx glt\n```\n## Usage\n\n#### `glt`\n\n```\nUsage: glt [options] [command]\n\nA cli for GitLab tasks\n\nOptions:\n  -V, --version  output the version number\n  -h, --help     output usage information\n\nCommands:\n  ci             perform GitLab CI tasks\n  env            perform tasks on GitLab environments\n  help [cmd]     display help for [cmd]\n```\n\n#### `glt ci`\n\n```\nUsage: glt-ci [options] [command]\n\nperform GitLab CI tasks\n\nOptions:\n  -h, --help  output usage information\n\nCommands:\n  cancel      cancel pipelines\n  help [cmd]  display help for [cmd]\n\n```\n\n#### `glt env`\n\n```\nUsage: glt-env [options] [command]\n\nperform tasks on GitLab Environments\n\nOptions:\n  -h, --help  output usage information\n\nCommands:\n  clean       clean environments\n  stop        stop environments\n  help [cmd]  display help for [cmd]\n```\n\n## Tasks\n\n#### `glt ci cancel`\n\n```\n➜  glt ci cancel --help\n\nUsage: glt-ci-cancel [options]\n\ncancel pipelines\n\nOptions:\n  -u, --url \u003curl\u003e         GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')\n  -t, --token \u003ctoken\u003e     GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')\n  -v, --verbose           make the operation more talkative\n  -p, --project-id \u003cid\u003e   GitLab project id (default: '$CI_PROJECT_ID')\n  -i, --pipeline-id \u003cid\u003e  cancel pipelines before pipeline id \u003cid\u003e (default: '$CI_PIPELINE_ID')\n  -b, --ref \u003cref\u003e         only look at pipelines on branch \u003cref\u003e (default: '$CI_COMMIT_REF_NAME' || 'master')\n  -h, --help              output usage information\n```\n\n__Description:__ cancel any previously-running pipelines on the given branch.\nThis task is intended to be run in a GitLab CI pipeline to reference `CI_PIPELINE_ID` as the\ncurrently running pipeline.\n\n__Use Case:__ GitLab CI currently (as of 11.x) only has the option\nto auto-cancel __pending__ non-HEAD pipelines on a branch. This task is useful\nfor controlling runner availability for redundant __running__ pipelines on a\nbranch.\n\n#### `glt env clean`\n\n```bash\nUsage: glt-env-clean [options]\n\nclean environments (delete environments with zero deployments)\n\nOptions:\n  -u, --url \u003curl\u003e        GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')\n  -t, --token \u003ctoken\u003e    GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')\n  -v, --verbose          make the operation more talkative\n  -p, --project-id \u003cid\u003e  GitLab project id (default: '$CI_PROJECT_ID')\n  -h, --help             output usage information\n```\n\n__Description:__ remove any existing environments that are \"empty\"\n(environments with zero deployments).\n\n__Use Case:__ Projects that have optional pipelines configured (with a manual\nplay button trigger) will generate __empty environments__ for each commit pushed\nthat is not executed/deployed, creating lots of \"empty\" environments that need\nto be deleted.\n\n#### `glt env stop`\n\n```bash\nUsage: glt-env-stop [options]\n\nstop environments with deployments older than a specified age\n\nOptions:\n  -u, --url \u003curl\u003e        GitLab instance (default: '$GITLAB_URL' || 'https://gitlab.com')\n  -t, --token \u003ctoken\u003e    GitLab Personal Access Token used to authenticate with the API (default: '$GITLAB_TOKEN'|| '$CI_JOB_TOKEN')\n  -v, --verbose          make the operation more talkative\n  -p, --project-id \u003cid\u003e  GitLab project id (default: '$CI_PROJECT_ID')\n  -a, --age \u003cage\u003e        stop environmments with deployments older than \u003cage\u003e (default: \"1w\")\n  -h, --help             output usage information\n```\n\n__Description:__ stop environments that only have deployments older than a specified age.\n\n__Use Case:__ Projects utilizing dynamic environments via the [Gitlab Review Apps][review-apps] \nfeature may need to control environment quotas by forcing an environment of a\ncertain age to be stopped and [cleaned up][auto-stopping-env].\n\n## Examples\n\n##### Cancel Redundant Pipelines From GitLab CI\n\nIn a GitLab CI pipeline, the following example will use GitLab [Predefined environment variables][predefined-vars] to cancel any redundant running pipelines before executing tests. Running pipelines older than `CI_PIPELINE_ID` on project `CI_PROJECT_ID` for the the current branch `CI_COMMIT_REF_NAME` will be canceled using a provided [Personal Access Token][access-tokens] set on environment variable `GITLAB_TOKEN`.\n\n```yaml\nimage: node:10\n\nstages:\n  - test\n\nvariables:\n  GITLAB_TOKEN: $ACCESS_TOKEN       # ACCESS_TOKEN stored in project env vars\n\ntest:\n  stage: test\n  script:\n    - npx glt ci cancel -v\n    - npm install\n    - npm run test\n```\n\n##### Cancel Running Pipelines\n\nThis example cancels all running pipelines on a branch `my-branch` for a project\nat https://gitlab.com. This is run outside of a GitLab CI pipeline, using the\ncommand-line flags:\n\n```bash\n\nTOKEN=\u003cpersonal access token\u003e\nPROJECT_ID=\u003cproject id from gitlab.com\u003e\n\n\nnpm install -g glt\n\nglt ci cancel -t $TOKEN -p $PROJECT_ID -b my-branch -v\n\n```\n\n##### Stop Environments Older than One Week From GitLab CI\n\nIn a GitLab CI pipeline, the following example will stop environments with no\ndeployments younger than 1 week old on project `CI_PROJECT_ID` using a provided\n[Personal Access Token][access-tokens] set on environment variable `GITLAB_TOKEN`.\n\n```yaml\nimage: node:10\n\nstages:\n  - test\n\nvariables:\n  GITLAB_TOKEN: $ACCESS_TOKEN       # ACCESS_TOKEN stored in project env vars\n\ndeploy:\n  stage: deploy\n  script:\n    - npx glt env stop -a 1w\n    - kubectl apply -f deployment.yaml\n```\n\n## Contributing\n\nContributions are welcome! Help add tasks to `glt`! See the [Contributing Guide](CONTRIBUTING.md).\n\n[predefined-vars]:https://docs.gitlab.com/ee/ci/variables/#predefined-environment-variables\n[access-tokens]:https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html\n[review-apps]:https://docs.gitlab.com/ee/ci/review_apps/\n[auto-stopping-env]:https://docs.gitlab.com/ee/ci/environments.html#automatically-stopping-an-environment\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickshine%2Fglt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickshine%2Fglt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickshine%2Fglt/lists"}