artifactory-cleaner 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec_status +36 -36
- data/CHANGELOG.md +6 -0
- data/README.md +12 -11
- data/artifactory-cleaner.gemspec +11 -8
- data/lib/artifactory/cleaner.rb +4 -0
- data/lib/artifactory/cleaner/controller.rb +10 -2
- data/lib/artifactory/cleaner/version.rb +1 -1
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8f191ca45a0ea66d0480979833c31cd49791f48827a0f1dcf4fc448f77439c
|
4
|
+
data.tar.gz: b88061a130eeca42b6d0bc1d4e5afb929cb4564838e3db32cf3bb4e6b237ef82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4ff58daaa54d2a65dba4b88acb631feaab36fb6ed0459d509eb9fc2d1efed4d6d1a7ef781ff5ff465507963f75860171cd543d38d384a0423a1d8a6c1871481
|
7
|
+
data.tar.gz: 729916e7daf5baafac2863c326ed7de012ea63cb05969d6a99410cbd51532dc7cbf13605c2be92dbdf28b3dbfc7cd93b86e807101c5d4568497643486fd0db27
|
data/.rspec_status
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
-------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/artifactory/cleaner_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/artifactory/cleaner_spec.rb[1:2:1] | passed | 0.
|
3
|
+
./spec/artifactory/cleaner_spec.rb[1:1] | passed | 0.00072 seconds |
|
4
|
+
./spec/artifactory/cleaner_spec.rb[1:2:1] | passed | 0.00106 seconds |
|
5
5
|
./spec/artifactory/cleaner_spec.rb[1:2:2] | passed | 0.00011 seconds |
|
6
|
-
./spec/artifactory/cleaner_spec.rb[1:2:3] | passed | 0.
|
7
|
-
./spec/artifactory/cleaner_spec.rb[1:2:4] | passed | 0.
|
8
|
-
./spec/artifactory/cleaner_spec.rb[1:2:5] | passed | 0.
|
9
|
-
./spec/artifactory/cleaner_spec.rb[1:2:6] | passed | 0.
|
10
|
-
./spec/artifactory/cleaner_spec.rb[1:2:7:1] | passed | 0.
|
11
|
-
./spec/artifactory/cleaner_spec.rb[1:2:7:2] | passed | 0.
|
12
|
-
./spec/artifactory/cleaner_spec.rb[1:2:7:3] | passed | 0.
|
13
|
-
./spec/artifactory/cleaner_spec.rb[1:2:7:4] | passed | 0.
|
14
|
-
./spec/artifactory/cleaner_spec.rb[1:2:7:5] | passed | 0.
|
15
|
-
./spec/artifactory/cleaner_spec.rb[1:3:1] | passed | 0.
|
16
|
-
./spec/artifactory/cleaner_spec.rb[1:3:2] | passed | 0.
|
17
|
-
./spec/artifactory/cleaner_spec.rb[1:3:3] | passed | 0.
|
18
|
-
./spec/artifactory/cleaner_spec.rb[1:3:4] | passed | 0.
|
19
|
-
./spec/artifactory/cleaner_spec.rb[1:3:5] | passed | 0.
|
20
|
-
./spec/artifactory/cleaner_spec.rb[1:3:6] | passed | 0.
|
21
|
-
./spec/artifactory/cleaner_spec.rb[1:3:7] | passed | 0.
|
22
|
-
./spec/artifactory/cleaner_spec.rb[1:3:8] | passed | 0.
|
23
|
-
./spec/artifactory/cleaner_spec.rb[1:3:9] | passed | 0.
|
24
|
-
./spec/artifactory/cleaner_spec.rb[1:3:10:1] | passed | 0.
|
25
|
-
./spec/artifactory/cleaner_spec.rb[1:3:11:1] | passed | 0.
|
26
|
-
./spec/artifactory/cleaner_spec.rb[1:4:1] | passed | 0.
|
27
|
-
./spec/artifactory/cleaner_spec.rb[1:5:1] | passed | 0.
|
28
|
-
./spec/artifactory/cleaner_spec.rb[1:5:2] | passed | 0.
|
29
|
-
./spec/artifactory/cleaner_spec.rb[1:5:3] | passed | 0.
|
30
|
-
./spec/artifactory/cleaner_spec.rb[1:5:4] | passed | 0.
|
31
|
-
./spec/artifactory/cleaner_spec.rb[1:5:5] | passed | 0.
|
32
|
-
./spec/artifactory/cleaner_spec.rb[1:5:6] | passed | 0.
|
33
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:1] | passed | 0.
|
34
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:2] | passed | 0.
|
35
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:3] | passed | 0.
|
36
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:4] | passed | 0.
|
37
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:5] | passed | 0.
|
38
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:6] | passed | 0.
|
39
|
-
./spec/artifactory/cleaner_spec.rb[1:5:7:7] | passed | 0.
|
6
|
+
./spec/artifactory/cleaner_spec.rb[1:2:3] | passed | 0.00007 seconds |
|
7
|
+
./spec/artifactory/cleaner_spec.rb[1:2:4] | passed | 0.00006 seconds |
|
8
|
+
./spec/artifactory/cleaner_spec.rb[1:2:5] | passed | 0.00009 seconds |
|
9
|
+
./spec/artifactory/cleaner_spec.rb[1:2:6] | passed | 0.0005 seconds |
|
10
|
+
./spec/artifactory/cleaner_spec.rb[1:2:7:1] | passed | 0.00015 seconds |
|
11
|
+
./spec/artifactory/cleaner_spec.rb[1:2:7:2] | passed | 0.00103 seconds |
|
12
|
+
./spec/artifactory/cleaner_spec.rb[1:2:7:3] | passed | 0.00026 seconds |
|
13
|
+
./spec/artifactory/cleaner_spec.rb[1:2:7:4] | passed | 0.00005 seconds |
|
14
|
+
./spec/artifactory/cleaner_spec.rb[1:2:7:5] | passed | 0.00007 seconds |
|
15
|
+
./spec/artifactory/cleaner_spec.rb[1:3:1] | passed | 0.0001 seconds |
|
16
|
+
./spec/artifactory/cleaner_spec.rb[1:3:2] | passed | 0.00009 seconds |
|
17
|
+
./spec/artifactory/cleaner_spec.rb[1:3:3] | passed | 0.00006 seconds |
|
18
|
+
./spec/artifactory/cleaner_spec.rb[1:3:4] | passed | 0.00008 seconds |
|
19
|
+
./spec/artifactory/cleaner_spec.rb[1:3:5] | passed | 0.00006 seconds |
|
20
|
+
./spec/artifactory/cleaner_spec.rb[1:3:6] | passed | 0.00151 seconds |
|
21
|
+
./spec/artifactory/cleaner_spec.rb[1:3:7] | passed | 0.00013 seconds |
|
22
|
+
./spec/artifactory/cleaner_spec.rb[1:3:8] | passed | 0.00007 seconds |
|
23
|
+
./spec/artifactory/cleaner_spec.rb[1:3:9] | passed | 0.00206 seconds |
|
24
|
+
./spec/artifactory/cleaner_spec.rb[1:3:10:1] | passed | 0.00824 seconds |
|
25
|
+
./spec/artifactory/cleaner_spec.rb[1:3:11:1] | passed | 0.00905 seconds |
|
26
|
+
./spec/artifactory/cleaner_spec.rb[1:4:1] | passed | 0.00008 seconds |
|
27
|
+
./spec/artifactory/cleaner_spec.rb[1:5:1] | passed | 0.00008 seconds |
|
28
|
+
./spec/artifactory/cleaner_spec.rb[1:5:2] | passed | 0.00005 seconds |
|
29
|
+
./spec/artifactory/cleaner_spec.rb[1:5:3] | passed | 0.00005 seconds |
|
30
|
+
./spec/artifactory/cleaner_spec.rb[1:5:4] | passed | 0.00005 seconds |
|
31
|
+
./spec/artifactory/cleaner_spec.rb[1:5:5] | passed | 0.00005 seconds |
|
32
|
+
./spec/artifactory/cleaner_spec.rb[1:5:6] | passed | 0.00005 seconds |
|
33
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:1] | passed | 0.00006 seconds |
|
34
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:2] | passed | 0.00011 seconds |
|
35
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:3] | passed | 0.00005 seconds |
|
36
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:4] | passed | 0.00024 seconds |
|
37
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:5] | passed | 0.00008 seconds |
|
38
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:6] | passed | 0.00006 seconds |
|
39
|
+
./spec/artifactory/cleaner_spec.rb[1:5:7:7] | passed | 0.00006 seconds |
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@ Artifactory Cleaner CHANGELOG
|
|
2
2
|
=============================
|
3
3
|
This file describes the changes made in each release of `artifactory-cleaner`
|
4
4
|
|
5
|
+
## v1.0.5 (May 29, 2020)
|
6
|
+
|
7
|
+
- Check size of archived artifacts to ensure they downloaded properly
|
8
|
+
- Depend on `artifactory` gem v3.0.15 which properly follows HTTP redirects
|
9
|
+
- Gemspec cleanup
|
10
|
+
|
5
11
|
## v1.0.4 (May 29, 2020)
|
6
12
|
|
7
13
|
- Fix bug with accepting YAML filter files on the CLI
|
data/README.md
CHANGED
@@ -9,15 +9,13 @@ automation workflows.
|
|
9
9
|
|
10
10
|
### To use as a CLI command:
|
11
11
|
|
12
|
-
|
12
|
+
The gem can be installed using rubygems:
|
13
13
|
|
14
14
|
```bash
|
15
|
-
|
16
|
-
gem build artifactory-cleaner.gemspec
|
17
|
-
sudo gem install artifactory-cleaner-*.gem
|
15
|
+
sudo gem install artifactory-cleaner
|
18
16
|
```
|
19
17
|
|
20
|
-
|
18
|
+
This will install the `artifactory-cleaner` command.
|
21
19
|
|
22
20
|
Full usage information is available using `artifactory-cleaner help`
|
23
21
|
|
@@ -25,17 +23,17 @@ The `artifactory-cleaner` CLI interface follows the same format as git: `artifac
|
|
25
23
|
|
26
24
|
Commands available are:
|
27
25
|
|
28
|
-
* `artifactory-cleaner archive` Given a specific set of
|
26
|
+
* `artifactory-cleaner archive` Given a specific set of criteria (and optionally a set of filters) download all artifacts
|
29
27
|
from specified repos to the local filesystem. *Note:* this will cause the `last_downloaded` date of all the artifacts
|
30
28
|
which are archived to be updated to the time the command is run, so they may no longer match your search criteria on
|
31
29
|
a subsequent run
|
32
|
-
* `artifactory-cleaner clean` delete old artifacts which meet a specific set of
|
30
|
+
* `artifactory-cleaner clean` delete old artifacts which meet a specific set of criteria (and optionally a set of filters)
|
33
31
|
from a given set of repos, with the ability to archive them to the local filesystem. This is Artifactory::Cleaner's
|
34
32
|
primry function: to reduce disk space usage by deleting old, unnecessary artifacts.
|
35
33
|
* `artifactory-cleaner list-repos` provides information about available repositories in Artifactory. Can be used in
|
36
|
-
pipelines with the `-H` flag, or can be used to query
|
34
|
+
pipelines with the `-H` flag, or can be used to query repository information in human-readable columns.
|
37
35
|
* `artifactory-cleaner usage-report` analyze artifacts and produce a report detailing usage breakdown by date ranges,
|
38
|
-
optionally
|
36
|
+
optionally producing a detailed YAML report of all artifacts meeting search criteria
|
39
37
|
|
40
38
|
#### Authentication and Configuration
|
41
39
|
|
@@ -67,7 +65,10 @@ Execute `artifactory-cleaner help` for a usage statement
|
|
67
65
|
|
68
66
|
## Development
|
69
67
|
|
70
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
69
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
71
70
|
|
72
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
71
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
72
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
73
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
73
74
|
|
data/artifactory-cleaner.gemspec
CHANGED
@@ -10,18 +10,21 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Josh Gitlin"]
|
11
11
|
spec.email = ["jgitlin@pinnacle21.com"]
|
12
12
|
|
13
|
-
spec.summary = %q{Performs
|
14
|
-
spec.description =
|
15
|
-
|
13
|
+
spec.summary = %q{Performs maintenance tasks on Artifactory repositories}
|
14
|
+
spec.description = <<~END_OF_SPEC_DESCRIPTION
|
15
|
+
`artifactory-cleaner` is a Ruby Gem and CLI interface for performing maintenance tasks on a JFrog Artifactory
|
16
|
+
instance. It is capable of analyzing storage usage and producing reports showing space usage based on artifact age.
|
17
|
+
It can then archive and delete from artifactory repos based on age/last download date with a highly configurable
|
18
|
+
inclusion/exclusion list.
|
19
|
+
END_OF_SPEC_DESCRIPTION
|
20
|
+
spec.homepage = "https://github.com/jgitlin-p21/artifactory-cleaner"
|
16
21
|
spec.license = 'MIT'
|
17
22
|
spec.licenses = ['MIT']
|
18
23
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
#spec.metadata["homepage_uri"] = spec.homepage
|
25
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
26
|
spec.metadata["source_code_uri"] = "https://bitbucket.org/pinnacle21/artifactory-cleaner/src/master/"
|
24
|
-
|
27
|
+
spec.metadata["changelog_uri"] = "https://raw.githubusercontent.com/jgitlin-p21/artifactory-cleaner/master/CHANGELOG.md"
|
25
28
|
|
26
29
|
spec.add_development_dependency "cucumber", '~> 1.3', '>= 1.3.20'
|
27
30
|
spec.add_development_dependency "aruba", '~> 0.14'
|
@@ -30,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
30
33
|
spec.add_dependency "thor", '~> 1.0.1'
|
31
34
|
spec.add_dependency "sysexits", '>= 1.2.0'
|
32
35
|
|
33
|
-
spec.add_dependency "artifactory", '~> 3.0.
|
36
|
+
spec.add_dependency "artifactory", '~> 3.0.15'
|
34
37
|
|
35
38
|
# Specify which files should be added to the gem when it is released.
|
36
39
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/artifactory/cleaner.rb
CHANGED
@@ -345,15 +345,23 @@ module Artifactory
|
|
345
345
|
# specified by the `path` param
|
346
346
|
#
|
347
347
|
# **Note:** Downloading an artifact will update the artifact's last_downloaded date so it may no longer match the
|
348
|
-
# same search criteria it originally die (if
|
348
|
+
# same search criteria it originally die (if last_downloaded was used to discover this artifact)
|
349
349
|
#
|
350
350
|
# This method is meant to be used prior to calling `delete_artifact`
|
351
351
|
def archive_artifact(artifact, path)
|
352
|
+
path = File.dirname(File.join(path, URI.parse(artifact.download_uri).path.split( artifact.repo )[1]))
|
353
|
+
|
352
354
|
debuglog "[DEBUG] downloading #{artifact} (#{artifact.uri}) to #{path}"
|
355
|
+
archived_file = nil
|
353
356
|
timing = Benchmark.measure do
|
354
|
-
artifact.download(path)
|
357
|
+
archived_file = artifact.download(path)
|
355
358
|
end
|
359
|
+
|
356
360
|
debuglog "[DEBUG] #{artifact.uri} #{Util.filesize artifact.size} downloaded in #{timing.real.round(2)} seconds (#{Util.filesize(artifact.size/timing.real)})/s"
|
361
|
+
|
362
|
+
raise ArchiveFileNotWritten, "Failed to write to #{archived_file}" unless File.exist? archived_file
|
363
|
+
raise ArchiveFileNotWritten, "Archive file is empty: #{archived_file}" unless File.size? archived_file
|
364
|
+
raise ArchiveFileSizeMismatch, "#{path} size mismatch (#{File.size(archived_file)} != #{artifact.size})" unless File.size(archived_file) == artifact.size
|
357
365
|
end
|
358
366
|
|
359
367
|
##
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artifactory-cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Gitlin
|
@@ -92,16 +92,19 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 3.0.
|
95
|
+
version: 3.0.15
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 3.0.
|
103
|
-
description:
|
104
|
-
|
102
|
+
version: 3.0.15
|
103
|
+
description: |
|
104
|
+
`artifactory-cleaner` is a Ruby Gem and CLI interface for performing maintenance tasks on a JFrog Artifactory
|
105
|
+
instance. It is capable of analyzing storage usage and producing reports showing space usage based on artifact age.
|
106
|
+
It can then archive and delete from artifactory repos based on age/last download date with a highly configurable
|
107
|
+
inclusion/exclusion list.
|
105
108
|
email:
|
106
109
|
- jgitlin@pinnacle21.com
|
107
110
|
executables:
|
@@ -221,11 +224,13 @@ files:
|
|
221
224
|
- lib/artifactory/cleaner/discovery_worker.rb
|
222
225
|
- lib/artifactory/cleaner/util.rb
|
223
226
|
- lib/artifactory/cleaner/version.rb
|
224
|
-
homepage: https://
|
227
|
+
homepage: https://github.com/jgitlin-p21/artifactory-cleaner
|
225
228
|
licenses:
|
226
229
|
- MIT
|
227
230
|
metadata:
|
231
|
+
homepage_uri: https://github.com/jgitlin-p21/artifactory-cleaner
|
228
232
|
source_code_uri: https://bitbucket.org/pinnacle21/artifactory-cleaner/src/master/
|
233
|
+
changelog_uri: https://raw.githubusercontent.com/jgitlin-p21/artifactory-cleaner/master/CHANGELOG.md
|
229
234
|
post_install_message:
|
230
235
|
rdoc_options: []
|
231
236
|
require_paths:
|
@@ -241,8 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
246
|
- !ruby/object:Gem::Version
|
242
247
|
version: '0'
|
243
248
|
requirements: []
|
244
|
-
rubygems_version: 3.1.
|
249
|
+
rubygems_version: 3.1.3
|
245
250
|
signing_key:
|
246
251
|
specification_version: 4
|
247
|
-
summary: Performs
|
252
|
+
summary: Performs maintenance tasks on Artifactory repositories
|
248
253
|
test_files: []
|