13
0
Fork 0
mirror of https://github.com/docker/metadata-action.git synced 2026-06-28 14:50:44 +00:00
Signed-off-by: zry98 <dev@zry.io>
This commit is contained in:
zry98 2026-05-22 19:29:20 +02:00
parent 7126108a11
commit 060b56a2d6
No known key found for this signature in database
GPG key ID: D239A8A2222B2691
4 changed files with 159 additions and 29 deletions

View file

@ -3929,7 +3929,7 @@ describe('raw', () => {
{
images: ['user/app'],
tags: [
`type=raw,value=.t/'\[e]-=`
`type=raw,value=.t/'[e]-=`
],
flavor: [
`latest=false`
@ -4019,6 +4019,131 @@ describe('raw', () => {
],
undefined
],
[
'raw14',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value= `
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: undefined,
partial: [],
latest: false
} as Version,
[],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version="
],
undefined
],
[
'raw15',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=.-`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: undefined,
partial: [],
latest: false
} as Version,
[],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version="
],
undefined
],
[
'raw16',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=_leading_underscore`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: '_leading_underscore',
partial: [],
latest: false
} as Version,
[
'user/app:_leading_underscore'
],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=_leading_underscore"
],
undefined
],
[
'raw17',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=.-,priority=300`,
`type=raw,value=foobar,priority=200`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: 'foobar',
partial: [],
latest: false
} as Version,
[
'user/app:foobar'
],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foobar"
],
undefined
],
])('given %o with %o event', tagsLabelsTest);
});

48
dist/index.cjs generated vendored

File diff suppressed because one or more lines are too long

6
dist/index.cjs.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -358,7 +358,12 @@ export class Meta {
if (val.length == 0) {
return version;
}
val = Meta.sanitizeTag(val);
const sanitized = Meta.sanitizeTag(val);
if (sanitized.length == 0) {
core.warning(`Skipping tag "${val}": sanitization resulted in an empty string.`);
return version;
}
val = sanitized;
if (version.main == undefined) {
version.main = val;
} else if (val !== version.main) {