Containerization of common tools to support versioning

Clone this repo:
  1. e4baada Update to golangci-lint 1.44.2 by Elia Battiston · 2 years, 2 months ago master 2.5.3
  2. 271afae Correct version of 1.31.1 by Andrea Campanella · 3 years ago 2.5.2
  3. a13b2c5 Updating to grpc 1.13.1 by Andrea Campanella · 3 years ago 2.5.1
  4. 278fc16 Add support for the cpp plugin by David K. Bainbridge · 3 years ago 2.5.0
  5. e33a5bc VOL-3978 - update to latest go version by David K. Bainbridge · 3 years, 1 month ago 2.4.0

Dockerized Tools for Voltha

This repo contains Dockerfiles used to generate versioned tool containers.

Versioning

Final docker images are tagged with the image version from the VERSION file. This allows projects to specify a single "voltha toolchain version" and get all relevant tool versions.

The VERSION file should be changed using these rules:

  • Bump Patch version if:
    • Patch version of a tool has changed.
    • This repo's supporting files have changed (Makefile, readme, etc.) This rule assumes that the containers generated are backwards-compatible; if they are not, bump the major version instead.
  • Bump Minor version if:
    • Minor version of a tool has changed.
    • A new tool has been added.
  • Bump Major version if:
    • Major version of a tool has changed.
  • Bump patch/minor/major version according to semver rules if a Dockerfile is changed.
  • Reset lesser versions if greater versions change.
  • Do not use -dev versions.

Tool Usage

Only use containers tagged with <VERSION>-tool.
Do NOT use containers tagged with tool-<TOOL_VERSION>.

Some examples of how to use these containers:

  • golang - docker run --rm --user $(id -u):$(id -g) -v $PWD:/app -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang go <args>
  • golangci-lint - docker run --rm --user $(id -u):$(id -g) -v $PWD:/app -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golangci-lint golangci-lint <args>
  • protoc - docker run --rm --user $(id -u):$(id -g) -v $PWD:/app voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-protoc protoc <args>
  • hadolint - docker run --rm --user $(id -u):$(id -g) -v $PWD:/app voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-hadolint hadolint <args>

Details:

  • --user is specified so that generated files have sane ownership and permissions.
  • -v bind-mounts the local folder into the container.
  • -v is also used by golang containers to bind-mount volumes for caches.

Key Commands

  • make build to build containers
  • make lint to lint the Dockerfiles
  • make docker-push to push built containers to a registry