Skip to content

attribute to enable/disable images#193

Merged
crazy-max merged 2 commits intodocker:masterfrom
crazy-max:images-opts
Apr 28, 2022
Merged

attribute to enable/disable images#193
crazy-max merged 2 commits intodocker:masterfrom
crazy-max:images-opts

Conversation

@crazy-max
Copy link
Copy Markdown
Member

fixes #159

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@crazy-max crazy-max marked this pull request as ready for review April 25, 2022 19:28
Comment thread README.md Outdated
Extended attributes and default values:

```yaml
tags: |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be images here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good catch

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good

Comment thread src/image.ts
for (const field of fields) {
const parts = field
.toString()
.split('=')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think splitting by = makes something like this invalid

name=lucacome/test-foo2,enable=${{ github.event_name == 'pull_request' }}

not sure if you ever meant for it to be supported and I guess I could always have the same condition with other operators like startsWith without using =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${{ github.event_name == 'pull_request' }} is interpreted upstream by the GitHub Runner logic so it would produce name=lucacome/test-foo2,enable=<true|false> before being passed to the action.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah interesting, I thought that was the cause for Error: Image name attribute empty: enable=true that I'm seeing, but then I'm not sure I understand what this error means 😄

I have this and I assumed it wasn't coming from the first one, as it would get the default enable=true, and that it was the second line causing the error.

images: |
  name=lucacome/test-foo
  name=lucacome/test-foo2,enable=${{ github.event_name == 'pull_request' }}
  name=ghcr.io/lucacome/workflows,enable=${{ startsWith(github.ref, 'refs/tags/') && contains(matrix.target, 'aws') }}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sounds like a bug then, will take a look, thanks for your feedback

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucacome Hum I was not able to repro, do you have a link to your repo?

Copy link
Copy Markdown

@lucacome lucacome Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucacome Should be fixed, let me know if it looks good to you. Thanks!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit b2391d3 into docker:master Apr 28, 2022
@crazy-max crazy-max deleted the images-opts branch April 28, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to enable/disable images

2 participants