Skip to content
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

[INVESTIGATED/TESTED] Configuration File Pathing Issue + Subsequent Issue #58

Open
kgrv-me opened this issue May 14, 2022 · 2 comments
Open

Comments

@kgrv-me
Copy link

kgrv-me commented May 14, 2022

Please refer to PR #59 for detailed solutions.

ISSUES

  • hadolint-action cannot receive configuration file properly
  • Conflict infomation betweenREADME.md and action.yml
    • inputs.config.default is empty in action.yml, while README.md states otherwise
    • Default path stated in README.md would still encounter the above issue
  • (Edited) the official hadolint/hadolint:latest container also suffers from configuration file issue

TEST CASES

  • All done within GitHub Actions workflow
  • All results in failure to receive configuration file
- uses: hadolint/hadolint-action@v2.1.0
  with:
    config: PATH

Substitute PATH with the followings:

hadolint.yaml
./hadolint.yaml
.hadolint.yaml
/home/runner/work/sandbox/sandbox/hadolint.yaml

INVESTIGATION

  1. hadolint looks for configuration files via
$PWD/.hadolint.yaml
$XDG_CONFIG_HOME/hadolint.yaml
$HOME/.config/hadolint.yaml
$HOME/.hadolint/hadolint.yaml or $HOME/hadolint/config.yaml
$HOME/.hadolint.yaml

NOTE hadolint-action utilizes Docker container for execution

  1. hadolint uses PWD and HOME environment variables
  2. action.yml maps inputs.config to HADOLINT_CONFIG
  3. Dockerfile points to hadolint.sh for entrypoint
  4. hadolint.sh appends -c ${HADOLINT_CONFIG} to hadolint command
  5. hadolint-action uses Docker with
docker run .. --workdir /github/workspace .. -v "/home/runner/work/sandbox/sandbox":"/github/workspace" ..
  1. PWD=/ and HOME=/root inside the container

CONCLUSION

  1. Since pwd inside the container isn't matching with PWD nor HOME, hadolint cannot find configuration file in usual places
  2. Knowing pwd and -v for the container, we can edit PATH to be /github/workspace/hadolint.yaml for hadolint-action to use

SUGGESTION

  • Document the usage in README.md accordingly (CONCLUSION.2)
    or
  • Change PWD/HOME in Dockerfile to accommodate the differences
    or
  • Prepend /github/workspace/ to the path of configuration file
    or preferably all of the above! :D
  • Please consider adding MAJOR_VERSION tag for the release (Release management: improve semantic versioning #47)

Thank you!

@lorenzo
Copy link
Member

lorenzo commented May 14, 2022

Would you like to submit a change with those fixes?

@kgrv-me
Copy link
Author

kgrv-me commented May 14, 2022

@lorenzo I could definitely do that! How would I proceed to do so?
EDIT: I have opened PR #59 for the solutions :D

@kgrv-me kgrv-me changed the title (Investigated) Configuration File Pathing Issue [INVESTIGATED/TESTED] Configuration File Pathing Issue + Subsequent Issue May 14, 2022
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

No branches or pull requests

2 participants