Merge branch 'master' into renovate/configure

This commit is contained in:
Robert Kaussow 2020-11-15 23:50:30 +01:00 committed by GitHub
commit 44814e1e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1774 additions and 1449 deletions

View File

@ -3,15 +3,13 @@ local PythonVersion(pyversion='3.5') = {
image: 'python:' + pyversion,
environment: {
PY_COLORS: 1,
SETUPTOOLS_SCM_PRETEND_VERSION: '${DRONE_TAG##v}',
},
commands: [
'pip install pipenv -qq',
'pipenv --bare install --dev --keep-outdated',
'pipenv run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail',
'pip install -qq .',
'docker-tidy --help',
'docker-tidy --version',
'pip install poetry -qq',
'poetry install -q',
'poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail',
'poetry version',
'poetry run docker-tidy --help',
],
depends_on: [
'clone',
@ -28,14 +26,14 @@ local PipelineLint = {
steps: [
{
name: 'flake8',
image: 'python:3.8',
image: 'python:3.9',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install pipenv -qq',
'pipenv --bare install --dev --keep-outdated',
'pipenv run flake8 ./dockertidy',
'pip install poetry -qq',
'poetry install -q',
'poetry run flake8 ./dockertidy',
],
},
],
@ -44,36 +42,6 @@ local PipelineLint = {
},
};
local PipelineDeps = {
kind: 'pipeline',
name: 'dependencies',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'pipenv',
image: 'python:3.8',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install pipenv -qq',
'pipenv --bare install --keep-outdated',
'pipenv --bare install --dev --keep-outdated',
'pipenv run pipenv-setup check',
],
},
],
depends_on: [
'lint',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineTest = {
kind: 'pipeline',
name: 'test',
@ -86,9 +54,10 @@ local PipelineTest = {
PythonVersion(pyversion='3.6'),
PythonVersion(pyversion='3.7'),
PythonVersion(pyversion='3.8'),
PythonVersion(pyversion='3.9'),
{
name: 'codecov',
image: 'python:3.8',
image: 'python:3.9',
environment: {
PY_COLORS: 1,
CODECOV_TOKEN: { from_secret: 'codecov_token' },
@ -102,11 +71,12 @@ local PipelineTest = {
'python36-pytest',
'python37-pytest',
'python38-pytest',
'python39-pytest',
],
},
],
depends_on: [
'dependencies',
'lint',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
@ -123,14 +93,14 @@ local PipelineSecurity = {
steps: [
{
name: 'bandit',
image: 'python:3.8',
image: 'python:3.9',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install pipenv -qq',
'pipenv --bare install --dev --keep-outdated',
'pipenv run bandit -r ./dockertidy -x ./dockertidy/test',
'pip install poetry -qq',
'poetry install -q',
'poetry run bandit -r ./dockertidy -x ./dockertidy/test',
],
},
],
@ -152,12 +122,10 @@ local PipelineBuildPackage = {
steps: [
{
name: 'build',
image: 'python:3.8',
environment: {
SETUPTOOLS_SCM_PRETEND_VERSION: '${DRONE_TAG##v}',
},
image: 'python:3.9',
commands: [
'python setup.py sdist bdist_wheel',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry build',
],
},
{
@ -183,12 +151,14 @@ local PipelineBuildPackage = {
},
{
name: 'publish-pypi',
image: 'plugins/pypi',
settings: {
username: { from_secret: 'pypi_username' },
password: { from_secret: 'pypi_password' },
repository: 'https://upload.pypi.org/legacy/',
skip_build: true,
image: 'python:3.9',
commands: [
'pip install poetry poetry-dynamic-versioning -qq',
'poetry build',
],
environment: {
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: { from_secret: 'pypi_username' },
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: { from_secret: 'pypi_password' },
},
when: {
ref: ['refs/tags/**'],
@ -213,13 +183,11 @@ local PipelineBuildContainer(arch='amd64') = {
steps: [
{
name: 'build',
image: 'python:3.8',
image: 'python:3.9',
commands: [
'python setup.py bdist_wheel',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry build',
],
environment: {
SETUPTOOLS_SCM_PRETEND_VERSION: '${DRONE_TAG##v}',
},
},
{
name: 'dryrun',
@ -478,7 +446,6 @@ local PipelineNotifications = {
[
PipelineLint,
PipelineDeps,
PipelineTest,
PipelineSecurity,
PipelineBuildPackage,

View File

@ -8,11 +8,11 @@ platform:
steps:
- name: flake8
image: python:3.8
image: python:3.9
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run flake8 ./dockertidy
- pip install poetry -qq
- poetry install -q
- poetry run flake8 ./dockertidy
environment:
PY_COLORS: 1
@ -22,34 +22,6 @@ trigger:
- refs/tags/**
- refs/pull/**
---
kind: pipeline
name: dependencies
platform:
os: linux
arch: amd64
steps:
- name: pipenv
image: python:3.8
commands:
- pip install pipenv -qq
- pipenv --bare install --keep-outdated
- pipenv --bare install --dev --keep-outdated
- pipenv run pipenv-setup check
environment:
PY_COLORS: 1
trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**
depends_on:
- lint
---
kind: pipeline
name: test
@ -62,65 +34,70 @@ steps:
- name: python35-pytest
image: python:3.5
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- pip install -qq .
- docker-tidy --help
- docker-tidy --version
- pip install poetry -qq
- poetry install -q
- poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- poetry version
- poetry run docker-tidy --help
environment:
PY_COLORS: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
depends_on:
- clone
- name: python36-pytest
image: python:3.6
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- pip install -qq .
- docker-tidy --help
- docker-tidy --version
- pip install poetry -qq
- poetry install -q
- poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- poetry version
- poetry run docker-tidy --help
environment:
PY_COLORS: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
depends_on:
- clone
- name: python37-pytest
image: python:3.7
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- pip install -qq .
- docker-tidy --help
- docker-tidy --version
- pip install poetry -qq
- poetry install -q
- poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- poetry version
- poetry run docker-tidy --help
environment:
PY_COLORS: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
depends_on:
- clone
- name: python38-pytest
image: python:3.8
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- pip install -qq .
- docker-tidy --help
- docker-tidy --version
- pip install poetry -qq
- poetry install -q
- poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- poetry version
- poetry run docker-tidy --help
environment:
PY_COLORS: 1
depends_on:
- clone
- name: python39-pytest
image: python:3.9
commands:
- pip install poetry -qq
- poetry install -q
- poetry run pytest dockertidy --cov=dockertidy --cov-append --no-cov-on-fail
- poetry version
- poetry run docker-tidy --help
environment:
PY_COLORS: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
depends_on:
- clone
- name: codecov
image: python:3.8
image: python:3.9
commands:
- pip install codecov -qq
- codecov --required -X gcov
@ -133,6 +110,7 @@ steps:
- python36-pytest
- python37-pytest
- python38-pytest
- python39-pytest
trigger:
ref:
@ -141,7 +119,7 @@ trigger:
- refs/pull/**
depends_on:
- dependencies
- lint
---
kind: pipeline
@ -153,11 +131,11 @@ platform:
steps:
- name: bandit
image: python:3.8
image: python:3.9
commands:
- pip install pipenv -qq
- pipenv --bare install --dev --keep-outdated
- pipenv run bandit -r ./dockertidy -x ./dockertidy/test
- pip install poetry -qq
- poetry install -q
- poetry run bandit -r ./dockertidy -x ./dockertidy/test
environment:
PY_COLORS: 1
@ -180,11 +158,10 @@ platform:
steps:
- name: build
image: python:3.8
image: python:3.9
commands:
- python setup.py sdist bdist_wheel
environment:
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: checksum
image: alpine
@ -207,13 +184,14 @@ steps:
- refs/tags/**
- name: publish-pypi
image: plugins/pypi
settings:
password:
image: python:3.9
commands:
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
environment:
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD:
from_secret: pypi_password
repository: https://upload.pypi.org/legacy/
skip_build: true
username:
POETRY_HTTP_BASIC_TESTPYPI_USERNAME:
from_secret: pypi_username
when:
ref:
@ -238,11 +216,10 @@ platform:
steps:
- name: build
image: python:3.8
image: python:3.9
commands:
- python setup.py bdist_wheel
environment:
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:18-linux-amd64
@ -316,11 +293,10 @@ platform:
steps:
- name: build
image: python:3.8
image: python:3.9
commands:
- python setup.py bdist_wheel
environment:
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:18-linux-arm64
@ -394,11 +370,10 @@ platform:
steps:
- name: build
image: python:3.8
image: python:3.9
commands:
- python setup.py bdist_wheel
environment:
SETUPTOOLS_SCM_PRETEND_VERSION: ${DRONE_TAG##v}
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:18-linux-arm
@ -642,6 +617,6 @@ depends_on:
---
kind: signature
hmac: 41e4e1996dfd5b429fba2d13465a5a1875affe7f79bbdbcbd39b9449f89bf706
hmac: 0cca89c6ee5e4403f8fe70514e96aa7d596b7f0d74994d2e567993ae19c6692f
...

6
.style.yapf Normal file
View File

@ -0,0 +1,6 @@
[style]
based_on_style = google
column_limit = 99
dedent_closing_brackets = true
coalesce_brackets = true
split_before_logical_operator = true

20
Makefile Normal file
View File

@ -0,0 +1,20 @@
# renovate: datasource=github-releases depName=thegeeklab/hugo-geekdoc
THEME_VERSION := v0.5.0
THEME := hugo-geekdoc
BASEDIR := docs
THEMEDIR := $(BASEDIR)/themes
.PHONY: all
all: doc
.PHONY: doc
doc: doc-assets
.PHONY: doc-assets
doc-assets:
mkdir -p $(THEMEDIR)/$(THEME)/ ; \
curl -sSL "https://github.com/thegeeklab/$(THEME)/releases/download/${THEME_VERSION}/$(THEME).tar.gz" | tar -xz -C $(THEMEDIR)/$(THEME)/ --strip-components=1
.PHONY: clean
clean:
rm -rf $(THEMEDIR) && \

51
Pipfile
View File

@ -1,51 +0,0 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pipenv-setup = "*"
pydocstyle = "<4.0.0"
flake8 = "*"
flake8-colors = "*"
flake8-blind-except = "*"
flake8-builtins = "*"
flake8-docstrings = "<=3.0.0"
flake8-isort = "*"
flake8-logging-format = "*"
flake8-polyfill = "*"
flake8-quotes = "*"
flake8-pep3101 = "*"
flake8-eradicate = {version = "*",markers = "python_version>='3.6'"}
pep8-naming = "*"
pytest = "*"
pytest-mock = "*"
pytest-cov = "*"
bandit = "*"
docker-tidy = {editable = true,path = "."}
autopep8 = "*"
yapf = "*"
pathlib2 = "*"
[packages]
zipp = "<2.0.0"
importlib-metadata = {version = "*",markers = "python_version<'3.8'"}
certifi = "*"
chardet = "*"
docker = "*"
docker-pycreds = "*"
idna = "*"
ipaddress = "*"
python-dateutil = "*"
requests = "*"
appdirs = "*"
colorama = "*"
anyconfig = "*"
pathspec = "*"
python-json-logger = "*"
jsonschema = "*"
environs = "*"
nested-lookup = "*"
"ruamel.yaml" = "*"
websocket-client = "*"
dateparser = "*"

1087
Pipfile.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -143,3 +143,7 @@ class DockerTidy:
self.gc.run()
elif self.config.config["command"] == "stop":
self.stop.run()
def main():
DockerTidy()

View File

@ -1,15 +1,3 @@
#!/usr/bin/env python3
"""Default package."""
try:
from importlib import metadata
except ImportError: # for Python<3.8
import importlib_metadata as metadata
__author__ = "Robert Kaussow"
__project__ = "docker-tidy"
__license__ = "Apache-2.0"
__maintainer__ = "Robert Kaussow"
__email__ = "mail@thegeeklab.de"
__url__ = "https://github.com/thegeeklab/docker-tidy"
__version__ = metadata.version("docker-tidy")
__version__ = "0.0.0"

View File

@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""Main program."""
from dockertidy.Cli import DockerTidy
def main():
DockerTidy()
if __name__ == "__main__":
main()

1533
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

115
pyproject.toml Normal file
View File

@ -0,0 +1,115 @@
[tool.poetry]
authors = ["Robert Kaussow <mail@thegeeklab.de>"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
"Topic :: Software Development",
]
description = "Keep docker hosts tidy"
documentation = "https://docker-tidy.geekdocs.de/"
homepage = "https://docker-tidy.geekdocs.de/"
include = [
"LICENSE",
]
keywords = ["docker", "gc", "prune", "garbage"]
license = "Apache-2.0"
name = "docker-tidy"
packages = [
{include = "dockertidy"},
]
readme = "README.md"
repository = "https://github.com/thegeeklab/docker-tidy/"
version = "0.0.0"
[tool.poetry.dependencies]
anyconfig = "*"
appdirs = "*"
certifi = "*"
chardet = "*"
colorama = "*"
dateparser = "*"
docker = "*"
docker-pycreds = "*"
environs = "*"
idna = "*"
importlib-metadata = {version = "*", markers = "python_version<'3.8'"}
ipaddress = "*"
jsonschema = "*"
nested-lookup = "*"
pathspec = "*"
python = "^3.5.0"
python-dateutil = "*"
python-json-logger = "*"
requests = "*"
"ruamel.yaml" = "*"
websocket-client = "*"
zipp = "<2.0.0"
[tool.poetry.dev-dependencies]
autopep8 = "*"
bandit = "*"
coverage = {extras = ["toml"], version = "*"}
flake8 = "*"
flake8-blind-except = "*"
flake8-builtins = "*"
flake8-colors = "*"
flake8-docstrings = "<=3.0.0"
flake8-eradicate = {version = "*", markers = "python_version>='3.6'"}
flake8-isort = "*"
flake8-logging-format = "*"
flake8-pep3101 = "*"
flake8-polyfill = "*"
flake8-quotes = "*"
pathlib2 = "*"
pep8-naming = "*"
pipenv-setup = "*"
pydocstyle = "<4.0.0"
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
yapf = "*"
[tool.poetry.scripts]
docker-tidy = "dockertidy.Cli:main"
[tool.poetry-dynamic-versioning]
enable = true
style = "semver"
vcs = "git"
[tool.isort]
default_section = "THIRDPARTY"
force_single_line = true
known_first_party = "dockertidy"
line_length = 99
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip_glob = ["**/.env*", "**/env/*", "**/docs/*"]
[tool.pytest.ini_options]
addopts = "--cov=dockertidy --cov-report xml:coverage.xml --cov-append --no-cov-on-fail"
filterwarnings = [
"ignore::FutureWarning",
"ignore:.*collections.*:DeprecationWarning",
"ignore:.*pep8.*:FutureWarning",
]
[tool.coverage.run]
omit = ["**/test/*"]
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]

View File

@ -1,30 +0,0 @@
[metadata]
description-file = README.md
license_file = LICENSE
[bdist_wheel]
universal = 1
[isort]
default_section = THIRDPARTY
known_first_party = dockertidy
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
force_single_line = true
line_length = 99
skip_glob = **/.env*,**/env/*,**/docs/*
[yapf]
based_on_style = google
column_limit = 99
dedent_closing_brackets = true
coalesce_brackets = true
split_before_logical_operator = true
[tool:pytest]
filterwarnings =
ignore::FutureWarning
ignore:.*collections.*:DeprecationWarning
ignore:.*pep8.*:FutureWarning
[coverage:run]
omit = **/test/*

103
setup.py
View File

@ -1,103 +0,0 @@
#!/usr/bin/env python
"""Setup script for the package."""
import io
import os
import re
from setuptools import find_packages
from setuptools import setup
PACKAGE_NAME = "dockertidy"
def get_property(prop, project):
current_dir = os.path.dirname(os.path.realpath(__file__))
result = re.search(
r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop),
open(os.path.join(current_dir, project, "__init__.py")).read(),
)
return result.group(1)
def get_readme(filename="README.md"):
this = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(this, filename), encoding="utf-8") as f:
long_description = f.read()
return long_description
setup(
name=get_property("__project__", PACKAGE_NAME),
use_scm_version={
"version_scheme": "python-simplified-semver",
"local_scheme": "no-local-version",
"fallback_version": "unknown",
},
description="Keep docker hosts tidy",
keywords="docker gc prune garbage",
author=get_property("__author__", PACKAGE_NAME),
author_email=get_property("__email__", PACKAGE_NAME),
url=get_property("__url__", PACKAGE_NAME),
license=get_property("__license__", PACKAGE_NAME),
long_description=get_readme(),
long_description_content_type="text/markdown",
packages=find_packages(exclude=["*.test", "test", "test.*"]),
include_package_data=True,
zip_safe=False,
python_requires=">=3.5,<4",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
"Topic :: Software Development",
],
install_requires=[
"anyconfig==0.9.11",
"appdirs==1.4.4",
"attrs==19.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"certifi==2020.4.5.1",
"chardet==3.0.4",
"colorama==0.4.3",
"dateparser==0.7.4",
"docker==4.2.1",
"docker-pycreds==0.4.0",
"environs==8.0.0",
"idna==2.9",
"importlib-metadata==1.6.0; python_version < '3.8'",
"ipaddress==1.0.23",
"jsonschema==3.2.0",
"marshmallow==3.6.1; python_version >= '3.5'",
"nested-lookup==0.2.21",
"pathspec==0.8.0",
"pyrsistent==0.16.0",
"python-dateutil==2.8.1",
"python-dotenv==0.13.0",
"python-json-logger==0.1.11",
"pytz==2020.1",
"regex==2020.5.14",
"requests==2.23.0",
"ruamel.yaml==0.16.10",
"ruamel.yaml.clib==0.2.0; python_version < '3.9' and platform_python_implementation == 'CPython'",
"six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"tzlocal==2.1",
"urllib3==1.25.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"websocket-client==0.57.0",
"zipp==1.2.0",
],
dependency_links=[],
setup_requires=["setuptools_scm"],
entry_points={"console_scripts": ["docker-tidy = dockertidy.__main__:main"]},
)