Skip to content

DL3060 should be suppressed if cache mounts are used#1003

Merged
lorenzo merged 1 commit intohadolint:masterfrom
slimslenderslacks:master
Apr 24, 2024
Merged

DL3060 should be suppressed if cache mounts are used#1003
lorenzo merged 1 commit intohadolint:masterfrom
slimslenderslacks:master

Conversation

@slimslenderslacks
Copy link
Copy Markdown
Contributor

What I did

## this should violate DL3060 because there's no yarn cache clean
RUN yarn install

On the other hand, this does not have yarn cache clean but is still okay because the cache will not be included in the final image and removing the cache defeats the purpose of using the cache mount.

RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 yarn install

How I did it

I added RunFlags to the check. I checked whether the RunMount contains any CacheMounts.

How to verify it

The second RUN line above should not raise DL3060.

@slimslenderslacks slimslenderslacks mentioned this pull request Feb 22, 2024
3 tasks
@lorenzo
Copy link
Copy Markdown
Member

lorenzo commented Apr 24, 2024

thanks!

@lorenzo lorenzo merged commit 1c26dd7 into hadolint:master Apr 24, 2024
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.

2 participants