mirror of
https://github.com/docker/metadata-action.git
synced 2024-11-22 20:15:41 +01:00
Only return edge if branch matches
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
f6efe56d56
commit
4cb9252fa6
@ -544,11 +544,11 @@ Extended attributes and default values:
|
|||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
# branch event
|
# branch event
|
||||||
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
|
||||||
# tag event
|
# tag event
|
||||||
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
|
||||||
# pull request event
|
# pull request event
|
||||||
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
|
||||||
```
|
```
|
||||||
|
|
||||||
### `type=raw`
|
### `type=raw`
|
||||||
|
@ -379,14 +379,12 @@ describe('push', () => {
|
|||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'master',
|
main: 'sha-90dd603',
|
||||||
partial: ['sha-90dd603'],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:master',
|
|
||||||
'org/app:sha-90dd603',
|
'org/app:sha-90dd603',
|
||||||
'ghcr.io/user/app:master',
|
|
||||||
'ghcr.io/user/app:sha-90dd603'
|
'ghcr.io/user/app:sha-90dd603'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -394,7 +392,7 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.version=master",
|
"org.opencontainers.image.version=sha-90dd603",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@ -411,14 +409,12 @@ describe('push', () => {
|
|||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'my-feature-1245',
|
main: 'sha-90dd603',
|
||||||
partial: ['sha-90dd603'],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:my-feature-1245',
|
|
||||||
'org/app:sha-90dd603',
|
'org/app:sha-90dd603',
|
||||||
'ghcr.io/user/app:my-feature-1245',
|
|
||||||
'ghcr.io/user/app:sha-90dd603'
|
'ghcr.io/user/app:sha-90dd603'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -426,7 +422,7 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=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.version=sha-90dd603",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@ -444,20 +440,17 @@ describe('push', () => {
|
|||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'my-feature-1245',
|
main: undefined,
|
||||||
partial: [],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[],
|
||||||
'org/app:my-feature-1245',
|
|
||||||
'ghcr.io/user/app:my-feature-1245'
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=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.version=",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@ -646,6 +639,37 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'push19',
|
||||||
|
'event_push.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=edge,branch=master`,
|
||||||
|
`type=ref,event=branch,enable=false`,
|
||||||
|
`type=sha,format=long`
|
||||||
|
],
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
|
||||||
|
'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=sha-90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"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);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
@ -1377,20 +1401,18 @@ describe('tag', () => {
|
|||||||
{
|
{
|
||||||
images: ['org/app'],
|
images: ['org/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=pep440,pattern={{version}}`,
|
`type=pep440,pattern={{raw}}`,
|
||||||
`type=pep440,pattern={{major}}.{{minor}}`,
|
`type=pep440,pattern={{major}}.{{minor}}`
|
||||||
`type=pep440,pattern={{major}}`
|
|
||||||
]
|
]
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: '1.1.1',
|
main: 'v1.1.1',
|
||||||
partial: ['1.1', '1'],
|
partial: ['1.1'],
|
||||||
latest: true
|
latest: true
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:1.1.1',
|
'org/app:v1.1.1',
|
||||||
'org/app:1.1',
|
'org/app:1.1',
|
||||||
'org/app:1',
|
|
||||||
'org/app:latest'
|
'org/app:latest'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -1398,7 +1420,7 @@ describe('tag', () => {
|
|||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.version=1.1.1",
|
"org.opencontainers.image.version=v1.1.1",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
@ -629,10 +629,10 @@ class Meta {
|
|||||||
if (tag.attrs['branch'].length == 0) {
|
if (tag.attrs['branch'].length == 0) {
|
||||||
tag.attrs['branch'] = this.repo.default_branch;
|
tag.attrs['branch'] = this.repo.default_branch;
|
||||||
}
|
}
|
||||||
if (tag.attrs['branch'] === val) {
|
if (tag.attrs['branch'] != val) {
|
||||||
val = 'edge';
|
return version;
|
||||||
}
|
}
|
||||||
const vraw = this.setValue(val, tag);
|
const vraw = this.setValue('edge', tag);
|
||||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
}
|
}
|
||||||
procRaw(version, tag) {
|
procRaw(version, tag) {
|
||||||
|
@ -265,11 +265,11 @@ export class Meta {
|
|||||||
if (tag.attrs['branch'].length == 0) {
|
if (tag.attrs['branch'].length == 0) {
|
||||||
tag.attrs['branch'] = this.repo.default_branch;
|
tag.attrs['branch'] = this.repo.default_branch;
|
||||||
}
|
}
|
||||||
if (tag.attrs['branch'] === val) {
|
if (tag.attrs['branch'] != val) {
|
||||||
val = 'edge';
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vraw = this.setValue(val, tag);
|
const vraw = this.setValue('edge', tag);
|
||||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user