Skip to content
README.md 1.85 KiB
Newer Older
Matthew Clarkson's avatar
Matthew Clarkson committed
# `dockerode-tag`

> A `semantic-release` plugin to pull, tag and push open container images using [dockerode][dockerrode]

## Getting Started

```sh
npm config set always-auth true
npm config set @semantic-release:registry https://gitlab.gpu.arm.com/api/v4/packages/npm/
npm config set -- '//gitlab.gpu.arm.com/api/v4/packages/npm/:_authToken' '${GITLAB_TOKEN}'
export GITLAB_TOKEN="<personal-access-token>"
npm install --save-dev @semantic-release/dockerode-tag
```

Add the following to `.releaserc.yaml`:

```yaml
plugins:
  - path: "@semantic-release"
    images:
      - "${CI_REGISTRY_IMAGE}/node:${CI_COMMIT_SHA}"
```

## Configuration

## `images`

By default the plugin will tag each provided image with the next release version as a tag.

These are equivalent configurations:

```yaml
plugins:
  - path: "@semantic-release"
    images:
      - "${CI_REGISTRY_IMAGE}/node:${CI_COMMIT_SHA}"
```

```yaml
plugins:
  - path: "@semantic-release"
    images:
      - image: "${CI_REGISTRY_IMAGE}/node:${CI_COMMIT_SHA}"
        tag: "${nextRelease.version}"
```

## Authentication

When pulling/pushing the containers requires authentication it can be provided via configuration arguments:

```yaml
plugins:
  - path: "@semantic-release"
    images:
      - "${CI_REGISTRY_IMAGE}/node:${CI_COMMIT_SHA}"
    username: "someone"
    password: "????"  # Not recommended, use `DOCKERODE_PASSWORD`
    email: "someone@somewhere.com"
    server: "https://the.container:5050/endpoint/v2"
```

The other option is to use the relevant `DOCKERODE` environment variables:

- `DOCKERODE_USERNAME`
- `DOCKERODE_PASSWORD`
- `DOCKERODE_EMAIL`
- `DOCKERODE_SERVER`

# Docker

The plugin respects the following Docker environment variables:

- `DOCKER_HOST`
- `DOCKER_CERT_PATH` / `DOCKER_TLS_CERTDIR`
- `DOCKER_TLS_VERIFY`
- `DOCKER_CLIENT_TIMEOUT`

Matthew Clarkson's avatar
Matthew Clarkson committed
[dockerode]: https://github.com/apocas/dockerode#readme