mirror of
https://github.com/thegeeklab/docker-tidy.git
synced 2024-11-16 17:50:39 +00:00
Compare commits
229 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
61b586a41e | ||
|
75f244d62a | ||
cfa63766d4 | |||
|
c5847b4f2f | ||
|
0d23038b96 | ||
|
6cc50cab6d | ||
|
facbba7bce | ||
|
a3a6ff8501 | ||
|
2a8b5ab47e | ||
|
7dc2294a37 | ||
|
99160772be | ||
|
31754197c6 | ||
c9e5c4ec49 | |||
|
9637b3aa3f | ||
|
6756e50a2b | ||
|
791261dfe0 | ||
|
d4cda4c96e | ||
|
2aa662e4ab | ||
d9fac61721 | |||
|
50b29582a2 | ||
7145f46411 | |||
|
ada8379c7f | ||
|
2b65019281 | ||
|
4107d54e5a | ||
|
ce98ff48ad | ||
|
425451edba | ||
|
588458f921 | ||
|
6c74656363 | ||
|
a70f67cda3 | ||
|
a92e91904d | ||
|
6ce60bd579 | ||
|
805b2b289a | ||
|
eb783d2f7a | ||
|
d762158829 | ||
|
698ebb904f | ||
|
147582209b | ||
|
9bb6841da7 | ||
|
8fba3dca3b | ||
|
26239b409f | ||
|
3a02efb4b1 | ||
|
c0baa946c9 | ||
|
e0d43b20cd | ||
|
a45bba0347 | ||
|
b15c4f2133 | ||
|
15e6278156 | ||
|
98490d06d0 | ||
|
190bb2fa1f | ||
|
e8f9731a30 | ||
|
79606bf19e | ||
|
56eac8af21 | ||
|
4b561a38c9 | ||
|
4acc8d7dd6 | ||
|
f2322312c9 | ||
8b1da64f4f | |||
|
28cbf3b60a | ||
|
7751a4ad74 | ||
|
ce949a87be | ||
|
9f0f1c10a9 | ||
|
e71bda050b | ||
|
23b42be628 | ||
|
d754500b0e | ||
|
491bd1875f | ||
|
d27fc50d2d | ||
|
9b04502097 | ||
|
19db149f1b | ||
|
014627b564 | ||
|
1e5d6b8df9 | ||
|
e9185cdaa6 | ||
|
a7770ea08d | ||
|
f67f112433 | ||
|
4cfd618987 | ||
|
157dabfeff | ||
|
fcfb9e3410 | ||
|
5cf6abb8dd | ||
|
515b0e3163 | ||
|
43f76d51ae | ||
|
7c6b4c7c40 | ||
|
651af74296 | ||
|
1d70cd3017 | ||
|
0130a3a7b0 | ||
|
ca54d039d3 | ||
|
c0cc3c1434 | ||
|
255330f547 | ||
|
67d17dbac4 | ||
|
a809e20900 | ||
|
16acc8f500 | ||
|
27f88e07f6 | ||
|
fbf727c593 | ||
|
53d324c747 | ||
|
acb91fe39b | ||
|
433b8ce2aa | ||
|
724e14c741 | ||
|
c5d50cf47a | ||
|
ae9a16c898 | ||
|
635cd51a17 | ||
|
77ca9f62d2 | ||
|
40e2f72fb0 | ||
|
5a4a9dc879 | ||
|
0a8780c381 | ||
|
c0b496943f | ||
|
393887fbb5 | ||
|
6555f4add6 | ||
|
eee7a5a1ff | ||
|
9f31bfdf9e | ||
|
9596da32c9 | ||
|
d15499b120 | ||
|
da587cdaf1 | ||
|
2e78717804 | ||
|
7e2c68c8fe | ||
|
5a98f7127d | ||
|
9701519a85 | ||
|
01293f3634 | ||
|
cbddcedb62 | ||
|
4be97eb542 | ||
|
3e644aa33d | ||
|
a86f86e3a1 | ||
|
95e7ee4471 | ||
|
73d739831a | ||
|
44599113ab | ||
|
1b33fc3b74 | ||
|
83a32d14c6 | ||
63ca6e6bdb | |||
|
1e557bd253 | ||
|
32da9eb537 | ||
|
1d19939b68 | ||
|
233b29a8cd | ||
|
90876dc452 | ||
|
9d2503fb30 | ||
|
ec6ff19057 | ||
|
fc31bd26c2 | ||
|
8d9c9a5f5f | ||
|
6a80f83587 | ||
e261307149 | |||
|
f69a97b61c | ||
84a3d303ed | |||
|
24a8388cb1 | ||
|
3a47080078 | ||
7dbd1158c6 | |||
|
536752a83e | ||
|
f334c0da1e | ||
|
fc02a0071a | ||
|
9ce45bf75b | ||
|
9a5c025d7c | ||
|
95e5f2ac4a | ||
|
48e90b3fa8 | ||
|
72f6b0e758 | ||
|
b684cb042f | ||
|
e280fd4395 | ||
|
824b850e57 | ||
|
5fb5fbb2e5 | ||
|
fc20bb4de0 | ||
|
df1c82beac | ||
|
c81a2b7dca | ||
|
5e7b78b181 | ||
|
f957a5c41d | ||
|
194a793cb2 | ||
|
85a945b4ed | ||
|
bf8e7c5256 | ||
|
7a7df50721 | ||
|
535969d581 | ||
3eebffb06a | |||
525483e99c | |||
|
ea0468cc8d | ||
5063ba7d6b | |||
|
3ea1adfe03 | ||
|
ea56dc4f41 | ||
|
e0f99929c1 | ||
|
0a2257fb13 | ||
b1e15928ad | |||
|
f386910970 | ||
|
91fbaf9d9d | ||
|
a4643c714a | ||
|
d7b1253555 | ||
1c7b43fff0 | |||
|
d325e16548 | ||
|
7a7118aa75 | ||
|
042feaa792 | ||
|
39bca2ebf9 | ||
|
03437632ff | ||
|
9b6e622a84 | ||
|
7ac907ea02 | ||
|
4f6d92bbcc | ||
347e074e5b | |||
12f2428e9f | |||
|
2a3e1612f8 | ||
|
8a28ecefc6 | ||
71365ef471 | |||
|
ce3d0acfcd | ||
|
c51f8d1578 | ||
|
d27a1a974f | ||
|
5ac3434045 | ||
|
c976506e5a | ||
|
e1fab9e27e | ||
|
fed37cc7d0 | ||
|
b82fdfbeed | ||
|
06f21389bb | ||
|
54954fab7b | ||
|
56e140e146 | ||
|
f314885f99 | ||
|
985adf4614 | ||
|
ee06eff3f2 | ||
12cc05e53e | |||
b581e501da | |||
e91f10ae14 | |||
|
dd299ecf5c | ||
ea4bf4a218 | |||
4988cac525 | |||
|
7b82bbf871 | ||
|
3c6dcda7a6 | ||
|
a75380dcab | ||
|
3ea31f660b | ||
|
9bc9ef4d45 | ||
|
0ef523ceb7 | ||
|
2bebea17fd | ||
|
43c1180bee | ||
|
39c8ce5c2e | ||
|
fcee5e7f6f | ||
|
7ffd2d6ca7 | ||
|
a97d20c6ff | ||
8f4b694d7e | |||
|
15bface557 | ||
88cf97ee86 | |||
|
a4e893b5dd | ||
|
fe27327da5 | ||
|
544c0bf25b | ||
|
ff118d656a | ||
|
cca9765fa2 | ||
|
aa1b914f6b | ||
|
a265caa3ca |
@ -1,23 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
{{ range .Versions -}}
|
|
||||||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
|
|
||||||
|
|
||||||
{{ range .CommitGroups -}}
|
|
||||||
### {{ .Title }}
|
|
||||||
|
|
||||||
{{ range .Commits -}}
|
|
||||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "(.*)/issues/(.*)" (regexReplaceAll "(Co-\\w*-by.*)" .Subject "") "${1}/pull/${2}") | trim }}
|
|
||||||
{{ end }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- if .NoteGroups -}}
|
|
||||||
{{ range .NoteGroups -}}
|
|
||||||
### {{ .Title }}
|
|
||||||
|
|
||||||
{{ range .Notes }}
|
|
||||||
{{ .Body }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
@ -1,25 +0,0 @@
|
|||||||
style: github
|
|
||||||
template: CHANGELOG.tpl.md
|
|
||||||
info:
|
|
||||||
title: CHANGELOG
|
|
||||||
repository_url: https://github.com/thegeeklab/docker-tidy
|
|
||||||
options:
|
|
||||||
commit_groups:
|
|
||||||
title_maps:
|
|
||||||
feat: Features
|
|
||||||
fix: Bug Fixes
|
|
||||||
perf: Performance Improvements
|
|
||||||
refactor: Code Refactoring
|
|
||||||
chore: Others
|
|
||||||
test: Testing
|
|
||||||
ci: CI Pipeline
|
|
||||||
docs: Documentation
|
|
||||||
header:
|
|
||||||
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
|
|
||||||
pattern_maps:
|
|
||||||
- Type
|
|
||||||
- Scope
|
|
||||||
- Subject
|
|
||||||
notes:
|
|
||||||
keywords:
|
|
||||||
- BREAKING CHANGE
|
|
47
.gitsv/config.yml
Normal file
47
.gitsv/config.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
version: "1.1"
|
||||||
|
|
||||||
|
versioning:
|
||||||
|
update-major: []
|
||||||
|
update-minor: [feat]
|
||||||
|
update-patch: [fix, perf, refactor, chore, test, ci, docs]
|
||||||
|
|
||||||
|
tag:
|
||||||
|
pattern: "v%d.%d.%d"
|
||||||
|
|
||||||
|
release-notes:
|
||||||
|
sections:
|
||||||
|
- name: Features
|
||||||
|
commit-types: [feat]
|
||||||
|
section-type: commits
|
||||||
|
- name: Bug Fixes
|
||||||
|
commit-types: [fix]
|
||||||
|
section-type: commits
|
||||||
|
- name: Performance Improvements
|
||||||
|
commit-types: [perf]
|
||||||
|
section-type: commits
|
||||||
|
- name: Code Refactoring
|
||||||
|
commit-types: [refactor]
|
||||||
|
section-type: commits
|
||||||
|
- name: Others
|
||||||
|
commit-types: [chore]
|
||||||
|
section-type: commits
|
||||||
|
- name: Testing
|
||||||
|
commit-types: [test]
|
||||||
|
section-type: commits
|
||||||
|
- name: CI Pipeline
|
||||||
|
commit-types: [ci]
|
||||||
|
section-type: commits
|
||||||
|
- name: Documentation
|
||||||
|
commit-types: [docs]
|
||||||
|
section-type: commits
|
||||||
|
- name: Breaking Changes
|
||||||
|
section-type: breaking-changes
|
||||||
|
|
||||||
|
commit-message:
|
||||||
|
footer:
|
||||||
|
issue:
|
||||||
|
key: issue
|
||||||
|
add-value-prefix: "#"
|
||||||
|
issue:
|
||||||
|
regex: "#?[0-9]+"
|
1
.lycheeignore
Normal file
1
.lycheeignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://hub.docker.com/r/thegeeklab/*
|
@ -6,29 +6,39 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
build:
|
- name: build
|
||||||
image: docker.io/library/python:3.11
|
image: docker.io/library/python:3.13
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry build
|
- poetry build
|
||||||
|
|
||||||
dryrun:
|
- name: security-build
|
||||||
image: quay.io/thegeeklab/wp-docker-buildx:1
|
image: quay.io/thegeeklab/wp-docker-buildx:6
|
||||||
|
depends_on: [build]
|
||||||
settings:
|
settings:
|
||||||
containerfile: Containerfile.multiarch
|
containerfile: Containerfile.multiarch
|
||||||
dry_run: true
|
output: type=oci,dest=oci/${CI_REPO_NAME},tar=false
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
provenance: false
|
|
||||||
repo: ${CI_REPO}
|
repo: ${CI_REPO}
|
||||||
when:
|
registry_config:
|
||||||
- event: [pull_request]
|
from_secret: DOCKER_REGISTRY_CONFIG_PULL
|
||||||
|
|
||||||
publish-dockerhub:
|
- name: security-scan
|
||||||
group: container
|
image: docker.io/aquasec/trivy
|
||||||
image: quay.io/thegeeklab/wp-docker-buildx:1
|
depends_on: [security-build]
|
||||||
|
commands:
|
||||||
|
- trivy -v
|
||||||
|
- trivy image --input oci/${CI_REPO_NAME}
|
||||||
|
environment:
|
||||||
|
TRIVY_EXIT_CODE: "1"
|
||||||
|
TRIVY_IGNORE_UNFIXED: "true"
|
||||||
|
TRIVY_NO_PROGRESS: "true"
|
||||||
|
TRIVY_SEVERITY: HIGH,CRITICAL
|
||||||
|
TRIVY_TIMEOUT: 1m
|
||||||
|
TRIVY_DB_REPOSITORY: docker.io/aquasec/trivy-db:2
|
||||||
|
|
||||||
|
- name: publish-dockerhub
|
||||||
|
image: quay.io/thegeeklab/wp-docker-buildx:6
|
||||||
|
depends_on: [security-scan]
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
containerfile: Containerfile.multiarch
|
containerfile: Containerfile.multiarch
|
||||||
@ -47,9 +57,9 @@ steps:
|
|||||||
branch:
|
branch:
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
publish-quay:
|
- name: publish-quay
|
||||||
group: container
|
image: quay.io/thegeeklab/wp-docker-buildx:6
|
||||||
image: quay.io/thegeeklab/wp-docker-buildx:1
|
depends_on: security-scan
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
containerfile: Containerfile.multiarch
|
containerfile: Containerfile.multiarch
|
||||||
|
@ -6,31 +6,25 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
build:
|
- name: build
|
||||||
image: docker.io/library/python:3.11
|
image: docker.io/library/python:3.13
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry build
|
- poetry build
|
||||||
|
|
||||||
checksum:
|
- name: checksum
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
commands:
|
commands:
|
||||||
- cd dist/ && sha256sum * > ../sha256sum.txt
|
- cd dist/ && sha256sum * > ../sha256sum.txt
|
||||||
|
|
||||||
changelog-generate:
|
- name: changelog
|
||||||
image: quay.io/thegeeklab/git-chglog
|
image: quay.io/thegeeklab/git-sv
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
- git sv current-version
|
||||||
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${CI_COMMIT_TAG:---next-tag unreleased unreleased}
|
- git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md
|
||||||
|
- cat CHANGELOG.md
|
||||||
|
|
||||||
changelog-format:
|
- name: publish-github
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
|
||||||
commands:
|
|
||||||
- prettier CHANGELOG.md
|
|
||||||
- prettier -w CHANGELOG.md
|
|
||||||
|
|
||||||
publish-github:
|
|
||||||
image: docker.io/plugins/github-release
|
image: docker.io/plugins/github-release
|
||||||
settings:
|
settings:
|
||||||
api_key:
|
api_key:
|
||||||
@ -44,15 +38,14 @@ steps:
|
|||||||
when:
|
when:
|
||||||
- event: [tag]
|
- event: [tag]
|
||||||
|
|
||||||
publish-pypi:
|
- name: publish-pypi
|
||||||
image: docker.io/library/python:3.11
|
image: docker.io/library/python:3.13
|
||||||
secrets:
|
environment:
|
||||||
- source: pypi_password
|
POETRY_HTTP_BASIC_PYPI_PASSWORD:
|
||||||
target: POETRY_HTTP_BASIC_PYPI_PASSWORD
|
from_secret: pypi_password
|
||||||
- source: pypi_username
|
POETRY_HTTP_BASIC_PYPI_USERNAME:
|
||||||
target: POETRY_HTTP_BASIC_PYPI_USERNAME
|
from_secret: pypi_username
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry publish -n
|
- poetry publish -n
|
||||||
when:
|
when:
|
||||||
|
@ -6,58 +6,53 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
assets:
|
- name: assets
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
commands:
|
commands:
|
||||||
- make doc
|
- make doc
|
||||||
|
|
||||||
markdownlint:
|
- name: markdownlint
|
||||||
image: quay.io/thegeeklab/markdownlint-cli
|
image: quay.io/thegeeklab/markdownlint-cli
|
||||||
|
depends_on: [assets]
|
||||||
commands:
|
commands:
|
||||||
- markdownlint 'README.md' 'CONTRIBUTING.md'
|
- markdownlint 'README.md' 'CONTRIBUTING.md'
|
||||||
|
|
||||||
spellcheck:
|
- name: spellcheck
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
|
depends_on: [assets]
|
||||||
commands:
|
commands:
|
||||||
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
|
- spellchecker --files 'docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
|
||||||
environment:
|
environment:
|
||||||
FORCE_COLOR: "true"
|
FORCE_COLOR: "true"
|
||||||
NPM_CONFIG_LOGLEVEL: "error"
|
|
||||||
|
|
||||||
testbuild:
|
- name: link-validation
|
||||||
image: quay.io/thegeeklab/hugo:0.115.2
|
image: docker.io/lycheeverse/lychee
|
||||||
|
depends_on: [assets]
|
||||||
commands:
|
commands:
|
||||||
- hugo --panicOnWarning -s docs/ -b http://localhost:8000/
|
- lychee --no-progress --format detailed docs/content README.md
|
||||||
|
|
||||||
link-validation:
|
- name: build
|
||||||
image: quay.io/thegeeklab/link-validator
|
image: quay.io/thegeeklab/hugo:0.136.5
|
||||||
commands:
|
depends_on: [link-validation]
|
||||||
- link-validator --color=always --rate-limit 10
|
|
||||||
environment:
|
|
||||||
LINK_VALIDATOR_BASE_DIR: docs/public
|
|
||||||
LINK_VALIDATOR_RETRIES: "3"
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: quay.io/thegeeklab/hugo:0.115.2
|
|
||||||
commands:
|
commands:
|
||||||
- hugo --panicOnWarning -s docs/
|
- hugo --panicOnWarning -s docs/
|
||||||
|
|
||||||
beautify:
|
- name: beautify
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
|
depends_on: [build]
|
||||||
commands:
|
commands:
|
||||||
- html-beautify -r -f 'docs/public/**/*.html'
|
- html-beautify -r -f 'docs/public/**/*.html'
|
||||||
environment:
|
|
||||||
FORCE_COLOR: "true"
|
|
||||||
NPM_CONFIG_LOGLEVEL: error
|
|
||||||
|
|
||||||
publish:
|
- name: publish
|
||||||
image: quay.io/thegeeklab/wp-s3-action
|
image: quay.io/thegeeklab/wp-s3-action
|
||||||
|
depends_on: [beautify]
|
||||||
settings:
|
settings:
|
||||||
access_key:
|
access_key:
|
||||||
from_secret: s3_access_key
|
from_secret: s3_access_key
|
||||||
bucket: geekdocs
|
bucket: geekdocs
|
||||||
delete: true
|
delete: true
|
||||||
endpoint: https://sp.rknet.org
|
endpoint:
|
||||||
|
from_secret: s3_endpoint
|
||||||
path_style: true
|
path_style: true
|
||||||
secret_key:
|
secret_key:
|
||||||
from_secret: s3_secret_access_key
|
from_secret: s3_secret_access_key
|
||||||
@ -68,16 +63,16 @@ steps:
|
|||||||
- event: [push, manual]
|
- event: [push, manual]
|
||||||
branch:
|
branch:
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
status: [success]
|
status: [success, failure]
|
||||||
|
|
||||||
pushrm-dockerhub:
|
- name: pushrm-dockerhub
|
||||||
image: docker.io/chko/docker-pushrm:1
|
image: docker.io/chko/docker-pushrm:1
|
||||||
secrets:
|
depends_on: [publish]
|
||||||
- source: docker_password
|
|
||||||
target: DOCKER_PASS
|
|
||||||
- source: docker_username
|
|
||||||
target: DOCKER_USER
|
|
||||||
environment:
|
environment:
|
||||||
|
DOCKER_PASS:
|
||||||
|
from_secret: docker_password
|
||||||
|
DOCKER_USER:
|
||||||
|
from_secret: docker_username
|
||||||
PUSHRM_FILE: README.md
|
PUSHRM_FILE: README.md
|
||||||
PUSHRM_SHORT: Keep docker hosts tidy
|
PUSHRM_SHORT: Keep docker hosts tidy
|
||||||
PUSHRM_TARGET: ${CI_REPO}
|
PUSHRM_TARGET: ${CI_REPO}
|
||||||
@ -87,12 +82,12 @@ steps:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
status: [success]
|
status: [success]
|
||||||
|
|
||||||
pushrm-quay:
|
- name: pushrm-quay
|
||||||
image: docker.io/chko/docker-pushrm:1
|
image: docker.io/chko/docker-pushrm:1
|
||||||
secrets:
|
depends_on: [publish]
|
||||||
- source: quay_token
|
|
||||||
target: APIKEY__QUAY_IO
|
|
||||||
environment:
|
environment:
|
||||||
|
APIKEY__QUAY_IO:
|
||||||
|
from_secret: quay_token
|
||||||
PUSHRM_FILE: README.md
|
PUSHRM_FILE: README.md
|
||||||
PUSHRM_TARGET: quay.io/${CI_REPO}
|
PUSHRM_TARGET: quay.io/${CI_REPO}
|
||||||
when:
|
when:
|
||||||
|
@ -6,22 +6,22 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
check-format:
|
- name: check-format
|
||||||
image: docker.io/library/python:3.11
|
image: docker.io/library/python:3.13
|
||||||
|
depends_on: []
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry install
|
- poetry install
|
||||||
- poetry run yapf -dr ./${CI_REPO_NAME//-/}
|
- poetry run ruff format --check --diff ./${CI_REPO_NAME//-/}
|
||||||
environment:
|
environment:
|
||||||
PY_COLORS: "1"
|
PY_COLORS: "1"
|
||||||
|
|
||||||
check-coding:
|
- name: check-coding
|
||||||
image: docker.io/library/python:3.11
|
image: docker.io/library/python:3.13
|
||||||
|
depends_on: []
|
||||||
commands:
|
commands:
|
||||||
- git fetch -tq
|
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry install
|
- poetry install
|
||||||
- poetry run ruff ./${CI_REPO_NAME//-/}
|
- poetry run ruff check ./${CI_REPO_NAME//-/}
|
||||||
environment:
|
environment:
|
||||||
PY_COLORS: "1"
|
PY_COLORS: "1"
|
||||||
|
@ -8,17 +8,17 @@ when:
|
|||||||
runs_on: [success, failure]
|
runs_on: [success, failure]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
matrix:
|
- name: matrix
|
||||||
image: quay.io/thegeeklab/wp-matrix
|
image: quay.io/thegeeklab/wp-matrix
|
||||||
settings:
|
settings:
|
||||||
homeserver:
|
homeserver:
|
||||||
from_secret: matrix_homeserver
|
from_secret: matrix_homeserver
|
||||||
password:
|
room_id:
|
||||||
from_secret: matrix_password
|
from_secret: matrix_room_id
|
||||||
roomid:
|
user_id:
|
||||||
from_secret: matrix_roomid
|
from_secret: matrix_user_id
|
||||||
username:
|
access_token:
|
||||||
from_secret: matrix_username
|
from_secret: matrix_access_token
|
||||||
when:
|
when:
|
||||||
- status: [success, failure]
|
- status: [success, failure]
|
||||||
|
|
||||||
|
@ -5,21 +5,9 @@ when:
|
|||||||
branch:
|
branch:
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
matrix:
|
variables:
|
||||||
PYTHON_VERSION:
|
- &pytest_base
|
||||||
- docker.io/library/python:3.8
|
depends_on: []
|
||||||
- docker.io/library/python:3.9
|
|
||||||
- docker.io/library/python:3.10
|
|
||||||
- docker.io/library/python:3.11
|
|
||||||
|
|
||||||
steps:
|
|
||||||
fetch:
|
|
||||||
image: docker.io/library/python:3.11
|
|
||||||
commands:
|
|
||||||
- git fetch -tq
|
|
||||||
|
|
||||||
pytest:
|
|
||||||
image: ${PYTHON_VERSION}
|
|
||||||
commands:
|
commands:
|
||||||
- pip install poetry poetry-dynamic-versioning -qq
|
- pip install poetry poetry-dynamic-versioning -qq
|
||||||
- poetry install
|
- poetry install
|
||||||
@ -28,3 +16,20 @@ steps:
|
|||||||
- poetry run ${CI_REPO_NAME} --help
|
- poetry run ${CI_REPO_NAME} --help
|
||||||
environment:
|
environment:
|
||||||
PY_COLORS: "1"
|
PY_COLORS: "1"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: python-313
|
||||||
|
image: docker.io/library/python:3.13
|
||||||
|
<<: *pytest_base
|
||||||
|
|
||||||
|
- name: python-312
|
||||||
|
image: docker.io/library/python:3.12
|
||||||
|
<<: *pytest_base
|
||||||
|
|
||||||
|
- name: python-311
|
||||||
|
image: docker.io/library/python:3.11
|
||||||
|
<<: *pytest_base
|
||||||
|
|
||||||
|
- name: python-310
|
||||||
|
image: docker.io/library/python:3.10
|
||||||
|
<<: *pytest_base
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM python:3.11-alpine@sha256:5d769f990397afbb2aca24b0655e404c0f2806d268f454b052e81e39d87abf42
|
FROM python:3.13-alpine@sha256:fcbcbbecdeae71d3b77445d9144d1914df55110f825ab62b04a66c7c33c09373
|
||||||
|
|
||||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
# renovate: datasource=github-releases depName=thegeeklab/hugo-geekdoc
|
# renovate: datasource=github-releases depName=thegeeklab/hugo-geekdoc
|
||||||
THEME_VERSION := v0.40.1
|
THEME_VERSION := v1.2.1
|
||||||
THEME := hugo-geekdoc
|
THEME := hugo-geekdoc
|
||||||
BASEDIR := docs
|
BASEDIR := docs
|
||||||
THEMEDIR := $(BASEDIR)/themes
|
THEMEDIR := $(BASEDIR)/themes
|
||||||
|
@ -7,7 +7,6 @@ Keep docker hosts tidy
|
|||||||
[![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![PyPI Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPI Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![PyPI Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPI Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/thegeeklab/docker-tidy)](https://codecov.io/gh/thegeeklab/docker-tidy)
|
|
||||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/graphs/contributors)
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/graphs/contributors)
|
||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/docker-tidy)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/docker-tidy)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/blob/main/LICENSE)
|
||||||
|
@ -45,9 +45,7 @@ class AutoStop:
|
|||||||
) or (not prefix and self._has_been_running_since(container, max_run_time)):
|
) or (not prefix and self._has_been_running_since(container, max_run_time)):
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Stopping container {id} {name}: running since {started}".format(
|
"Stopping container {id} {name}: running since {started}".format(
|
||||||
id=container["Id"][:16],
|
id=container["Id"][:16], name=name, started=container["State"]["StartedAt"]
|
||||||
name=name,
|
|
||||||
started=container["State"]["StartedAt"]
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +61,6 @@ class AutoStop:
|
|||||||
self.logger.warning(f"Error stopping {cid}: {e!s}")
|
self.logger.warning(f"Error stopping {cid}: {e!s}")
|
||||||
|
|
||||||
def _build_container_matcher(self, prefixes):
|
def _build_container_matcher(self, prefixes):
|
||||||
|
|
||||||
def matcher(name):
|
def matcher(name):
|
||||||
return any(name.startswith(prefix) for prefix in prefixes)
|
return any(name.startswith(prefix) for prefix in prefixes)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class DockerTidy:
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
default=None,
|
default=None,
|
||||||
dest="dry_run",
|
dest="dry_run",
|
||||||
help="only log actions, don't stop anything"
|
help="only log actions, don't stop anything",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-t",
|
"-t",
|
||||||
@ -44,7 +44,7 @@ class DockerTidy:
|
|||||||
type=int,
|
type=int,
|
||||||
dest="http_timeout",
|
dest="http_timeout",
|
||||||
metavar="HTTP_TIMEOUT",
|
metavar="HTTP_TIMEOUT",
|
||||||
help="HTTP timeout in seconds for making docker API calls"
|
help="HTTP timeout in seconds for making docker API calls",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v", dest="logging.level", action="append_const", const=-1, help="increase log level"
|
"-v", dest="logging.level", action="append_const", const=-1, help="increase log level"
|
||||||
@ -64,7 +64,7 @@ class DockerTidy:
|
|||||||
dest="gc.max_container_age",
|
dest="gc.max_container_age",
|
||||||
metavar="MAX_CONTAINER_AGE",
|
metavar="MAX_CONTAINER_AGE",
|
||||||
help="maximum age for a container, containers older than this age "
|
help="maximum age for a container, containers older than this age "
|
||||||
"will be removed (dateparser value)"
|
"will be removed (dateparser value)",
|
||||||
)
|
)
|
||||||
parser_gc.add_argument(
|
parser_gc.add_argument(
|
||||||
"--max-image-age",
|
"--max-image-age",
|
||||||
@ -72,13 +72,13 @@ class DockerTidy:
|
|||||||
dest="gc.max_image_age",
|
dest="gc.max_image_age",
|
||||||
metavar="MAX_IMAGE_AGE",
|
metavar="MAX_IMAGE_AGE",
|
||||||
help="maxium age for an image, images older than this age will be "
|
help="maxium age for an image, images older than this age will be "
|
||||||
"removed (dateparser value)"
|
"removed (dateparser value)",
|
||||||
)
|
)
|
||||||
parser_gc.add_argument(
|
parser_gc.add_argument(
|
||||||
"--dangling-volumes",
|
"--dangling-volumes",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="gc.dangling_volumes",
|
dest="gc.dangling_volumes",
|
||||||
help="dangling volumes will be removed"
|
help="dangling volumes will be removed",
|
||||||
)
|
)
|
||||||
parser_gc.add_argument(
|
parser_gc.add_argument(
|
||||||
"--exclude-image",
|
"--exclude-image",
|
||||||
@ -86,7 +86,7 @@ class DockerTidy:
|
|||||||
type=str,
|
type=str,
|
||||||
dest="gc.exclude_images",
|
dest="gc.exclude_images",
|
||||||
metavar="EXCLUDE_IMAGE",
|
metavar="EXCLUDE_IMAGE",
|
||||||
help="never remove images with this tag"
|
help="never remove images with this tag",
|
||||||
)
|
)
|
||||||
parser_gc.add_argument(
|
parser_gc.add_argument(
|
||||||
"--exclude-container-label",
|
"--exclude-container-label",
|
||||||
@ -94,8 +94,7 @@ class DockerTidy:
|
|||||||
type=str,
|
type=str,
|
||||||
dest="gc.exclude_container_labels",
|
dest="gc.exclude_container_labels",
|
||||||
metavar="EXCLUDE_CONTAINER_LABEL",
|
metavar="EXCLUDE_CONTAINER_LABEL",
|
||||||
help="never remove containers with this label key "
|
help="never remove containers with this label key or label key=value",
|
||||||
"or label key=value"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser_stop = subparsers.add_parser(
|
parser_stop = subparsers.add_parser(
|
||||||
@ -106,7 +105,7 @@ class DockerTidy:
|
|||||||
type=timedelta_validator,
|
type=timedelta_validator,
|
||||||
dest="stop.max_run_time",
|
dest="stop.max_run_time",
|
||||||
metavar="MAX_RUN_TIME",
|
metavar="MAX_RUN_TIME",
|
||||||
help="maximum time a container is allows to run (dateparser value)"
|
help="maximum time a container is allows to run (dateparser value)",
|
||||||
)
|
)
|
||||||
parser_stop.add_argument(
|
parser_stop.add_argument(
|
||||||
"--prefix",
|
"--prefix",
|
||||||
@ -114,7 +113,7 @@ class DockerTidy:
|
|||||||
type=str,
|
type=str,
|
||||||
dest="stop.prefix",
|
dest="stop.prefix",
|
||||||
metavar="PREFIX",
|
metavar="PREFIX",
|
||||||
help="only stop containers which match one of the prefix"
|
help="only stop containers which match one of the prefix",
|
||||||
)
|
)
|
||||||
|
|
||||||
return parser.parse_args().__dict__
|
return parser.parse_args().__dict__
|
||||||
|
@ -36,73 +36,73 @@ class Config:
|
|||||||
"config_file": {
|
"config_file": {
|
||||||
"default": "",
|
"default": "",
|
||||||
"env": "CONFIG_FILE",
|
"env": "CONFIG_FILE",
|
||||||
"type": environs.Env().str
|
"type": environs.Env().str,
|
||||||
},
|
},
|
||||||
"dry_run": {
|
"dry_run": {
|
||||||
"default": False,
|
"default": False,
|
||||||
"env": "DRY_RUN",
|
"env": "DRY_RUN",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().bool
|
"type": environs.Env().bool,
|
||||||
},
|
},
|
||||||
"http_timeout": {
|
"http_timeout": {
|
||||||
"default": 60,
|
"default": 60,
|
||||||
"env": "HTTP_TIMEOUT",
|
"env": "HTTP_TIMEOUT",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().int
|
"type": environs.Env().int,
|
||||||
},
|
},
|
||||||
"logging.level": {
|
"logging.level": {
|
||||||
"default": "WARNING",
|
"default": "WARNING",
|
||||||
"env": "LOG_LEVEL",
|
"env": "LOG_LEVEL",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().str
|
"type": environs.Env().str,
|
||||||
},
|
},
|
||||||
"logging.json": {
|
"logging.json": {
|
||||||
"default": False,
|
"default": False,
|
||||||
"env": "LOG_JSON",
|
"env": "LOG_JSON",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().bool
|
"type": environs.Env().bool,
|
||||||
},
|
},
|
||||||
"gc.max_container_age": {
|
"gc.max_container_age": {
|
||||||
"default": "",
|
"default": "",
|
||||||
"env": "GC_MAX_CONTAINER_AGE",
|
"env": "GC_MAX_CONTAINER_AGE",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": env.timedelta_validator
|
"type": env.timedelta_validator,
|
||||||
},
|
},
|
||||||
"gc.max_image_age": {
|
"gc.max_image_age": {
|
||||||
"default": "",
|
"default": "",
|
||||||
"env": "GC_MAX_IMAGE_AGE",
|
"env": "GC_MAX_IMAGE_AGE",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": env.timedelta_validator
|
"type": env.timedelta_validator,
|
||||||
},
|
},
|
||||||
"gc.dangling_volumes": {
|
"gc.dangling_volumes": {
|
||||||
"default": False,
|
"default": False,
|
||||||
"env": "GC_DANGLING_VOLUMES",
|
"env": "GC_DANGLING_VOLUMES",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().bool
|
"type": environs.Env().bool,
|
||||||
},
|
},
|
||||||
"gc.exclude_images": {
|
"gc.exclude_images": {
|
||||||
"default": [],
|
"default": [],
|
||||||
"env": "GC_EXCLUDE_IMAGES",
|
"env": "GC_EXCLUDE_IMAGES",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().list
|
"type": environs.Env().list,
|
||||||
},
|
},
|
||||||
"gc.exclude_container_labels": {
|
"gc.exclude_container_labels": {
|
||||||
"default": [],
|
"default": [],
|
||||||
"env": "GC_EXCLUDE_CONTAINER_LABELS",
|
"env": "GC_EXCLUDE_CONTAINER_LABELS",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().list
|
"type": environs.Env().list,
|
||||||
},
|
},
|
||||||
"stop.max_run_time": {
|
"stop.max_run_time": {
|
||||||
"default": "",
|
"default": "",
|
||||||
"env": "STOP_MAX_RUN_TIME",
|
"env": "STOP_MAX_RUN_TIME",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": env.timedelta_validator
|
"type": env.timedelta_validator,
|
||||||
},
|
},
|
||||||
"stop.prefix": {
|
"stop.prefix": {
|
||||||
"default": [],
|
"default": [],
|
||||||
"env": "STOP_PREFIX",
|
"env": "STOP_PREFIX",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().list
|
"type": environs.Env().list,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ class Config:
|
|||||||
with open(config, encoding="utf8") as stream:
|
with open(config, encoding="utf8") as stream:
|
||||||
s = stream.read()
|
s = stream.read()
|
||||||
try:
|
try:
|
||||||
normalized = ruamel.yaml.safe_load(s)
|
normalized = ruamel.yaml.YAML(typ="safe", pure=True).load(s)
|
||||||
except (ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError) as e:
|
except (ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError) as e:
|
||||||
message = f"{e.context} {e.problem}"
|
message = f"{e.context} {e.problem}"
|
||||||
raise dockertidy.exception.ConfigError(
|
raise dockertidy.exception.ConfigError(
|
||||||
@ -234,20 +234,19 @@ class Config:
|
|||||||
try:
|
try:
|
||||||
anyconfig.validate(config, self.schema, ac_schema_safe=False)
|
anyconfig.validate(config, self.schema, ac_schema_safe=False)
|
||||||
except jsonschema.exceptions.ValidationError as e:
|
except jsonschema.exceptions.ValidationError as e:
|
||||||
schema_error = "Failed validating '{validator}' in schema{schema}\n{message}".format(
|
schema = format_as_index(list(e.relative_schema_path)[:-1])
|
||||||
validator=e.validator,
|
schema_error = f"Failed validating '{e.validator}' in schema {schema}\n{e.message}"
|
||||||
schema=format_as_index(list(e.relative_schema_path)[:-1]),
|
|
||||||
message=e.message
|
|
||||||
)
|
|
||||||
raise dockertidy.exception.ConfigError("Configuration error", schema_error) from e
|
raise dockertidy.exception.ConfigError("Configuration error", schema_error) from e
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _add_dict_branch(self, tree, vector, value):
|
def _add_dict_branch(self, tree, vector, value):
|
||||||
key = vector[0]
|
key = vector[0]
|
||||||
tree[key] = value \
|
tree[key] = (
|
||||||
if len(vector) == 1 \
|
value
|
||||||
else self._add_dict_branch(tree[key] if key in tree else {}, vector[1:], value)
|
if len(vector) == 1
|
||||||
|
else self._add_dict_branch(tree.get(key, {}), vector[1:], value)
|
||||||
|
)
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ class GarbageCollector:
|
|||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Removing container {} {} {}".format(
|
"Removing container {} {} {}".format(
|
||||||
container["Id"][:16],
|
container["Id"][:16],
|
||||||
container.get("Name", "").lstrip("/"), container["State"]["FinishedAt"]
|
container.get("Name", "").lstrip("/"),
|
||||||
|
container["State"]["FinishedAt"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -73,9 +74,7 @@ class GarbageCollector:
|
|||||||
return containers
|
return containers
|
||||||
|
|
||||||
def include_container(container):
|
def include_container(container):
|
||||||
if self._should_exclude_container_with_labels(container):
|
return not self._should_exclude_container_with_labels(container)
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
return filter(include_container, containers)
|
return filter(include_container, containers)
|
||||||
|
|
||||||
@ -163,7 +162,6 @@ class GarbageCollector:
|
|||||||
self._remove_image(image_summary, timedelta(config["gc"]["max_image_age"]))
|
self._remove_image(image_summary, timedelta(config["gc"]["max_image_age"]))
|
||||||
|
|
||||||
def _filter_excluded_images(self, images, exclude_set):
|
def _filter_excluded_images(self, images, exclude_set):
|
||||||
|
|
||||||
def include_image(image_summary):
|
def include_image(image_summary):
|
||||||
image_tags = image_summary.get("RepoTags")
|
image_tags = image_summary.get("RepoTags")
|
||||||
if self._no_image_tags(image_tags):
|
if self._no_image_tags(image_tags):
|
||||||
@ -176,7 +174,6 @@ class GarbageCollector:
|
|||||||
return filter(include_image, images)
|
return filter(include_image, images)
|
||||||
|
|
||||||
def _filter_images_in_use(self, images, image_tags_in_use):
|
def _filter_images_in_use(self, images, image_tags_in_use):
|
||||||
|
|
||||||
def get_tag_set(image_summary):
|
def get_tag_set(image_summary):
|
||||||
image_tags = image_summary.get("RepoTags")
|
image_tags = image_summary.get("RepoTags")
|
||||||
if self._no_image_tags(image_tags):
|
if self._no_image_tags(image_tags):
|
||||||
@ -190,7 +187,6 @@ class GarbageCollector:
|
|||||||
return filter(image_not_in_use, images)
|
return filter(image_not_in_use, images)
|
||||||
|
|
||||||
def _filter_images_in_use_by_id(self, images, image_ids_in_use):
|
def _filter_images_in_use_by_id(self, images, image_ids_in_use):
|
||||||
|
|
||||||
def image_not_in_use(image_summary):
|
def image_not_in_use(image_summary):
|
||||||
return image_summary["Id"] not in image_ids_in_use
|
return image_summary["Id"] not in image_ids_in_use
|
||||||
|
|
||||||
@ -256,7 +252,6 @@ class GarbageCollector:
|
|||||||
self.logger.warning(f"Error calling {func.__name__} {params} {e!s}")
|
self.logger.warning(f"Error calling {func.__name__} {params} {e!s}")
|
||||||
|
|
||||||
def _format_image(self, image, image_summary):
|
def _format_image(self, image, image_summary):
|
||||||
|
|
||||||
def get_tags():
|
def get_tags():
|
||||||
tags = image_summary.get("RepoTags")
|
tags = image_summary.get("RepoTags")
|
||||||
if not tags or tags == ["<none>:<none>"]:
|
if not tags or tags == ["<none>:<none>"]:
|
||||||
@ -313,7 +308,8 @@ class GarbageCollector:
|
|||||||
self.cleanup_volumes()
|
self.cleanup_volumes()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not config["gc"]["max_container_age"] and not config["gc"]["max_image_age"]
|
not config["gc"]["max_container_age"]
|
||||||
|
and not config["gc"]["max_image_age"]
|
||||||
and not config["gc"]["dangling_volumes"]
|
and not config["gc"]["dangling_volumes"]
|
||||||
):
|
):
|
||||||
self.logger.ing("Skipped, no arguments given")
|
self.logger.ing("Skipped, no arguments given")
|
||||||
|
@ -46,7 +46,7 @@ class LogFilter:
|
|||||||
class MultilineFormatter(logging.Formatter):
|
class MultilineFormatter(logging.Formatter):
|
||||||
"""Logging Formatter to reset color after newline characters."""
|
"""Logging Formatter to reset color after newline characters."""
|
||||||
|
|
||||||
def format(self, record): # noqa
|
def format(self, record):
|
||||||
record.msg = record.msg.replace("\n", f"\n{colorama.Style.RESET_ALL}... ")
|
record.msg = record.msg.replace("\n", f"\n{colorama.Style.RESET_ALL}... ")
|
||||||
return logging.Formatter.format(self, record)
|
return logging.Formatter.format(self, record)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class MultilineFormatter(logging.Formatter):
|
|||||||
class MultilineJsonFormatter(jsonlogger.JsonFormatter):
|
class MultilineJsonFormatter(jsonlogger.JsonFormatter):
|
||||||
"""Logging Formatter to remove newline characters."""
|
"""Logging Formatter to remove newline characters."""
|
||||||
|
|
||||||
def format(self, record): # noqa
|
def format(self, record):
|
||||||
record.msg = record.msg.replace("\n", " ")
|
record.msg = record.msg.replace("\n", " ")
|
||||||
return jsonlogger.JsonFormatter.format(self, record)
|
return jsonlogger.JsonFormatter.format(self, record)
|
||||||
|
|
||||||
@ -93,9 +93,7 @@ class Log:
|
|||||||
handler.addFilter(LogFilter(logging.WARNING))
|
handler.addFilter(LogFilter(logging.WARNING))
|
||||||
handler.setFormatter(
|
handler.setFormatter(
|
||||||
MultilineFormatter(
|
MultilineFormatter(
|
||||||
self.warning(
|
self.warning(CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL))
|
||||||
CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,10 +36,7 @@ def timedelta(value, dt_format=None):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
timedelta = dateparser.parse(
|
timedelta = dateparser.parse(
|
||||||
value, settings={
|
value, settings={"TO_TIMEZONE": "UTC", "RETURN_AS_TIMEZONE_AWARE": True}
|
||||||
"TO_TIMEZONE": "UTC",
|
|
||||||
"RETURN_AS_TIMEZONE_AWARE": True
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if dt_format:
|
if dt_format:
|
||||||
|
@ -1,7 +1,29 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Global utility methods and classes."""
|
"""Global utility methods and classes."""
|
||||||
|
|
||||||
from distutils.util import strtobool
|
|
||||||
|
def strtobool(value):
|
||||||
|
"""Convert a string representation of truth to true or false."""
|
||||||
|
|
||||||
|
_map = {
|
||||||
|
"y": True,
|
||||||
|
"yes": True,
|
||||||
|
"t": True,
|
||||||
|
"true": True,
|
||||||
|
"on": True,
|
||||||
|
"1": True,
|
||||||
|
"n": False,
|
||||||
|
"no": False,
|
||||||
|
"f": False,
|
||||||
|
"false": False,
|
||||||
|
"off": False,
|
||||||
|
"0": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
return _map[str(value).lower()]
|
||||||
|
except KeyError as err:
|
||||||
|
raise ValueError(f'"{value}" is not a valid bool value') from err
|
||||||
|
|
||||||
|
|
||||||
def to_bool(string):
|
def to_bool(string):
|
||||||
@ -21,7 +43,6 @@ class Singleton(type):
|
|||||||
_instances = {}
|
_instances = {}
|
||||||
|
|
||||||
def __call__(cls, *args, **kwargs):
|
def __call__(cls, *args, **kwargs):
|
||||||
|
|
||||||
if cls not in cls._instances:
|
if cls not in cls._instances:
|
||||||
cls._instances[cls] = super().__call__(*args, **kwargs)
|
cls._instances[cls] = super().__call__(*args, **kwargs)
|
||||||
return cls._instances[cls]
|
return cls._instances[cls]
|
||||||
|
@ -7,7 +7,6 @@ title: Documentation
|
|||||||
[![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![PyPI Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPI Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![PyPI Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPI Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/thegeeklab/docker-tidy)](https://codecov.io/gh/thegeeklab/docker-tidy)
|
|
||||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/graphs/contributors)
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/graphs/contributors)
|
||||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/docker-tidy)
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/docker-tidy)
|
||||||
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/blob/main/LICENSE)
|
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/docker-tidy)](https://github.com/thegeeklab/docker-tidy/blob/main/LICENSE)
|
||||||
|
1240
poetry.lock
generated
1240
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
153
pyproject.toml
153
pyproject.toml
@ -10,10 +10,10 @@ classifiers = [
|
|||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Operating System :: POSIX",
|
"Operating System :: POSIX",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
"Topic :: System :: Systems Administration",
|
"Topic :: System :: Systems Administration",
|
||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
"Topic :: Software Development",
|
"Topic :: Software Development",
|
||||||
@ -21,64 +21,52 @@ classifiers = [
|
|||||||
description = "Keep docker hosts tidy."
|
description = "Keep docker hosts tidy."
|
||||||
documentation = "https://docker-tidy.geekdocs.de/"
|
documentation = "https://docker-tidy.geekdocs.de/"
|
||||||
homepage = "https://docker-tidy.geekdocs.de/"
|
homepage = "https://docker-tidy.geekdocs.de/"
|
||||||
include = [
|
include = ["LICENSE"]
|
||||||
"LICENSE",
|
|
||||||
]
|
|
||||||
keywords = ["docker", "gc", "prune", "garbage"]
|
keywords = ["docker", "gc", "prune", "garbage"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
name = "docker-tidy"
|
name = "docker-tidy"
|
||||||
packages = [
|
packages = [{ include = "dockertidy" }]
|
||||||
{include = "dockertidy"},
|
|
||||||
]
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/thegeeklab/docker-tidy/"
|
repository = "https://github.com/thegeeklab/docker-tidy/"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
anyconfig = "0.13.0"
|
anyconfig = "0.14.0"
|
||||||
appdirs = "1.4.4"
|
appdirs = "1.4.4"
|
||||||
certifi = "2023.7.22"
|
certifi = "2024.8.30"
|
||||||
colorama = "0.4.6"
|
colorama = "0.4.6"
|
||||||
dateparser = "1.1.8"
|
dateparser = "1.2.0"
|
||||||
docker = "6.1.3"
|
docker = "7.1.0"
|
||||||
docker-pycreds = "0.4.0"
|
docker-pycreds = "0.4.0"
|
||||||
environs = "9.5.0"
|
environs = "11.2.0"
|
||||||
idna = "3.4"
|
idna = "3.10"
|
||||||
ipaddress = "1.0.23"
|
ipaddress = "1.0.23"
|
||||||
jsonschema = "4.19.0"
|
jsonschema = "4.23.0"
|
||||||
nested-lookup = "0.2.25"
|
nested-lookup = "0.2.25"
|
||||||
pathspec = "0.11.2"
|
pathspec = "0.12.1"
|
||||||
python = "^3.8.0"
|
python = "^3.10.0"
|
||||||
python-dateutil = "2.8.2"
|
python-dateutil = "2.9.0.post0"
|
||||||
python-json-logger = "2.0.7"
|
python-json-logger = "2.0.7"
|
||||||
requests = "2.31.0"
|
requests = "2.32.3"
|
||||||
"ruamel.yaml" = "0.17.32"
|
"ruamel.yaml" = "0.18.6"
|
||||||
websocket_client = "1.6.2"
|
websocket_client = "1.8.0"
|
||||||
zipp = "3.16.2"
|
zipp = "3.21.0"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
docker-tidy = "dockertidy.cli:main"
|
docker-tidy = "dockertidy.cli:main"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
ruff = "0.0.286"
|
ruff = "0.7.3"
|
||||||
pytest = "7.4.0"
|
pytest = "8.3.3"
|
||||||
pytest-mock = "3.11.1"
|
pytest-mock = "3.14.0"
|
||||||
pytest-cov = "4.1.0"
|
pytest-cov = "6.0.0"
|
||||||
toml = "0.10.2"
|
toml = "0.10.2"
|
||||||
yapf = "0.40.1"
|
|
||||||
|
|
||||||
[tool.poetry-dynamic-versioning]
|
[tool.poetry-dynamic-versioning]
|
||||||
enable = true
|
enable = true
|
||||||
style = "semver"
|
style = "semver"
|
||||||
vcs = "git"
|
vcs = "git"
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
default_section = "THIRDPARTY"
|
|
||||||
force_single_line = true
|
|
||||||
line_length = 99
|
|
||||||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
|
|
||||||
skip_glob = ["**/.env*", "**/env/*", "**/.venv/*", "**/docs/*"]
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "dockertidy --cov=dockertidy --cov-report=xml:coverage.xml --cov-report=term --no-cov-on-fail"
|
addopts = "dockertidy --cov=dockertidy --cov-report=xml:coverage.xml --cov-report=term --no-cov-on-fail"
|
||||||
filterwarnings = [
|
filterwarnings = [
|
||||||
@ -96,17 +84,22 @@ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
|
|||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
exclude = [
|
exclude = [
|
||||||
".git",
|
".git",
|
||||||
"__pycache__",
|
"__pycache__",
|
||||||
"build",
|
"build",
|
||||||
"dist",
|
"dist",
|
||||||
"test",
|
"test",
|
||||||
"*.pyc",
|
"*.pyc",
|
||||||
"*.egg-info",
|
"*.egg-info",
|
||||||
".cache",
|
".cache",
|
||||||
".eggs",
|
".eggs",
|
||||||
"env*",
|
"env*",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
line-length = 99
|
||||||
|
indent-width = 4
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
# Explanation of errors
|
# Explanation of errors
|
||||||
#
|
#
|
||||||
# D102: Missing docstring in public method
|
# D102: Missing docstring in public method
|
||||||
@ -117,47 +110,39 @@ exclude = [
|
|||||||
# D203: One blank line required before class docstring
|
# D203: One blank line required before class docstring
|
||||||
# D212: Multi-line docstring summary should start at the first line
|
# D212: Multi-line docstring summary should start at the first line
|
||||||
ignore = [
|
ignore = [
|
||||||
"D102",
|
"D102",
|
||||||
"D103",
|
"D103",
|
||||||
"D105",
|
"D105",
|
||||||
"D107",
|
"D107",
|
||||||
"D202",
|
"D202",
|
||||||
"D203",
|
"D203",
|
||||||
"D212",
|
"D212",
|
||||||
"UP038",
|
"UP038",
|
||||||
"RUF012",
|
"RUF012",
|
||||||
]
|
]
|
||||||
line-length = 99
|
|
||||||
select = [
|
select = [
|
||||||
"D",
|
"D",
|
||||||
"E",
|
"E",
|
||||||
"F",
|
"F",
|
||||||
"Q",
|
"Q",
|
||||||
"W",
|
"W",
|
||||||
"I",
|
"I",
|
||||||
"S",
|
"S",
|
||||||
"BLE",
|
"BLE",
|
||||||
"N",
|
"N",
|
||||||
"UP",
|
"UP",
|
||||||
"B",
|
"B",
|
||||||
"A",
|
"A",
|
||||||
"C4",
|
"C4",
|
||||||
"T20",
|
"T20",
|
||||||
"SIM",
|
"SIM",
|
||||||
"RET",
|
"RET",
|
||||||
"ARG",
|
"ARG",
|
||||||
"ERA",
|
"ERA",
|
||||||
"RUF",
|
"RUF",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.flake8-quotes]
|
[tool.ruff.format]
|
||||||
inline-quotes = "double"
|
quote-style = "double"
|
||||||
|
indent-style = "space"
|
||||||
[tool.yapf]
|
line-ending = "lf"
|
||||||
based_on_style = "google"
|
|
||||||
column_limit = 99
|
|
||||||
dedent_closing_brackets = true
|
|
||||||
coalesce_brackets = true
|
|
||||||
split_before_logical_operator = true
|
|
||||||
indent_dictionary_value = true
|
|
||||||
allow_split_before_dict_value = false
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["github>thegeeklab/renovate-presets"]
|
"extends": ["github>thegeeklab/renovate-presets"],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": ["woodpecker"],
|
||||||
|
"matchFileNames": [".woodpecker/test.yml"],
|
||||||
|
"matchPackageNames": ["docker.io/library/python"],
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user