Metadata-Version: 2.1
Name: c2cciutils
Version: 1.0.0.dev20201201
Summary: Common utilities for Camptocamp CI
Home-page: https://github.com/camptocamp/c2cciutils
Author: Camptocamp
Author-email: info@camptocamp.com
License: FreeBSD
Keywords: ci
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering :: GIS
Description-Content-Type: text/markdown
Requires-Dist: safety (==1.9.0)
Requires-Dist: Markdown (==3.3.3)
Requires-Dist: markdown-table
Requires-Dist: pipenv (==2020.11.15)
Requires-Dist: EditorConfig (==0.12.2)
Requires-Dist: python-magic (==0.4.18)
Requires-Dist: requests (==2.25.0)
Requires-Dist: black (==20.8b1)
Requires-Dist: click (==7.1.2)
Requires-Dist: isort (==5.6.4)
Requires-Dist: twine (==3.2.0)
Requires-Dist: codespell (==2.0.0)

# c2c CI utils


Commands:
  - c2cciutils: some generic tools.
  - c2cciutils-checks: Run the checks on the code (those checks don't need any project dependencies).
  - c2cciutils-audit: Do the audit, the main difference with checks is that it can change between runs on the same code.
  - c2cciutils-publish: Publish the project.
  - c2cciutils-clean: Delete Docker images on Docker Hub after corresponding branch have been deleted.


# New project

The content of example-project can be a good base for a new project.

# Configuration

You can get the current configuration with `c2cciutils --get-config`, the default configuration depends on your project.

You can override the configuration with the file `ci/config.yaml`.

At the base of the configuration you have:

* `version`: Contains some regular expressions to find the versions branches and tags, and to convert them into application versions.
* `checks`: The checkers configuration, see `c2cciutils/checks.py` for more information.
* `audit`: The audit configuration, see `c2cciutils/audit.py` for more information.
* `publish`: The publish configuration, see `c2cciutils/publish.py` for more information.

Many actions can be disabled by setting the corresponding configuration part to `False`.

# Publishing

## To pypi

When publishing, the version computed from arguments or GITHUB_REF is put in environment variable 'VERSION', thus you should use it in `setup.py`, example:

```python
VERSION = os.environ.get("VERSION", "1.0.0")
```

The config is like this:

```yaml
    versions: # List of kinds of versions you want to publish, that can be: custom (used by rebuild),
        # version_tag, version_branch, feature_branch, feature_tag (for pull request)
```

## To Docker registry

The config is like this:

```yaml
images:
  - name: # The base name of the image we want to publish
repository:
  <internal_name>:
      "server": # The fqdn name of the server if not Docker hub
      "version": # List of kinds of versions you want to publish, that can be: custom (used by rebuild),
          # version_tag, version_branch, feature_branch, feature_tag (for pull request)
      "tags": # List of tags we want to publish interpreted with `template(version=version)`
          # e.-g. if you use `{version}-lite` when you publish the version `1.2.3` the source tag
          # (that should be built by the application build) is `latest-lite`, and it will be published
          # with the tag `1.2.3-lite`.
      "group": # If your images are published by different jobs you can separate them in different groups
          # and publish them with `c2cciutils-publish --group=<group>`
```

With the `c2cciutils-clean` the images on Docker hub for `feature_branch` will be removed on branch removing.


