gitlab-janitor 1.0.2.92951 → 1.0.4.94864
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -5
- data/README.md +11 -2
- data/lib/gitlab_janitor/cache_cleaner.rb +16 -2
- data/lib/gitlab_janitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6e5caf266616a88fc24a9cb28066cd41881281c1a0bd8ead2fee6ff84265366
|
4
|
+
data.tar.gz: 285aeb0635b8a80d773d2f1c78b7e81dae329f41bd9d40587b22f221a1f3d995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2617c7beb9b97853f39c9d92eb8c602a5ea1db3fc4d06bd646564024f968205da3cf6096d563b05039f4d7e8d51b88fc33f2f8c0bff8b2866ed8188e7524eaf
|
7
|
+
data.tar.gz: 400cb9f7630972599c88af849bbeb598f9217095ffcf993c3931f7af347d30fef4d35c9a6e691f62fc3bb6423056b9156dc43f99b7a951f2d4f787fa432d73f0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitlab-janitor (1.0.
|
4
|
+
gitlab-janitor (1.0.4.94864)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
docker-api
|
7
7
|
fugit
|
@@ -34,12 +34,12 @@ GEM
|
|
34
34
|
raabro (~> 1.4)
|
35
35
|
i18n (1.12.0)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
minitest (5.16.
|
37
|
+
minitest (5.16.3)
|
38
38
|
multi_json (1.15.0)
|
39
39
|
optparse (0.2.0)
|
40
40
|
raabro (1.4.0)
|
41
41
|
rake (13.0.6)
|
42
|
-
redis (4.
|
42
|
+
redis (4.8.0)
|
43
43
|
rspec (3.11.0)
|
44
44
|
rspec-core (~> 3.11.0)
|
45
45
|
rspec-expectations (~> 3.11.0)
|
@@ -69,12 +69,13 @@ GEM
|
|
69
69
|
unicode-display_width (>= 1.1.1, < 3)
|
70
70
|
tzinfo (2.0.5)
|
71
71
|
concurrent-ruby (~> 1.0)
|
72
|
-
tzinfo-data (1.2022.
|
72
|
+
tzinfo-data (1.2022.3)
|
73
73
|
tzinfo (>= 1.0.0)
|
74
74
|
unicode-display_width (2.2.0)
|
75
75
|
zeitwerk (2.6.0)
|
76
76
|
|
77
77
|
PLATFORMS
|
78
|
+
ruby
|
78
79
|
x86_64-linux
|
79
80
|
|
80
81
|
DEPENDENCIES
|
@@ -88,4 +89,4 @@ DEPENDENCIES
|
|
88
89
|
simplecov-console
|
89
90
|
|
90
91
|
BUNDLED WITH
|
91
|
-
2.3.
|
92
|
+
2.3.20
|
data/README.md
CHANGED
@@ -6,9 +6,18 @@
|
|
6
6
|
[![Gem](https://img.shields.io/gem/dt/gitlab-janitor.svg)](https://rubygems.org/gems/gitlab-janitor/versions)
|
7
7
|
[![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/gitlab-janitor)
|
8
8
|
|
9
|
+
|
10
|
+
[![quality](https://lysander.rnds.pro/api/v1/badges/janitor_quality.svg)](https://lysander.rnds.pro/api/v1/badges/janitor_quality.html)
|
11
|
+
[![outdated](https://lysander.rnds.pro/api/v1/badges/janitor_outdated.svg)](https://lysander.rnds.pro/api/v1/badges/janitor_outdated.html)
|
12
|
+
[![vulnerable](https://lysander.rnds.pro/api/v1/badges/janitor_vulnerable.svg)](https://lysander.rnds.pro/api/v1/badges/janitor_vulnerable.html)
|
13
|
+
|
14
|
+
|
15
|
+
|
9
16
|
[![Docker Pulls](https://badgen.net/docker/pulls/rnds/gitlab-janitor?icon=docker&label=pulls)](https://hub.docker.com/r/rnds/gitlab-janitor/)
|
10
17
|
[![Docker Stars](https://badgen.net/docker/stars/rnds/gitlab-janitor?icon=docker&label=stars)](https://hub.docker.com/r/rnds/gitlab-janitor/)
|
11
18
|
|
19
|
+
|
20
|
+
|
12
21
|
</div>
|
13
22
|
|
14
23
|
Gitlab Janitor это утилита для автоматической очистки зависших и брошенных ресурсов при использовании Docker в `Gitlab` CI/CD. Проект вдохновлён утилитой [GitLab Runner Docker Cleanup](https://gitlab.com/gitlab-org/gitlab-runner-docker-cleanup).
|
@@ -67,7 +76,7 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock rnds/gitlab-janitor
|
|
67
76
|
|
68
77
|
## Документация / Documentation
|
69
78
|
|
70
|
-
Параметры командной строки, переменные окружения и
|
79
|
+
Параметры командной строки, переменные окружения и значения по-умолчанию:
|
71
80
|
|
72
81
|
Commain line options, environment variables and default values:
|
73
82
|
|
@@ -94,7 +103,7 @@ Usage: gitlab-janitor [options]
|
|
94
103
|
|
95
104
|
Порядок определения контейнреов для удаления:
|
96
105
|
|
97
|
-
- `include=[*units*]` - в список на удаление включаются контейнеры
|
106
|
+
- `include=[*units*]` - в список на удаление включаются контейнеры удовлетворяющие шаблону;
|
98
107
|
- `exclude=[*gitlab*]` - из спсика исключаются контейнеры по шаблону;
|
99
108
|
- `container-deadline=[1h10m]` - результирующий список проверяется на длительность запуска контенйра;
|
100
109
|
|
@@ -10,14 +10,28 @@ module GitlabJanitor
|
|
10
10
|
def do_clean(keep_size: '10G', remove: false)
|
11
11
|
logger.info 'Removing cache...'
|
12
12
|
if remove
|
13
|
-
|
14
|
-
|
13
|
+
prune_builder
|
14
|
+
prune_buildx
|
15
15
|
else
|
16
16
|
logger.info 'Skip removal due to dry run'
|
17
17
|
end
|
18
18
|
out, _status = Open3.capture2e('docker system df')
|
19
19
|
logger.info(out)
|
20
20
|
end
|
21
|
+
|
22
|
+
def prune_builder
|
23
|
+
out, _status = Open3.capture2e("docker builder prune --keep-storage #{keep_size} -f")
|
24
|
+
logger.info(out)
|
25
|
+
rescue StandardError =>e
|
26
|
+
logger.warn("Unable to clean BUILDER: #{e.inspect}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def prune_buildx
|
30
|
+
out, _status = Open3.capture2e("docker buildx prune --keep-storage #{keep_size} -f")
|
31
|
+
logger.info(out)
|
32
|
+
rescue StandardError =>e
|
33
|
+
logger.warn("Unable to clean BUILDX: #{e.inspect}")
|
34
|
+
end
|
21
35
|
|
22
36
|
end
|
23
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-janitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4.94864
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoilenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|