mirror of
https://github.com/docker/metadata-action.git
synced 2025-06-24 03:37:59 +02:00
Add format attribute for type=sha
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@ -617,7 +617,39 @@ describe('push', () => {
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'push18',
|
||||
'event_push.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tags: [
|
||||
`type=ref,event=branch`,
|
||||
`type=sha,format=long`
|
||||
],
|
||||
} as Inputs,
|
||||
{
|
||||
main: 'dev',
|
||||
partial: ['sha-90dd6032fac8bda1b6c4436a2e65de27961ed071'],
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:dev',
|
||||
'org/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
|
||||
'ghcr.io/user/app:dev',
|
||||
'ghcr.io/user/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071'
|
||||
],
|
||||
[
|
||||
"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=dev",
|
||||
"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);
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Transform, Parse, Tag, Type, RefEvent, DefaultPriorities} from '../src/tag';
|
||||
import {Transform, Parse, Tag, Type, RefEvent, ShaFormat, DefaultPriorities} from '../src/tag';
|
||||
|
||||
describe('transform', () => {
|
||||
// prettier-ignore
|
||||
@ -89,7 +89,8 @@ describe('transform', () => {
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-"
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
}
|
||||
] as Tag[],
|
||||
@ -355,7 +356,21 @@ describe('parse', () => {
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-"
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=sha,format=long`,
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Long
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
@ -367,7 +382,8 @@ describe('parse', () => {
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": ""
|
||||
"prefix": "",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
@ -379,7 +395,8 @@ describe('parse', () => {
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "false",
|
||||
"prefix": "sha-"
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
@ -403,6 +420,11 @@ describe('parse', () => {
|
||||
`type=sha,enable=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=sha,format=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
]
|
||||
])('given %p event ', async (s: string, expected: Tag, invalid: boolean) => {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user