Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitlab-pipeline-cleaner

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitlab-pipeline-cleaner - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

31

index.js

@@ -13,4 +13,5 @@ #!/usr/bin/env node

.version('0.0.1', '-v, --version', 'output the current version')
.option('-d, --debug', 'Output extra debugging')
.option('-g, --gitlab <string>', 'GitLab URL', 'https://gitlab.com')
.option('-d, --days <number>', 'Number of days to keep', 365)
.option('--days <number>', 'Number of days to keep', 365)
.option('--updated_after <number>', 'Pipelines updated after the specified date (ISO 8601)')

@@ -49,9 +50,11 @@ .option('--updated_before <number>', 'Pipelines updated before the specified date (ISO 8601)')

try {
log(chalk.green(`GitLab - Delete old pipelines 🗑`));
log(chalk.gray(`GitLab URL: ${options.gitlab}`));
if (options.updated_after) log(chalk.gray(`After: ${options.updated_after.toDateString()}`));
if (options.updated_before) log(chalk.gray(`Before: ${options.updated_before.toDateString()}`));
if (options.status) log(chalk.gray(`Status: ${options.status}`));
if (options.limit) log(chalk.gray(`Limit: ${options.limit} per page`));
log(chalk.green(`GitLab - Delete old pipelines`));
if (options.debug) {
log(chalk.gray(`GitLab URL: ${options.gitlab}`));
if (options.updated_after) log(chalk.gray(`After: ${options.updated_after.toDateString()}`));
if (options.updated_before) log(chalk.gray(`Before: ${options.updated_before.toDateString()}`));
if (options.status) log(chalk.gray(`Status: ${options.status}`));
if (options.limit) log(chalk.gray(`Limit: ${options.limit} per page`));
}

@@ -67,6 +70,10 @@ // search params

log(chalk.green(`${chalk.bold(pipelines.length)} pipelines found`));
log(chalk.gray(`${chalk.bold(pipelines.length)} pipelines found`));
for (const pipeline of pipelines) {
log(chalk.gray(`Deleting pipeline ${pipeline.id}`));
if (options.debug) {
log(chalk.gray(`> Deleting pipeline ID=${pipeline.id}`));
log(chalk.gray(`> Status: ${pipeline.status}`));
log(chalk.gray(`> URL: ${pipeline.web_url}`));
log(chalk.gray(`> Updated at: ${new Date(pipeline.updated_at).toISOString()}`));
}

@@ -76,5 +83,5 @@ const response = await api.delete(`projects/${options.project}/pipelines/${pipeline.id}`);

if (response.status === 204) {
log(chalk.green(`Pipeline ${pipeline.id} deleted ✅`));
log(chalk.green(`[✓] Pipeline ${pipeline.id} deleted`));
} else {
log(chalk.red(`An error has occured: ${response.status}`));
log(chalk.red(`An error has occured while deleting pipeline ${pipeline.id}`));
}

@@ -81,0 +88,0 @@ }

@@ -20,3 +20,3 @@ {

},
"version": "0.0.1"
"version": "0.0.2"
}

@@ -12,4 +12,5 @@ # GitLab (old) pipeline cleaner

-v, --version output the current version
-d, --debug Output extra debugging
-g, --gitlab <string> GitLab URL (default: "https://gitlab.com")
-d, --days <number> Number of days to keep (default: 365)
--days <number> Number of days to keep (default: 365)
--updated_after <number> Pipelines updated after the specified date (ISO 8601)

@@ -16,0 +17,0 @@ --updated_before <number> Pipelines updated before the specified date (ISO 8601)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc