-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I run multiple files #3
Comments
Hi. I didn't knew this was possible. This action simply passes the contents of the "dockerfile" action variable as an argument to the What error do you got? |
I'm dealing with the same issue. Hadolint accepts both a glob and a list of filepaths and trying either in a github action end up with an error:
One workaround I've found is to use the hadolint docker image in a jobs:
lint_dockerfiles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint Dockerfiles
run: docker run --rm -v $(pwd):/repo -i hadolint/hadolint sh -c "cd /repo && hadolint ./**/Dockerfile" |
This action just use the hadolint command as entrypoint. It supports a input argument "dockerfile" that is passed as single argument to the command. While this was meant to be a path to a single Dockerfile, passing a glob should work I guess. Something like this: uses: brpaz/hadolint-action@master
with:
dockerfile: "docker/**/*Dockerfile" Unless the way GitHub parses arguments is doing something that makes it not working. Anyway, PRs are welcome. I only ever used hadolint with a single line myself |
That seems the case ;) - like Justinaz already stated, globs are resulting in Edit:
|
Honestly for multiple files I just went and did it from scratch using the hadolint container. Here's a github actions yaml snippet: docker:
runs-on: ubuntu-latest
container: hadolint/hadolint
steps:
- uses: actions/checkout@v2
- name: hadolint
run: hadolint ./**/*Dockerfile |
@lukewiwa Do you still use your solution from #3 (comment) ? I tried it verbatim with the latest hadolint container and it failed for me:
|
@justinas-marozas Do you still use your solution from #3 (comment) ? It looks like the hadolint container changed, stripping everything but
It also looks like
but this does not
|
I think the action needs to be changed so that it uses debian based image. @mloskot would you like to contribute this feature? |
@lorenzo Aha! I confess, as end-user and as I aimed for the container and not installation, I have not read further than just the https://github.com/hadolint/hadolint#how-to-use section |
@mloskot I confess I got the same error and moved on to using this https://github.com/marketplace/actions/hadolint-github-action |
Debian or alpine images are needed to get a shell. hadolint/hadolint#611 Change the tag to get the correct image.
|
It appears the way you can get it to scan some of the files recursively is with the below configuration in your action. This should be the same as running it with lint-docker:
runs-on: ubuntu-latest
env:
HADOLINT_RECURSIVE: "true"
steps:
- uses: actions/checkout@v3
- name: Lint dockerfiles
uses: hadolint/[email protected]
with:
dockerfile: "Dockerfile" |
@paulbarton90 's solution worked for us
|
- hadolint-actionは複数ファイルを同時にかけられないので、冗長だがstepを一つ増やした。 hadolint/hadolint-action#3
- hadolint-actionは複数ファイルを同時にかけられないので、冗長だがstepを一つ増やした。 hadolint/hadolint-action#3
- hadolint-actionは複数ファイルを同時にかけられないので、冗長だがstepを一つ増やした。 hadolint/hadolint-action#3
…ck action. (#3) Co-authored-by: OCP4 migration script <[email protected]>
In my case, I can't use this action because it's built from a Debian image has jobs:
lint:
name: Dockerfile
runs-on: ubuntu-latest
container:
image: hadolint/hadolint:2.12.0-debian
steps:
- uses: actions/checkout@v4
- name: hadolint
run: |
shopt -s globstar
hadolint **/*Dockerfile*
shell: bash |
My use case was linting all Dockerfiles in my repository and this set up worked perfectly: jobs:
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Dockerfiles
uses: hadolint/[email protected]
with:
dockerfile: "*.Dockerfile"
recursive: true |
Looks like hadolint GH action only supports a single Dockerfile hadolint/hadolint-action#3
Locally I can run something like this
hadolint docker/**/*Dockerfile
to capture all the dockerfiles in a directory but that doesn't seem to work in the pipeline.Any suggestions?
The text was updated successfully, but these errors were encountered: