gitlab-artifacts-cleaner 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -9
- data/lib/gitlab/artifacts/cleaner/version.rb +1 -1
- data/lib/gitlab/artifacts/cleaner.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697394952a6cebb52b685ba54e9be18d01d07133d39997d5b59a2fbfa1e2d1af
|
4
|
+
data.tar.gz: 76439ac5e63dbf2fca78a54a15980b8926b2edc1f47b99ec239d029134fa7121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e8598e7e2292896ff8c3df3cdd3b8bdb1442e42874535ff8784afb1d7efc2de5ba22bbd708763c6665bd9fe522b8966b56ae92da8d04c9be8f90adf6b0fc93
|
7
|
+
data.tar.gz: 369e0023dec599ebb9222c802226325f613abac55cbdf43d2909ee7bcda1fa9b9c4b2504518abd2d8b436b2715dfc3c1ac996e1601400fb5f3ff52b0148a58a5
|
data/README.md
CHANGED
@@ -2,14 +2,6 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitlab/artifacts/cleaner`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
Command:
|
6
|
-
|
7
|
-
`gitlab-artifacts-cleaner <API-route> <Private-Token> <Older-than>`
|
8
|
-
|
9
|
-
Example:
|
10
|
-
|
11
|
-
`gitlab-artifacts-cleaner https://gitlab.com/api/v4/projects/123456 XXXXXXXXXX 2015-12-24T15:51:21.727Z`
|
12
|
-
|
13
5
|
## Installation
|
14
6
|
|
15
7
|
Add this line to your application's Gemfile:
|
@@ -28,7 +20,13 @@ Or install it yourself as:
|
|
28
20
|
|
29
21
|
## Usage
|
30
22
|
|
31
|
-
|
23
|
+
Command:
|
24
|
+
|
25
|
+
`gitlab-artifacts-cleaner <API-route> <Private-Token> <Older-than>`
|
26
|
+
|
27
|
+
Example:
|
28
|
+
|
29
|
+
`gitlab-artifacts-cleaner https://gitlab.com/api/v4/projects/123456 XXXXXXXXXX 2019-08-20T15:51:21.727Z`
|
32
30
|
|
33
31
|
## Development
|
34
32
|
|
@@ -8,19 +8,20 @@ module Gitlab
|
|
8
8
|
|
9
9
|
def execute
|
10
10
|
@api_route, @priavte_token, @older_than = ARGV
|
11
|
-
@current_page =
|
11
|
+
@current_page = 1
|
12
12
|
@older_than = Time.parse(@older_than)
|
13
13
|
@total_count = 0
|
14
14
|
|
15
15
|
raise 'Insufficient arguments' unless @api_route && @priavte_token && @older_than
|
16
16
|
|
17
|
-
|
17
|
+
while jobs = get_job_list!
|
18
18
|
puts "@current_page: #{@current_page}"
|
19
19
|
|
20
20
|
old_jobs = jobs.select { |job| Time.parse(job['created_at']) < @older_than }
|
21
21
|
|
22
22
|
old_jobs.each do |job|
|
23
23
|
job_id = job['id']
|
24
|
+
puts "job_id: #{job_id} message: deleting job artifacts"
|
24
25
|
delete_job_artifact!(job_id)
|
25
26
|
puts "job_id: #{job_id} message: deleted job artifacts"
|
26
27
|
@total_count += 1
|