-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add dockerfile linting #382
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
c1a95cc
to
e485c6e
Compare
Changes: - the action is now ingesting only one directory; - the action is expected to be used in a matrix job; - the action is now leveraging github working-directory
e485c6e
to
b931146
Compare
Note: option 'work-directory' cannot be used with 'uses', it only works with the key-word 'run'.
e1ec5b8
to
05b15cf
Compare
6fb7914
to
8c6c137
Compare
b96ef9a
to
841d0e6
Compare
Review has been taken into account, dismissing due to days off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this, @SMoraisAnsys. Just left some minor suggestions before merging this.
Co-authored-by: Jorge Martínez <[email protected]>
The doc build is failing but just because the action is new and declared for the first time in this pull-request. |
This PR addresses #381 by :
It was tested and validated in a sandbox. If you are interested, you can see the CI jobs failing and succeeding when expected (https://github.com/SMoraisAnsys/pyansys-geometry/actions/runs/7628030247/job/21173613810?pr=1).
Here is a summary of the changes:
TLDR
recursive
must be set totrue
.hadolint
output and one can define at which ouput level the action fails through optionerror-level
.docker-lint
which default value is False to not introduce breaking changes.docker-recursive
anddocker-error-level
.docker-style
This action leverages the action jbergstroem/hadolint-gh-action and requires a directory to look for the docker file. This directory can be anything but we emphasize to store docker files in a directory named "docker" at the root of the repository. If no "docker" directory exists, this action will raise a warning through the CI.
If one wants to evaluate multiple docker files nested in the provided directory, option⚠️ each file expected to be evaluated must be named Dockerfile. Notice that this constraints your repo to follow a directory oriented architecture, i.e. to split the Dockerfiles into multiple directories (e.g. docker/linux/Dockerfile and docker/windows/Dockerfile).
recursive
must be set toTrue
andBy default the action has a strict error level based on the outputs of hadolint. Any info caught into this ouput will make the action failt. It can be lightened by changing the value of the option
error-level
. The associated value can be -1, 0, 1 or 2 where:code-style
This action was modified to allow users to integrate docker linting (using previous docker-style action). By default this is not activated but one can activate it with option
docker-lint
set to True. Directory to be linted are set to "docker" and ".devcontainer", and the options used arerecursive=false
anderror-level=2
.The options passed to the action "docker-style" can be modified through the new options
docker-recursive
anddocker-error-level
.Notes
Github
working-directory
cannot be used withuses
(I tried to use it to specify where to look for docker files).At first we used hadolint-action but is wouldn't work as wanted when looking for multiple docker files. For example, if we wanted to look for multiple docker files, we would need to use the recursive option. However, if we wanted to look into an empty directory "docker" while having docker files in a directory "some_other_directory", then the action would evaluate the docker files inside of "some_other_directory". Indeed, option
recursive
searches for specified dockerfile recursively, from the project root.We also had to fix
hadolint-gh-action
issue through (jbergstroem/hadolint-gh-action#135)