mirror of
https://github.com/docker/metadata-action.git
synced 2026-01-21 22:08:58 +08:00
labelPrefix flavor for annotations support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
62339db73c
commit
3e5e65e4c1
5 changed files with 161 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -50,6 +51,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -63,6 +65,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -83,6 +86,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -96,6 +100,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -111,6 +116,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -124,6 +130,7 @@ describe('transform', () => {
|
|||
prefixLatest: true,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -137,6 +144,7 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: true,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -151,6 +159,7 @@ describe('transform', () => {
|
|||
prefixLatest: true,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: true,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
|
|
@ -164,6 +173,21 @@ describe('transform', () => {
|
|||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "",
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`labelPrefix=manifest:`,
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
labelPrefix: "manifest:",
|
||||
} as Flavor,
|
||||
false
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3463,6 +3463,37 @@ describe('raw', () => {
|
|||
"org.opencontainers.image.version=foo"
|
||||
]
|
||||
],
|
||||
[
|
||||
'raw11',
|
||||
'event_push_dev.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=raw,foo`
|
||||
],
|
||||
flavor: [
|
||||
`labelPrefix=index:`,
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'foo',
|
||||
partial: [],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'user/app:foo'
|
||||
],
|
||||
[
|
||||
"index:org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"index:org.opencontainers.image.description=This your first repo!",
|
||||
"index:org.opencontainers.image.licenses=MIT",
|
||||
"index:org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"index:org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||
"index:org.opencontainers.image.title=Hello-World",
|
||||
"index:org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"index:org.opencontainers.image.version=foo"
|
||||
]
|
||||
]
|
||||
])('given %p wth %p event', tagsLabelsTest);
|
||||
});
|
||||
|
||||
|
|
@ -3706,7 +3737,35 @@ describe('json', () => {
|
|||
"org.opencontainers.image.version": "v1.1.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
[
|
||||
'json08',
|
||||
'event_push_dev.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=raw,foo`
|
||||
],
|
||||
flavor: [
|
||||
"labelPrefix=manifest:",
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"tags": [
|
||||
"user/app:foo"
|
||||
],
|
||||
"labels": {
|
||||
"manifest:org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||
"manifest:org.opencontainers.image.description": "This your first repo!",
|
||||
"manifest:org.opencontainers.image.licenses": "MIT",
|
||||
"manifest:org.opencontainers.image.revision": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"manifest:org.opencontainers.image.source": "https://github.com/octocat/Hello-World",
|
||||
"manifest:org.opencontainers.image.title": "Hello-World",
|
||||
"manifest:org.opencontainers.image.url": "https://github.com/octocat/Hello-World",
|
||||
"manifest:org.opencontainers.image.version": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exJSON: unknown) => {
|
||||
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
||||
|
||||
|
|
@ -4012,6 +4071,42 @@ describe('bake', () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
'bake08',
|
||||
'event_push_dev.env',
|
||||
{
|
||||
images: ['user/app'],
|
||||
tags: [
|
||||
`type=raw,foo`
|
||||
],
|
||||
flavor: [
|
||||
"labelPrefix=index:",
|
||||
]
|
||||
} as Inputs,
|
||||
{
|
||||
"target": {
|
||||
"docker-metadata-action": {
|
||||
"tags": [
|
||||
"user/app:foo"
|
||||
],
|
||||
"labels": {
|
||||
"index:org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||
"index:org.opencontainers.image.description": "This your first repo!",
|
||||
"index:org.opencontainers.image.licenses": "MIT",
|
||||
"index:org.opencontainers.image.revision": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"index:org.opencontainers.image.source": "https://github.com/octocat/Hello-World",
|
||||
"index:org.opencontainers.image.title": "Hello-World",
|
||||
"index:org.opencontainers.image.url": "https://github.com/octocat/Hello-World",
|
||||
"index:org.opencontainers.image.version": "foo"
|
||||
},
|
||||
"args": {
|
||||
"DOCKER_META_IMAGES": "user/app",
|
||||
"DOCKER_META_VERSION": "foo",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exBakeDefinition: unknown) => {
|
||||
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue