Skip to content

Commit b909bd3

Browse files
authored
Fix 'enable' tag attribute (#53)
1 parent 7265417 commit b909bd3

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

__tests__/meta.test.ts

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,41 @@ describe('raw', () => {
20152015
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
20162016
"org.opencontainers.image.licenses=MIT"
20172017
]
2018-
]
2018+
],
2019+
[
2020+
'raw10',
2021+
'event_push.env',
2022+
{
2023+
images: ['user/app'],
2024+
tags: [
2025+
`type=raw,foo`,
2026+
`type=raw,bar,enable=false`,
2027+
`type=raw,baz,enable=true`
2028+
],
2029+
flavor: [
2030+
`latest=false`
2031+
]
2032+
} as Inputs,
2033+
{
2034+
main: 'foo',
2035+
partial: ['baz'],
2036+
latest: false
2037+
} as Version,
2038+
[
2039+
'user/app:foo',
2040+
'user/app:baz',
2041+
],
2042+
[
2043+
"org.opencontainers.image.title=Hello-World",
2044+
"org.opencontainers.image.description=This your first repo!",
2045+
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
2046+
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
2047+
"org.opencontainers.image.version=foo",
2048+
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
2049+
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
2050+
"org.opencontainers.image.licenses=MIT"
2051+
]
2052+
],
20192053
])('given %p wth %p event', tagsLabelsTest);
20202054
});
20212055

@@ -2324,3 +2358,40 @@ describe('bake', () => {
23242358
expect(JSON.parse(fs.readFileSync(bakeFile, 'utf8'))).toEqual(exBakeDefinition);
23252359
});
23262360
});
2361+
2362+
describe('push', () => {
2363+
// prettier-ignore
2364+
test.each([
2365+
[
2366+
'push15',
2367+
'event_push_defbranch.env',
2368+
{
2369+
images: ['user/app'],
2370+
tags: [
2371+
`type=match,pattern=v(.*),group=1,value=v1.2.3`,
2372+
`type=edge`
2373+
],
2374+
} as Inputs,
2375+
{
2376+
main: '1.2.3',
2377+
partial: ['edge'],
2378+
latest: true
2379+
} as Version,
2380+
[
2381+
'user/app:1.2.3',
2382+
'user/app:edge',
2383+
'user/app:latest'
2384+
],
2385+
[
2386+
"org.opencontainers.image.title=Hello-World",
2387+
"org.opencontainers.image.description=This your first repo!",
2388+
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
2389+
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
2390+
"org.opencontainers.image.version=1.2.3",
2391+
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
2392+
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
2393+
"org.opencontainers.image.licenses=MIT"
2394+
]
2395+
]
2396+
])('given %p with %p event', tagsLabelsTest);
2397+
});

dist/index.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/meta.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export class Meta {
4444
};
4545

4646
for (const tag of this.tags) {
47+
if (tag.attrs['enable'] == 'false') {
48+
continue;
49+
}
50+
4751
switch (tag.type) {
4852
case tcl.Type.Schedule: {
4953
version = this.procSchedule(version, tag);

0 commit comments

Comments
 (0)