Compare commits

..

No commits in common. "master" and "v5.1.0" have entirely different histories.

11 changed files with 153 additions and 311 deletions

View file

@ -165,7 +165,7 @@ jobs:
name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }} name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }}
name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }} name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
custom-labels-annotations: labels:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
@ -183,11 +183,6 @@ jobs:
org.opencontainers.image.title=MyCustomTitle org.opencontainers.image.title=MyCustomTitle
org.opencontainers.image.description=this is a "good" example org.opencontainers.image.description=this is a "good" example
org.opencontainers.image.vendor=MyCompany org.opencontainers.image.vendor=MyCompany
annotations: |
maintainer=Foo
org.opencontainers.image.title=MyFooTitle
org.opencontainers.image.description=this is a "foo" example
org.opencontainers.image.vendor=MyFooCompany
global-exps: global-exps:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -377,8 +372,6 @@ jobs:
ghcr.io/name/app ghcr.io/name/app
labels: | labels: |
maintainer=CrazyMax maintainer=CrazyMax
annotations: |
maintainer=Foo
- -
name: Build name: Build
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
@ -389,7 +382,6 @@ jobs:
DOCKER_METADATA_OUTPUT_VERSION DOCKER_METADATA_OUTPUT_VERSION
DOCKER_METADATA_OUTPUT_TAGS DOCKER_METADATA_OUTPUT_TAGS
DOCKER_METADATA_OUTPUT_LABELS DOCKER_METADATA_OUTPUT_LABELS
DOCKER_METADATA_OUTPUT_ANNOTATIONS
DOCKER_METADATA_OUTPUT_JSON DOCKER_METADATA_OUTPUT_JSON
bake-annotations: bake-annotations:

View file

@ -47,7 +47,7 @@ ___
* [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone) * [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone)
* [Major version zero](#major-version-zero) * [Major version zero](#major-version-zero)
* [JSON output object](#json-output-object) * [JSON output object](#json-output-object)
* [Overwrite labels and annotations](#overwrite-labels-and-annotations) * [Overwrite labels](#overwrite-labels)
* [Annotations](#annotations) * [Annotations](#annotations)
* [Contributing](#contributing) * [Contributing](#contributing)
@ -294,16 +294,14 @@ The following inputs can be used as `step.with` keys:
> ``` > ```
| Name | Type | Description | | Name | Type | Description |
|-------------------|--------|------------------------------------------------------------------------------| |---------------|--------|-------------------------------------------------------------------------------|
| `context` | String | Where to get context data. Allowed options are: `workflow` (default), `git`. | | `context` | String | Where to get context data. Allowed options are: `workflow` (default), `git`. |
| `images` | List | List of Docker images to use as base name for tags | | `images` | List | List of Docker images to use as base name for tags |
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes | | `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
| `flavor` | List | [Flavor](#flavor-input) to apply | | `flavor` | List | [Flavor](#flavor-input) to apply |
| `labels` | List | List of custom labels | | `labels` | List | List of custom labels |
| `annotations` | List | List of custom anntoations |
| `sep-tags` | String | Separator to use for tags output (default `\n`) | | `sep-tags` | String | Separator to use for tags output (default `\n`) |
| `sep-labels` | String | Separator to use for labels output (default `\n`) | | `sep-labels` | String | Separator to use for labels output (default `\n`) |
| `sep-annotations` | String | Separator to use for annotations output (default `\n`) |
| `bake-target` | String | Bake target name (default `docker-metadata-action`) | | `bake-target` | String | Bake target name (default `docker-metadata-action`) |
### outputs ### outputs
@ -895,11 +893,10 @@ that you can reuse them further in your workflow using the [`fromJSON` function]
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
``` ```
### Overwrite labels and annotations ### Overwrite labels
If some [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md) If some [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
generated are not suitable as labels/annotations, you can overwrite them like labels generated are not suitable, you can overwrite them like this:
this:
```yaml ```yaml
- -
@ -957,17 +954,9 @@ The same can be done with the [`bake-action`](https://github.com/docker/bake-act
targets: build targets: build
``` ```
Note that annotations can be attached at many different levels within a manifest. If you want to set specific level(s) for your annotations, you can use the
By default, the generated annotations will be attached to image manifests,
but different registries may expect annotations at different places;
a common practice is to read annotations at _image indexes_ if present,
which are often used by multi-arch builds to index platform-specific images.
If you want to specify level(s) for your annotations, you can use the
[`DOCKER_METADATA_ANNOTATIONS_LEVELS` environment variable](#environment-variables) [`DOCKER_METADATA_ANNOTATIONS_LEVELS` environment variable](#environment-variables)
with a comma separated list of all levels the annotations should be attached to (defaults to `manifest`). with a comma separated list of levels (defaults to `manifest`):
The following configuration demonstrates the ability to attach annotations to both image manifests and image indexes,
though your registry may only need annotations at the index level. (That is, `index` alone may be enough.)
Please consult the documentation of your registry.
```yaml ```yaml
- -

View file

@ -39,10 +39,8 @@ describe('getInputs', () => {
githubToken: '', githubToken: '',
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'], images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
labels: [], labels: [],
annotations: [],
sepLabels: '\n', sepLabels: '\n',
sepTags: '\n', sepTags: '\n',
sepAnnotations: '\n',
tags: [], tags: [],
} as Inputs } as Inputs
], ],
@ -53,7 +51,6 @@ describe('getInputs', () => {
['images', 'moby/buildkit'], ['images', 'moby/buildkit'],
['sep-labels', ','], ['sep-labels', ','],
['sep-tags', ','], ['sep-tags', ','],
['sep-annotations', ',']
]), ]),
{ {
context: ContextSource.workflow, context: ContextSource.workflow,
@ -62,10 +59,8 @@ describe('getInputs', () => {
githubToken: '', githubToken: '',
images: ['moby/buildkit'], images: ['moby/buildkit'],
labels: [], labels: [],
annotations: [],
sepLabels: ',', sepLabels: ',',
sepTags: ',', sepTags: ',',
sepAnnotations: ',',
tags: [], tags: [],
} as Inputs } as Inputs
], ],
@ -81,10 +76,8 @@ describe('getInputs', () => {
githubToken: '', githubToken: '',
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'], images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
labels: [], labels: [],
annotations: [],
sepLabels: '\n', sepLabels: '\n',
sepTags: '\n', sepTags: '\n',
sepAnnotations: '\n',
tags: [], tags: [],
} as Inputs } as Inputs
], ],

View file

@ -49,7 +49,7 @@ describe('isRawStatement', () => {
}); });
}); });
const tagsLabelsTest = async (name: string, envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabels: Array<string>, exAnnotations: Array<string> | undefined) => { const tagsLabelsTest = async (name: string, envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabels: Array<string>) => {
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile))); process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
const toolkit = new Toolkit(); const toolkit = new Toolkit();
const repo = await toolkit.github.repoData(); const repo = await toolkit.github.repoData();
@ -63,9 +63,6 @@ const tagsLabelsTest = async (name: string, envFile: string, inputs: Inputs, exV
const labels = meta.getLabels(); const labels = meta.getLabels();
expect(labels).toEqual(exLabels); expect(labels).toEqual(exLabels);
const annotations = meta.getAnnotations();
expect(annotations).toEqual(exAnnotations ?? exLabels);
}; };
describe('null', () => { describe('null', () => {
@ -93,8 +90,7 @@ describe('null', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=" "org.opencontainers.image.version="
], ]
undefined
], ],
[ [
'null02', 'null02',
@ -121,8 +117,7 @@ describe('null', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=" "org.opencontainers.image.version="
], ]
undefined
], ],
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -154,8 +149,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'push02', 'push02',
@ -183,8 +177,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push03', 'push03',
@ -209,8 +202,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=master" "org.opencontainers.image.version=master"
], ]
undefined
], ],
[ [
'push04', 'push04',
@ -238,8 +230,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push05', 'push05',
@ -265,8 +256,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'push06', 'push06',
@ -295,8 +285,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push07', 'push07',
@ -328,8 +317,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'push08', 'push08',
@ -361,8 +349,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push09', 'push09',
@ -394,8 +381,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push10', 'push10',
@ -425,8 +411,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-2665741" "org.opencontainers.image.version=sha-2665741"
], ]
undefined
], ],
[ [
'push11', 'push11',
@ -456,8 +441,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-983315b" "org.opencontainers.image.version=sha-983315b"
], ]
undefined
], ],
[ [
'push12', 'push12',
@ -485,8 +469,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=" "org.opencontainers.image.version="
], ]
undefined
], ],
[ [
'push13', 'push13',
@ -516,8 +499,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=master" "org.opencontainers.image.version=master"
], ]
undefined
], ],
[ [
'push14', 'push14',
@ -549,8 +531,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.3" "org.opencontainers.image.version=1.2.3"
], ]
undefined
], ],
[ [
'push15', 'push15',
@ -581,8 +562,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.3" "org.opencontainers.image.version=1.2.3"
], ]
undefined
], ],
[ [
'push16', 'push16',
@ -611,8 +591,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=edge" "org.opencontainers.image.version=edge"
], ]
undefined
], ],
[ [
'push17', 'push17',
@ -656,8 +635,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master" "org.opencontainers.image.version=mytag-master"
], ]
undefined
], ],
[ [
'push18', 'push18',
@ -689,8 +667,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'push19', 'push19',
@ -722,8 +699,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-860c1904a1ce19322e91ac35af1ab07466440c37" "org.opencontainers.image.version=sha-860c1904a1ce19322e91ac35af1ab07466440c37"
], ]
undefined
], ],
[ [
'push20', 'push20',
@ -756,8 +732,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-860c1904a1ce19322e91ac35af1ab07466440c37" "org.opencontainers.image.version=sha-860c1904a1ce19322e91ac35af1ab07466440c37"
], ]
undefined
], ],
[ [
'push21', 'push21',
@ -801,8 +776,7 @@ describe('push', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master" "org.opencontainers.image.version=mytag-master"
], ]
undefined
] ]
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -835,8 +809,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=release1" "org.opencontainers.image.version=release1"
], ]
undefined
], ],
[ [
'tag02', 'tag02',
@ -862,8 +835,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110-RC2" "org.opencontainers.image.version=20200110-RC2"
], ]
undefined
], ],
[ [
'tag03', 'tag03',
@ -894,8 +866,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110" "org.opencontainers.image.version=20200110"
], ]
undefined
], ],
[ [
'tag04', 'tag04',
@ -926,8 +897,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110" "org.opencontainers.image.version=20200110"
], ]
undefined
], ],
[ [
'tag05', 'tag05',
@ -958,8 +928,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'tag06', 'tag06',
@ -990,8 +959,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'tag07', 'tag07',
@ -1022,8 +990,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0.8-beta.67" "org.opencontainers.image.version=2.0.8-beta.67"
], ]
undefined
], ],
[ [
'tag08', 'tag08',
@ -1054,8 +1021,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0" "org.opencontainers.image.version=2.0"
], ]
undefined
], ],
[ [
'tag09', 'tag09',
@ -1089,8 +1055,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0.8" "org.opencontainers.image.version=2.0.8"
], ]
undefined
], ],
[ [
'tag10', 'tag10',
@ -1116,8 +1081,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=" "org.opencontainers.image.version="
], ]
undefined
], ],
[ [
'tag11', 'tag11',
@ -1154,8 +1118,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'tag12', 'tag12',
@ -1187,8 +1150,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'tag13', 'tag13',
@ -1218,8 +1180,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0.8-beta.67" "org.opencontainers.image.version=2.0.8-beta.67"
], ]
undefined
], ],
[ [
'tag14', 'tag14',
@ -1253,8 +1214,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sometag" "org.opencontainers.image.version=sometag"
], ]
undefined
], ],
[ [
'tag15', 'tag15',
@ -1289,8 +1249,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo" "org.opencontainers.image.version=foo"
], ]
undefined
], ],
[ [
'tag16', 'tag16',
@ -1323,8 +1282,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo" "org.opencontainers.image.version=foo"
], ]
undefined
], ],
[ [
'tag17', 'tag17',
@ -1363,8 +1321,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.0.0" "org.opencontainers.image.version=1.0.0"
], ]
undefined
], ],
[ [
'tag18', 'tag18',
@ -1403,8 +1360,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.0.0" "org.opencontainers.image.version=1.0.0"
], ]
undefined
], ],
[ [
'tag19', 'tag19',
@ -1445,8 +1401,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.0.0-dev" "org.opencontainers.image.version=1.0.0-dev"
], ]
undefined
], ],
[ [
'tag20', 'tag20',
@ -1481,8 +1436,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1-860c190-foo" "org.opencontainers.image.version=v1.1.1-860c190-foo"
], ]
undefined
], ],
[ [
'tag21', 'tag21',
@ -1517,8 +1471,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1-dev" "org.opencontainers.image.version=1.1.1-dev"
], ]
undefined
], ],
[ [
'tag22', 'tag22',
@ -1554,8 +1507,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo-1.1.1-dev" "org.opencontainers.image.version=foo-1.1.1-dev"
], ]
undefined
], ],
[ [
'tag23', 'tag23',
@ -1586,8 +1538,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
], ],
[ [
'tag24', 'tag24',
@ -1617,8 +1568,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2" "org.opencontainers.image.version=1.2"
], ]
undefined
], ],
[ [
'tag25', 'tag25',
@ -1648,8 +1598,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1b2" "org.opencontainers.image.version=1.1b2"
], ]
undefined
], ],
[ [
'tag26', 'tag26',
@ -1679,8 +1628,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.0.dev4" "org.opencontainers.image.version=1.0.dev4"
], ]
undefined
], ],
[ [
'tag27', 'tag27',
@ -1712,8 +1660,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.3rc2" "org.opencontainers.image.version=1.2.3rc2"
], ]
undefined
], ],
[ [
'tag28', 'tag28',
@ -1750,8 +1697,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'tag29', 'tag29',
@ -1781,8 +1727,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.post1" "org.opencontainers.image.version=1.2.post1"
], ]
undefined
], ],
[ [
'tag30', 'tag30',
@ -1816,8 +1761,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sometag" "org.opencontainers.image.version=sometag"
], ]
undefined
], ],
[ [
'tag31', 'tag31',
@ -1846,8 +1790,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v2.0.8-beta.67" "org.opencontainers.image.version=v2.0.8-beta.67"
], ]
undefined
], ],
[ [
'tag32', 'tag32',
@ -1879,8 +1822,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.2.3rc2" "org.opencontainers.image.version=v1.2.3rc2"
], ]
undefined
], ],
[ [
'tag33', 'tag33',
@ -1917,8 +1859,7 @@ describe('tag', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
] ]
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -1954,8 +1895,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=release1" "org.opencontainers.image.version=release1"
], ]
undefined
], ],
[ [
'latest02', 'latest02',
@ -1984,8 +1924,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110-RC2" "org.opencontainers.image.version=20200110-RC2"
], ]
undefined
], ],
[ [
'latest03', 'latest03',
@ -2014,8 +1953,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110" "org.opencontainers.image.version=20200110"
], ]
undefined
], ],
[ [
'latest04', 'latest04',
@ -2044,8 +1982,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'latest05', 'latest05',
@ -2073,8 +2010,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
], ],
[ [
'latest06', 'latest06',
@ -2105,8 +2041,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0.8" "org.opencontainers.image.version=2.0.8"
], ]
undefined
], ],
[ [
'latest07', 'latest07',
@ -2138,8 +2073,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
], ],
[ [
'latest08', 'latest08',
@ -2171,8 +2105,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
], ],
[ [
'latest09', 'latest09',
@ -2190,12 +2123,6 @@ describe('latest', () => {
`org.opencontainers.image.description=this is a "good" example`, `org.opencontainers.image.description=this is a "good" example`,
"org.opencontainers.image.title=MyCustomTitle", "org.opencontainers.image.title=MyCustomTitle",
"org.opencontainers.image.vendor=MyCompany", "org.opencontainers.image.vendor=MyCompany",
],
annotations: [
"maintainer=Foo",
`org.opencontainers.image.description=this is a "bad" example`,
"org.opencontainers.image.title=MyNotTitle",
"org.opencontainers.image.vendor=MyNotCompany",
] ]
} as Inputs, } as Inputs,
{ {
@ -2218,18 +2145,6 @@ describe('latest', () => {
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.vendor=MyCompany", "org.opencontainers.image.vendor=MyCompany",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
],
[
"maintainer=Foo",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
`org.opencontainers.image.description=this is a "bad" example`,
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=MyNotTitle",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.vendor=MyNotCompany",
"org.opencontainers.image.version=v1.1.1"
] ]
], ],
[ [
@ -2259,8 +2174,7 @@ describe('latest', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=2.0.8" "org.opencontainers.image.version=2.0.8"
], ]
undefined
] ]
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -2292,8 +2206,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=pr-15" "org.opencontainers.image.version=pr-15"
], ]
undefined
], ],
[ [
'pr02', 'pr02',
@ -2319,8 +2232,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=pr-15" "org.opencontainers.image.version=pr-15"
], ]
undefined
], ],
[ [
'pr03', 'pr03',
@ -2352,8 +2264,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=pr-15" "org.opencontainers.image.version=pr-15"
], ]
undefined
], ],
[ [
'pr04', 'pr04',
@ -2385,8 +2296,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-a9c8c58" "org.opencontainers.image.version=sha-a9c8c58"
], ]
undefined
], ],
[ [
'pr05', 'pr05',
@ -2419,8 +2329,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=pr-15-bal" "org.opencontainers.image.version=pr-15-bal"
], ]
undefined
], ],
[ [
'pr06', 'pr06',
@ -2453,8 +2362,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=15-bal" "org.opencontainers.image.version=15-bal"
], ]
undefined
], ],
[ [
'pr07', 'pr07',
@ -2486,8 +2394,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-2665741" "org.opencontainers.image.version=sha-2665741"
], ]
undefined
], ],
[ [
'pr08', 'pr08',
@ -2520,8 +2427,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=15-bal" "org.opencontainers.image.version=15-bal"
], ]
undefined
], ],
[ [
'pr09', 'pr09',
@ -2558,8 +2464,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=pr-15" "org.opencontainers.image.version=pr-15"
], ]
undefined
], ],
[ [
'pr10', 'pr10',
@ -2588,8 +2493,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master" "org.opencontainers.image.version=mytag-master"
], ]
undefined
], ],
[ [
'pr11', 'pr11',
@ -2618,8 +2522,7 @@ describe('pr', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master" "org.opencontainers.image.version=mytag-master"
], ]
undefined
], ],
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -2969,7 +2872,7 @@ describe('pr-head-sha', () => {
"org.opencontainers.image.version=mytag-master" "org.opencontainers.image.version=mytag-master"
] ]
], ],
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabelsAnnotations: Array<string>) => { ])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabels: Array<string>) => {
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile))); process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
process.env.DOCKER_METADATA_PR_HEAD_SHA = 'true'; process.env.DOCKER_METADATA_PR_HEAD_SHA = 'true';
@ -2984,10 +2887,7 @@ describe('pr-head-sha', () => {
expect(tags).toEqual(exTags); expect(tags).toEqual(exTags);
const labels = meta.getLabels(); const labels = meta.getLabels();
expect(labels).toEqual(exLabelsAnnotations); expect(labels).toEqual(exLabels);
const annotations = meta.getAnnotations();
expect(annotations).toEqual(exLabelsAnnotations);
}); });
}); });
@ -3019,8 +2919,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=nightly" "org.opencontainers.image.version=nightly"
], ]
undefined
], ],
[ [
'schedule02', 'schedule02',
@ -3048,8 +2947,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110" "org.opencontainers.image.version=20200110"
], ]
undefined
], ],
[ [
'schedule03', 'schedule03',
@ -3077,8 +2975,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110-003000" "org.opencontainers.image.version=20200110-003000"
], ]
undefined
], ],
[ [
'schedule04', 'schedule04',
@ -3106,8 +3003,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=nightly" "org.opencontainers.image.version=nightly"
], ]
undefined
], ],
[ [
'schedule05', 'schedule05',
@ -3139,8 +3035,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=nightly" "org.opencontainers.image.version=nightly"
], ]
undefined
], ],
[ [
'schedule06', 'schedule06',
@ -3178,8 +3073,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-860c190" "org.opencontainers.image.version=sha-860c190"
], ]
undefined
], ],
[ [
'schedule07', 'schedule07',
@ -3212,8 +3106,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=glo-nightly-bal" "org.opencontainers.image.version=glo-nightly-bal"
], ]
undefined
], ],
[ [
'schedule08', 'schedule08',
@ -3241,8 +3134,7 @@ describe('schedule', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110-093000" "org.opencontainers.image.version=20200110-093000"
], ]
undefined
], ],
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@ -3275,8 +3167,7 @@ describe('release', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
], ],
[ [
'release02', 'release02',
@ -3310,8 +3201,7 @@ describe('release', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=v1.1.1" "org.opencontainers.image.version=v1.1.1"
], ]
undefined
] ]
])('given %s with %p event', tagsLabelsTest); ])('given %s with %p event', tagsLabelsTest);
}); });
@ -3352,8 +3242,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'raw02', 'raw02',
@ -3383,8 +3272,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=dev" "org.opencontainers.image.version=dev"
], ]
undefined
], ],
[ [
'raw03', 'raw03',
@ -3419,8 +3307,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=release1" "org.opencontainers.image.version=release1"
], ]
undefined
], ],
[ [
'raw04', 'raw04',
@ -3457,8 +3344,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=20200110" "org.opencontainers.image.version=20200110"
], ]
undefined
], ],
[ [
'raw05', 'raw05',
@ -3504,8 +3390,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1" "org.opencontainers.image.version=1.1.1"
], ]
undefined
], ],
[ [
'raw06', 'raw06',
@ -3540,8 +3425,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=my" "org.opencontainers.image.version=my"
], ]
undefined
], ],
[ [
'raw07', 'raw07',
@ -3579,8 +3463,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=my" "org.opencontainers.image.version=my"
], ]
undefined
], ],
[ [
'raw08', 'raw08',
@ -3616,8 +3499,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=my" "org.opencontainers.image.version=my"
], ]
undefined
], ],
[ [
'raw09', 'raw09',
@ -3655,8 +3537,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo-my-bar" "org.opencontainers.image.version=foo-my-bar"
], ]
undefined
], ],
[ [
'raw10', 'raw10',
@ -3690,8 +3571,7 @@ describe('raw', () => {
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo" "org.opencontainers.image.version=foo"
], ]
undefined
], ],
])('given %p wth %p event', tagsLabelsTest); ])('given %p wth %p event', tagsLabelsTest);
}); });
@ -3735,6 +3615,7 @@ describe('json', () => {
"org.opencontainers.image.version": "dev" "org.opencontainers.image.version": "dev"
}, },
"annotations": [ "annotations": [
"manifest:foo=",
"manifest:org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "manifest:org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"manifest:org.opencontainers.image.description=This your first repo!", "manifest:org.opencontainers.image.description=This your first repo!",
"manifest:org.opencontainers.image.licenses=MIT", "manifest:org.opencontainers.image.licenses=MIT",
@ -3996,13 +3877,15 @@ describe('json', () => {
"org.opencontainers.image.version": "v1.1.1" "org.opencontainers.image.version": "v1.1.1"
}, },
"annotations": [ "annotations": [
"manifest:maintainer=CrazyMax",
"manifest:org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "manifest:org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"manifest:org.opencontainers.image.description=This your first repo!", "manifest:org.opencontainers.image.description=Another description",
"manifest:org.opencontainers.image.licenses=MIT", "manifest:org.opencontainers.image.licenses=MIT",
"manifest:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37", "manifest:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"manifest:org.opencontainers.image.source=https://github.com/octocat/Hello-World", "manifest:org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"manifest:org.opencontainers.image.title=Hello-World", "manifest:org.opencontainers.image.title=MyCustom=Title",
"manifest:org.opencontainers.image.url=https://github.com/octocat/Hello-World", "manifest:org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"manifest:org.opencontainers.image.vendor=MyCompany",
"manifest:org.opencontainers.image.version=v1.1.1" "manifest:org.opencontainers.image.version=v1.1.1"
] ]
} }
@ -4502,21 +4385,25 @@ describe('bakeFile', () => {
"target": { "target": {
"docker-metadata-action": { "docker-metadata-action": {
"annotations": [ "annotations": [
"index:maintainer=CrazyMax",
"index:org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "index:org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"index:org.opencontainers.image.description=This your first repo!", "index:org.opencontainers.image.description=Another description",
"index:org.opencontainers.image.licenses=MIT", "index:org.opencontainers.image.licenses=MIT",
"index:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37", "index:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"index:org.opencontainers.image.source=https://github.com/octocat/Hello-World", "index:org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"index:org.opencontainers.image.title=Hello-World", "index:org.opencontainers.image.title=MyCustom=Title",
"index:org.opencontainers.image.url=https://github.com/octocat/Hello-World", "index:org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"index:org.opencontainers.image.vendor=MyCompany",
"index:org.opencontainers.image.version=v1.1.1", "index:org.opencontainers.image.version=v1.1.1",
"manifest-descriptor:maintainer=CrazyMax",
"manifest-descriptor:org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "manifest-descriptor:org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"manifest-descriptor:org.opencontainers.image.description=This your first repo!", "manifest-descriptor:org.opencontainers.image.description=Another description",
"manifest-descriptor:org.opencontainers.image.licenses=MIT", "manifest-descriptor:org.opencontainers.image.licenses=MIT",
"manifest-descriptor:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37", "manifest-descriptor:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"manifest-descriptor:org.opencontainers.image.source=https://github.com/octocat/Hello-World", "manifest-descriptor:org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"manifest-descriptor:org.opencontainers.image.title=Hello-World", "manifest-descriptor:org.opencontainers.image.title=MyCustom=Title",
"manifest-descriptor:org.opencontainers.image.url=https://github.com/octocat/Hello-World", "manifest-descriptor:org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"manifest-descriptor:org.opencontainers.image.vendor=MyCompany",
"manifest-descriptor:org.opencontainers.image.version=v1.1.1" "manifest-descriptor:org.opencontainers.image.version=v1.1.1"
] ]
} }

View file

@ -23,18 +23,12 @@ inputs:
labels: labels:
description: 'List of custom labels' description: 'List of custom labels'
required: false required: false
annotations:
description: 'List of custom annotations'
required: false
sep-tags: sep-tags:
description: 'Separator to use for tags output (default \n)' description: 'Separator to use for tags output (default \n)'
required: false required: false
sep-labels: sep-labels:
description: 'Separator to use for labels output (default \n)' description: 'Separator to use for labels output (default \n)'
required: false required: false
sep-annotations:
description: 'Separator to use for annotations output (default \n)'
required: false
bake-target: bake-target:
description: 'Bake target name (default docker-metadata-action)' description: 'Bake target name (default docker-metadata-action)'
required: false required: false

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -10,10 +10,8 @@ export interface Inputs {
tags: string[]; tags: string[];
flavor: string[]; flavor: string[];
labels: string[]; labels: string[];
annotations: string[];
sepTags: string; sepTags: string;
sepLabels: string; sepLabels: string;
sepAnnotations: string;
bakeTarget: string; bakeTarget: string;
githubToken: string; githubToken: string;
} }
@ -25,10 +23,8 @@ export function getInputs(): Inputs {
tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}), tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}),
flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}), flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}),
labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}), labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}),
annotations: Util.getInputList('annotations', {ignoreComma: true, comment: '#'}),
sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`, sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`,
sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`, sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`,
sepAnnotations: core.getInput('sep-annotations', {trimWhitespace: false}) || `\n`,
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`, bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
githubToken: core.getInput('github-token') githubToken: core.getInput('github-token')
}; };

View file

@ -71,31 +71,32 @@ actionsToolkit.run(
}); });
// Annotations // Annotations
const annotationsRaw: Array<string> = meta.getAnnotations(); const alevels = process.env.DOCKER_METADATA_ANNOTATIONS_LEVELS || 'manifest';
const annotationsLevels = process.env.DOCKER_METADATA_ANNOTATIONS_LEVELS || 'manifest'; if (labels.length > 0) {
await core.group(`Annotations`, async () => { await core.group(`Annotations`, async () => {
const annotations: Array<string> = []; const annotations: Array<string> = [];
for (const level of annotationsLevels.split(',')) { for (const level of alevels.split(',')) {
annotations.push( annotations.push(
...annotationsRaw.map(label => { ...labels.map(label => {
const v = `${level}:${label}`; const v = `${level}:${label}`;
core.info(v); core.info(v);
return v; return v;
}) })
); );
} }
setOutput(`annotations`, annotations.join(inputs.sepAnnotations)); setOutput(`annotations`, annotations.join(inputs.sepLabels));
}); });
}
// JSON // JSON
const jsonOutput = meta.getJSON(annotationsLevels.split(',')); const jsonOutput = meta.getJSON(alevels.split(','));
await core.group(`JSON output`, async () => { await core.group(`JSON output`, async () => {
core.info(JSON.stringify(jsonOutput, null, 2)); core.info(JSON.stringify(jsonOutput, null, 2));
setOutput('json', JSON.stringify(jsonOutput)); setOutput('json', JSON.stringify(jsonOutput));
}); });
// Bake files // Bake files
for (const kind of ['tags', 'labels', 'annotations:' + annotationsLevels]) { for (const kind of ['tags', 'labels', 'annotations:' + alevels]) {
const outputName = kind.split(':')[0]; const outputName = kind.split(':')[0];
const bakeFile: string = meta.getBakeFile(kind); const bakeFile: string = meta.getBakeFile(kind);
await core.group(`Bake file definition (${outputName})`, async () => { await core.group(`Bake file definition (${outputName})`, async () => {

View file

@ -468,15 +468,7 @@ export class Meta {
} }
public getLabels(): Array<string> { public getLabels(): Array<string> {
return this.getOCIAnnotationsWithCustoms(this.inputs.labels); const labels: Array<string> = [
}
public getAnnotations(): Array<string> {
return this.getOCIAnnotationsWithCustoms(this.inputs.annotations);
}
private getOCIAnnotationsWithCustoms(extra: string[]): Array<string> {
const res: Array<string> = [
`org.opencontainers.image.title=${this.repo.name || ''}`, `org.opencontainers.image.title=${this.repo.name || ''}`,
`org.opencontainers.image.description=${this.repo.description || ''}`, `org.opencontainers.image.description=${this.repo.description || ''}`,
`org.opencontainers.image.url=${this.repo.html_url || ''}`, `org.opencontainers.image.url=${this.repo.html_url || ''}`,
@ -486,11 +478,11 @@ export class Meta {
`org.opencontainers.image.revision=${this.context.sha || ''}`, `org.opencontainers.image.revision=${this.context.sha || ''}`,
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}` `org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
]; ];
res.push(...extra); labels.push(...this.inputs.labels);
return Array.from( return Array.from(
new Map<string, string>( new Map<string, string>(
res labels
.map(label => label.split('=')) .map(label => label.split('='))
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
.filter(([_key, ...values]) => values.length > 0) .filter(([_key, ...values]) => values.length > 0)
@ -504,7 +496,7 @@ export class Meta {
public getJSON(alevels: string[]): unknown { public getJSON(alevels: string[]): unknown {
const annotations: Array<string> = []; const annotations: Array<string> = [];
for (const level of alevels) { for (const level of alevels) {
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`)); annotations.push(...this.getLabels().map(label => `${level}:${label}`));
} }
return { return {
tags: this.getTags(), tags: this.getTags(),
@ -544,7 +536,7 @@ export class Meta {
const name = kind.split(':')[0]; const name = kind.split(':')[0];
const annotations: Array<string> = []; const annotations: Array<string> = [];
for (const level of kind.split(':')[1].split(',')) { for (const level of kind.split(':')[1].split(',')) {
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`)); annotations.push(...this.getLabels().map(label => `${level}:${label}`));
} }
return this.generateBakeFile(name, { return this.generateBakeFile(name, {
annotations: annotations annotations: annotations

View file

@ -4,11 +4,9 @@ RUN apk add --no-cache coreutils jq
ARG DOCKER_METADATA_OUTPUT_VERSION ARG DOCKER_METADATA_OUTPUT_VERSION
ARG DOCKER_METADATA_OUTPUT_TAGS ARG DOCKER_METADATA_OUTPUT_TAGS
ARG DOCKER_METADATA_OUTPUT_LABELS ARG DOCKER_METADATA_OUTPUT_LABELS
ARG DOCKER_METADATA_OUTPUT_ANNOTATIONS
ARG DOCKER_METADATA_OUTPUT_JSON ARG DOCKER_METADATA_OUTPUT_JSON
RUN printenv DOCKER_METADATA_OUTPUT_VERSION RUN printenv DOCKER_METADATA_OUTPUT_VERSION
RUN printenv DOCKER_METADATA_OUTPUT_TAGS RUN printenv DOCKER_METADATA_OUTPUT_TAGS
RUN printenv DOCKER_METADATA_OUTPUT_LABELS RUN printenv DOCKER_METADATA_OUTPUT_LABELS
RUN printenv DOCKER_METADATA_OUTPUT_ANNOTATIONS
RUN printenv DOCKER_METADATA_OUTPUT_JSON RUN printenv DOCKER_METADATA_OUTPUT_JSON
RUN echo $DOCKER_METADATA_OUTPUT_JSON | jq RUN echo $DOCKER_METADATA_OUTPUT_JSON | jq