gitlab-artifacts-cleaner 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 902a17e7964201ad40287500007ee580994812233dedf0134c7653b65f8278fe
4
- data.tar.gz: e7ec95070030e0cdd0770f091189d7caa07227a0c37c3efcf29df945f9ddc8d7
3
+ metadata.gz: 697394952a6cebb52b685ba54e9be18d01d07133d39997d5b59a2fbfa1e2d1af
4
+ data.tar.gz: 76439ac5e63dbf2fca78a54a15980b8926b2edc1f47b99ec239d029134fa7121
5
5
  SHA512:
6
- metadata.gz: 6a24ae309468c719fb58c79fcf1687962c8e0e7a5faea3f2aff0965078b7f5a4226c81ee638300f839bf50ed24a24666e5805c6ab53dccec1ac00283b625538c
7
- data.tar.gz: 7440cdf1d2cf6c7b9f8d5839a55e4c08e48b912f0be9ecbffce6a54a18cd4fed6504235a8a50f4572d516ec983990df2e8a0bee1a90e3ba9486c23257b592334
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
- TODO: Write usage instructions here
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
 
@@ -1,7 +1,7 @@
1
1
  module Gitlab
2
2
  module Artifacts
3
3
  module Cleaner
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -8,19 +8,20 @@ module Gitlab
8
8
 
9
9
  def execute
10
10
  @api_route, @priavte_token, @older_than = ARGV
11
- @current_page = 1000000
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
- until jobs = get_job_list!
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-artifacts-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinya Maeda