diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12a40d4..63f51b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,30 +2,30 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml exclude: examples/ + - id: check-json + - id: check-toml - id: check-added-large-files + - id: check-symlinks - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 + rev: v1.5.0 hooks: - id: detect-secrets exclude: test/ - - repo: https://github.com/hhatto/autopep8 - rev: v2.0.4 - hooks: - - id: autopep8 - entry: autopep8 - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.0.275 + rev: v0.5.1 hooks: - id: ruff + args: [ --fix ] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.4.0' + rev: 'v1.10.1' hooks: - id: mypy args: ['--install-types', '--non-interactive'] diff --git a/README.md b/README.md index 4bc9275..72db64f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,20 @@ # image-tools v0.0.11 -Commandline tools to manage Stackable container images available at https://github.com/stackabletech/docker-images +Command line tools to manage Stackable container images available at [docker-images](https://github.com/stackabletech/docker-images) This repository (and the installable package) contain two tools: * `bake` : build and publish product images. * `check-container` : run RedHat preflight checks on container images. +The `bake` command provides the following features: + +* Build all Stackable product images +* Build individual product images +* Build individual product version images +* Use one or more distributed docker cache servers +* Publish images + ## Usage examples Run either `bake` or `check-container` with `--help` to get an overview of the accepted flags and their functionality. @@ -19,6 +27,9 @@ bake -p hello-world -i 0.0.0-dev # Build only one version [0.37.2] of OPA bake -p opa=0.37.2 -i 0.0.0-dev +# Enable distributed docker cache (requires credentials to access the cache registry) +bake -p opa --cache + # Build half of all versions defined for OPA bake -p opa -i 0.0.0-dev --shard-count 2 --shard-index 0 @@ -66,15 +77,41 @@ in } ``` +## Development + +Create a virtual environment where you install the package in "editable" mode: + +Using `venv` and `pip`: + +```shell +python -m venv ~/venv-image-tools-devel +source ~/venv-image-tools-devel/bin/activate +pip install --editable . +``` + +Using [pipx](https://pypa.github.io/pipx/): + +```shell +pipx install --editable . +``` + +With the activated virtual environment, you can now run the tools from the `docker-images` repository and any local changes are immediately in effect. + ## Release a new version -Update the version in: +1. Create a release PR where you: +1.1. Update the version in: * `src/image_tools/version.py` * `README.md` : version and pip install command. -Update the CHANGELOG. -Commit and tag. +1.2. Update the CHANGELOG. +2. Tag the release commit after it is merged to `main`. +3. Automated GH actions will publish the new version to PyPI. + + +To publish manually (requires PyPI credentials): + Build and publish: ```shell diff --git a/pyproject.toml b/pyproject.toml index 620b18f..50abd02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ ] dependencies = ["Jinja2>=3.1.2", "PyYAML>=6.0"] [project.optional-dependencies] -lint = ['ruff>=0.4', 'mypy>=1.10'] +lint = ['ruff>=0.5', 'mypy>=1.10'] publish = ['twine>=5.0', 'build>=1.2'] [project.scripts]