mirror of
https://github.com/docker/metadata-action.git
synced 2026-03-11 14:52:08 +00:00
@@ -36,7 +36,7 @@ beforeEach(() => {
|
||||
});
|
||||
});
|
||||
|
||||
const tagsLabelsTest = async (envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabels: Array<string>) => {
|
||||
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)));
|
||||
const context = github.context();
|
||||
console.log(process.env, context);
|
||||
@@ -48,11 +48,11 @@ const tagsLabelsTest = async (envFile: string, inputs: Inputs, exVersion: Versio
|
||||
console.log('version', version);
|
||||
expect(version).toEqual(exVersion);
|
||||
|
||||
const tags = meta.tags();
|
||||
const tags = meta.getTags();
|
||||
console.log('tags', tags);
|
||||
expect(tags).toEqual(exTags);
|
||||
|
||||
const labels = meta.labels();
|
||||
const labels = meta.getLabels();
|
||||
console.log('labels', labels);
|
||||
expect(labels).toEqual(exLabels);
|
||||
};
|
||||
@@ -61,6 +61,7 @@ describe('null', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'null01',
|
||||
'event_null.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -83,9 +84,13 @@ describe('null', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'null02',
|
||||
'event_empty.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=sha`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: undefined,
|
||||
@@ -104,13 +109,14 @@ describe('null', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('push', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'push01',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -135,10 +141,13 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push02',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagEdge: true,
|
||||
tags: [
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'edge',
|
||||
@@ -160,6 +169,7 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push03',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -184,10 +194,13 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push04',
|
||||
'event_workflow_dispatch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagEdge: true,
|
||||
tags: [
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'edge',
|
||||
@@ -209,6 +222,7 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push05',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
@@ -234,10 +248,13 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push06',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagEdge: true,
|
||||
tags: [
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'edge',
|
||||
@@ -260,14 +277,18 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push07',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=sha`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'dev',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -288,15 +309,18 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push08',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tagEdge: true,
|
||||
tags: [
|
||||
`type=edge`,
|
||||
`type=sha`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'edge',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -317,16 +341,18 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push09',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tagEdge: true,
|
||||
tagEdgeBranch: 'dev'
|
||||
tags: [
|
||||
`type=edge,branch=dev`,
|
||||
`type=sha`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'edge',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -347,16 +373,18 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push10',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tagEdge: true,
|
||||
tagEdgeBranch: 'dev'
|
||||
tags: [
|
||||
`type=edge,branch=dev`,
|
||||
`type=sha`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'master',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -377,15 +405,18 @@ describe('push', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'push11',
|
||||
'event_push_invalidchars.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tagEdge: true,
|
||||
tags: [
|
||||
`type=edge`,
|
||||
`type=sha`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'my-feature-1245',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -405,13 +436,136 @@ describe('push', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
[
|
||||
'push12',
|
||||
'event_push_invalidchars.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'my-feature-1245',
|
||||
partial: [],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:my-feature-1245',
|
||||
'ghcr.io/user/app:my-feature-1245'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=my-feature-1245",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'push13',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=ref,priority=2000,event=branch`,
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'master',
|
||||
partial: ['edge'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:master',
|
||||
'user/app:edge'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=master",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'push14',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=semver,pattern={{version}},value=v1.2.3`,
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.2.3',
|
||||
partial: ['edge'],
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:1.2.3',
|
||||
'user/app:edge',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=1.2.3",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'push15',
|
||||
'event_push_defbranch.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=match,pattern=v(.*),group=1,value=v1.2.3`,
|
||||
`type=edge`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.2.3',
|
||||
partial: ['edge'],
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:1.2.3',
|
||||
'user/app:edge',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=1.2.3",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
]
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('push tag', () => {
|
||||
describe('tag', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'tag01',
|
||||
'event_tag_release1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -437,6 +591,7 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag02',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -462,11 +617,16 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag03',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `\\d{8}`,
|
||||
tagLatest: false,
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110',
|
||||
@@ -488,12 +648,16 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag04',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `(.*)-RC`,
|
||||
tagMatchGroup: 1,
|
||||
tagLatest: false,
|
||||
tags: [
|
||||
`type=match,pattern=(.*)-RC,group=1`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110',
|
||||
@@ -515,10 +679,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag05',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -543,11 +710,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag06',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$`,
|
||||
tagMatchGroup: 1,
|
||||
tags: [
|
||||
`type=match,"pattern=^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$",group=1`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -572,10 +741,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag07',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}-(alpha|beta).\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}-(alpha|beta).\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '2.0.8-beta.67',
|
||||
@@ -600,10 +772,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag08',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '2.0',
|
||||
@@ -628,11 +803,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag09',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$`,
|
||||
tagMatchGroup: 1,
|
||||
tags: [
|
||||
`type=match,"pattern=/^v(\\d{1,3}.\\d{1,3}.\\d{1,3})$/ig",group=1`,
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'v2.0.8-beta.67',
|
||||
@@ -655,10 +832,13 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag10',
|
||||
'event_tag_sometag.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'sometag',
|
||||
@@ -681,10 +861,15 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag11',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}', '{{major}}'],
|
||||
tags: [
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=semver,pattern={{major}}.{{minor}}`,
|
||||
`type=semver,pattern={{major}}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -713,10 +898,14 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag12',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}.{{patch}}'],
|
||||
tags: [
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=semver,pattern={{major}}.{{minor}}.{{patch}}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -741,10 +930,14 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag13',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{major}}.{{minor}}', '{{major}}'],
|
||||
tags: [
|
||||
`type=semver,pattern={{major}}.{{minor}}`,
|
||||
`type=semver,pattern={{major}}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '2.0.8-beta.67',
|
||||
@@ -767,11 +960,19 @@ describe('push tag', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag14',
|
||||
'event_tag_sometag.env',
|
||||
{
|
||||
images: ['ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}', '{{major}}'],
|
||||
tagLatest: false,
|
||||
tags: [
|
||||
`type=ref,event=tag`,
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=semver,pattern={{major}}.{{minor}}`,
|
||||
`type=semver,pattern={{major}}`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'sometag',
|
||||
@@ -792,17 +993,88 @@ describe('push tag', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
[
|
||||
'tag15',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=raw,priority=2000,foo`,
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'foo',
|
||||
partial: ['2.0.8-beta.67', '2.0'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:foo',
|
||||
'org/app:2.0.8-beta.67',
|
||||
'org/app:2.0',
|
||||
'ghcr.io/user/app:foo',
|
||||
'ghcr.io/user/app:2.0.8-beta.67',
|
||||
'ghcr.io/user/app:2.0'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=foo",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'tag16',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=raw,priority=2000,foo`,
|
||||
`type=ref,event=tag`,
|
||||
`type=edge`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'foo',
|
||||
partial: ['v1.1.1'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:foo',
|
||||
'org/app:v1.1.1',
|
||||
'ghcr.io/user/app:foo',
|
||||
'ghcr.io/user/app:v1.1.1',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=foo",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
]
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('latest', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'latest01',
|
||||
'event_tag_release1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `^release\\d{1,2}`,
|
||||
tags: [
|
||||
`type=match,"pattern=^release\\d{1,2}"`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'release1',
|
||||
@@ -825,10 +1097,13 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest02',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `^\\d+-RC\\d{1,2}`,
|
||||
tags: [
|
||||
`type=match,"pattern=^\\d+-RC\\d{1,2}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110-RC2',
|
||||
@@ -851,10 +1126,13 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest03',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `\\d{8}`,
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110',
|
||||
@@ -877,10 +1155,13 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest04',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -903,6 +1184,7 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest05',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
@@ -930,10 +1212,13 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest06',
|
||||
'event_tag_v2.0.8-beta.67.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatch: `\\d{1,3}.\\d{1,3}.\\d{1,3}`,
|
||||
tags: [
|
||||
`type=match,"pattern=\\d{1,3}.\\d{1,3}.\\d{1,3}"`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '2.0.8',
|
||||
@@ -958,10 +1243,16 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest07',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagLatest: false,
|
||||
tags: [
|
||||
`type=ref,event=tag`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'v1.1.1',
|
||||
@@ -984,10 +1275,16 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest08',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/MyUSER/MyApp'],
|
||||
tagLatest: false,
|
||||
tags: [
|
||||
`type=ref,event=tag`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'v1.1.1',
|
||||
@@ -1010,16 +1307,22 @@ describe('latest', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'latest09',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/MyUSER/MyApp'],
|
||||
tagLatest: false,
|
||||
labelCustom: [
|
||||
tags: [
|
||||
`type=ref,event=tag`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
],
|
||||
labels: [
|
||||
"maintainer=CrazyMax",
|
||||
"org.opencontainers.image.title=MyCustomTitle",
|
||||
"org.opencontainers.image.description=Another description",
|
||||
"org.opencontainers.image.vendor=MyCompany",
|
||||
],
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'v1.1.1',
|
||||
@@ -1045,13 +1348,14 @@ describe('latest', () => {
|
||||
"org.opencontainers.image.vendor=MyCompany"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('pull_request', () => {
|
||||
describe('pr', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'pr01',
|
||||
'event_pull_request.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -1076,6 +1380,7 @@ describe('pull_request', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'pr02',
|
||||
'event_pull_request.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
@@ -1101,14 +1406,18 @@ describe('pull_request', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'pr03',
|
||||
'event_pull_request.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tags: [
|
||||
`type=ref,event=pr`,
|
||||
`type=sha`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'pr-2',
|
||||
partial: [],
|
||||
partial: ['sha-1e9249f'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -1128,24 +1437,58 @@ describe('pull_request', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
[
|
||||
'pr04',
|
||||
'event_pull_request.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=sha,priority=2000`,
|
||||
`type=ref,event=pr`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'sha-1e9249f',
|
||||
partial: ['pr-2'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:sha-1e9249f',
|
||||
'org/app:pr-2',
|
||||
'ghcr.io/user/app:sha-1e9249f',
|
||||
'ghcr.io/user/app:pr-2'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=sha-1e9249f",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('schedule', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'schedule01',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'nightly',
|
||||
partial: [],
|
||||
partial: ['master'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:nightly'
|
||||
'user/app:nightly',
|
||||
'user/app:master'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
@@ -1159,10 +1502,13 @@ describe('schedule', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'schedule02',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagSchedule: `{{date 'YYYYMMDD'}}`
|
||||
tags: [
|
||||
`type=schedule,pattern={{date 'YYYYMMDD'}}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110',
|
||||
@@ -1184,10 +1530,13 @@ describe('schedule', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'schedule03',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagSchedule: `{{date 'YYYYMMDD-HHmmss'}}`
|
||||
tags: [
|
||||
`type=schedule,pattern={{date 'YYYYMMDD-HHmmss'}}`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110-003000',
|
||||
@@ -1209,18 +1558,21 @@ describe('schedule', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'schedule04',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'nightly',
|
||||
partial: [],
|
||||
partial: ['master'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:nightly',
|
||||
'ghcr.io/user/app:nightly'
|
||||
'org/app:master',
|
||||
'ghcr.io/user/app:nightly',
|
||||
'ghcr.io/user/app:master'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
@@ -1234,14 +1586,18 @@ describe('schedule', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'schedule05',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSha: true,
|
||||
tags: [
|
||||
`type=schedule`,
|
||||
`type=sha`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'nightly',
|
||||
partial: [],
|
||||
partial: ['sha-90dd603'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
@@ -1261,13 +1617,46 @@ describe('schedule', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
[
|
||||
'schedule06',
|
||||
'event_schedule.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=schedule`,
|
||||
`type=sha,priority=2000`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'sha-90dd603',
|
||||
partial: ['nightly'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:sha-90dd603',
|
||||
'org/app:nightly',
|
||||
'ghcr.io/user/app:sha-90dd603',
|
||||
'ghcr.io/user/app:nightly'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=sha-90dd603",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('release', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'release01',
|
||||
'event_release.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
@@ -1292,17 +1681,23 @@ describe('release', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
])('given %s with %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('custom', () => {
|
||||
describe('raw', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'raw01',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'dev',
|
||||
@@ -1327,10 +1722,14 @@ describe('custom', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw02',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my']
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=raw,my`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'dev',
|
||||
@@ -1353,10 +1752,16 @@ describe('custom', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw03',
|
||||
'event_tag_release1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=ref,event=tag`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'release1',
|
||||
@@ -1382,12 +1787,19 @@ describe('custom', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw04',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `\\d{8}`,
|
||||
tagLatest: false,
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '20200110',
|
||||
@@ -1412,11 +1824,18 @@ describe('custom', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw05',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}', '{{major}}'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=semver,pattern={{major}}.{{minor}}`,
|
||||
`type=semver,pattern={{major}}`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: '1.1.1',
|
||||
@@ -1451,12 +1870,15 @@ describe('custom', () => {
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw06',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}.{{patch}}'],
|
||||
tagCustom: ['my', 'custom', 'tags'],
|
||||
tagCustomOnly: true,
|
||||
tags: [
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'my',
|
||||
@@ -1482,17 +1904,138 @@ describe('custom', () => {
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('bake-file', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'raw07',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=ref,priority=90,event=branch`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
flavor: [
|
||||
`latest=true`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'my',
|
||||
partial: ['custom', 'tags', 'dev'],
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:my',
|
||||
'user/app:custom',
|
||||
'user/app:tags',
|
||||
'user/app:dev',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=my",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw08',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'my',
|
||||
partial: ['custom', 'tags'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:my',
|
||||
'user/app:custom',
|
||||
'user/app:tags'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=my",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw09',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`,
|
||||
`type=raw,my,prefix=foo-,suffix=-bar`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`,
|
||||
`prefix=glo-`,
|
||||
`suffix=-bal`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'foo-my-bar',
|
||||
partial: ['glo-custom-bal', 'glo-tags-bal'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:foo-my-bar',
|
||||
'user/app:glo-custom-bal',
|
||||
'user/app:glo-tags-bal'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.version=foo-my-bar",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
]
|
||||
])('given %p wth %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
describe('bake', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
'bake01',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
labels: [
|
||||
"invalid"
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1522,10 +2065,14 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake02',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my']
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=raw,my`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1553,10 +2100,16 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake03',
|
||||
'event_tag_release1.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=ref,event=tag`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1587,12 +2140,19 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake04',
|
||||
'event_tag_20200110-RC2.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tagMatch: `\\d{8}`,
|
||||
tagLatest: false,
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=match,pattern=\\d{8}`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
],
|
||||
flavor: [
|
||||
`latest=false`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1622,11 +2182,18 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake05',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}', '{{major}}'],
|
||||
tagCustom: ['my', 'custom', 'tags']
|
||||
tags: [
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=semver,pattern={{major}}.{{minor}}`,
|
||||
`type=semver,pattern={{major}}`,
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1666,12 +2233,15 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake06',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}.{{patch}}'],
|
||||
tagCustom: ['my', 'custom', 'tags'],
|
||||
tagCustomOnly: true,
|
||||
tags: [
|
||||
`type=raw,my`,
|
||||
`type=raw,custom`,
|
||||
`type=raw,tags`
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
@@ -1703,10 +2273,11 @@ describe('bake-file', () => {
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake07',
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app'],
|
||||
labelCustom: [
|
||||
labels: [
|
||||
"maintainer=CrazyMax",
|
||||
"org.opencontainers.image.title=MyCustom=Title",
|
||||
"org.opencontainers.image.description=Another description",
|
||||
@@ -1740,7 +2311,7 @@ describe('bake-file', () => {
|
||||
}
|
||||
}
|
||||
]
|
||||
])('given %p event ', async (envFile: string, inputs: Inputs, exBakeDefinition: {}) => {
|
||||
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exBakeDefinition: {}) => {
|
||||
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
||||
const context = github.context();
|
||||
console.log(process.env, context);
|
||||
@@ -1748,7 +2319,7 @@ describe('bake-file', () => {
|
||||
const repo = await github.repo(process.env.GITHUB_TOKEN || '');
|
||||
const meta = new Meta({...getInputs(), ...inputs}, context, repo);
|
||||
|
||||
const bakeFile = meta.bakeFile();
|
||||
const bakeFile = meta.getBakeFile();
|
||||
console.log('bakeFile', bakeFile, fs.readFileSync(bakeFile, 'utf8'));
|
||||
expect(JSON.parse(fs.readFileSync(bakeFile, 'utf8'))).toEqual(exBakeDefinition);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user