shunit2
hadolint
shunit2 | hadolint | |
---|---|---|
4 | 25 | |
1,549 | 9,728 | |
- | 0.9% | |
3.5 | 7.3 | |
3 months ago | 2 days ago | |
Shell | Haskell | |
Apache License 2.0 | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
shunit2
-
Pure Bash Bible
> or something that would proper unit testing
<https://github.com/kward/shunit2>
-
First time writing bash scripts for work, not sure if this is true elsewhere
https://github.com/kward/shunit2 is your friend here.
-
AWK an old-school tool today
And in case you are thinking how powerful this is and like me trying to take it further to create small AWK powered "apps" to do the monotonous tasks while wondering how can you verify if what you are coding is valid, you can execute any number of unit tests for shell scripts, and therefore, AWK scripts using shunit2
-
ShellCheck: A static analysis tool for shell scripts
Alongside ShellCheck, I also use shUnit2 as my unit testing framework. Yes, you should test your bash.
https://github.com/kward/shunit2
hadolint
-
Cloud Security and Resilience: DevSecOps Tools and Practices
3. Hadolint: https://github.com/hadolint/hadolint Hadolint is a Dockerfile linter that helps you build best practice Docker images, reducing vulnerabilities in your container configurations.
- Dockerfile Linter
-
Writing a Minecraft server from scratch in Bash (2022)
To skip the "move your scripts to standalone files" step some devs don't like, consider something like https://github.com/hadolint/hadolint which runs Shellcheck over inline scripts within Containerfiles.
-
I reduced the size of my Docker image by 40% – Dockerizing shell scripts
This is neat :)
I love going and making containers smaller and faster to build.
I don't know if it's useful for alpine, but adding a --mount=type=cache argument to the RUN command that `apk add`s might shave a few seconds off rebuilds. Probably not worth it, in your case, unless you're invalidating the cached layer often (adding or removing deps, intentionally building without layer caching to ensure you have the latest packages).
Hadolint is another tool worth checking out if you like spending time messing with Dockerfiles: https://github.com/hadolint/hadolint
-
Top 10 common Dockerfile linting issues
With Depot, we make use of two Dockerfile linters, hadolint and a set of Dockerfile linter rules that Semgrep has written to make a bit of a smarter Dockerfile linter.
-
hadolint - Dockerfile linter
# Download hadolint wget https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 # Download SHA256 checksum wget https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64.sha256 # Validate the checksum sha256sum -c hadolint-Linux-x86_64.sha256 # Make the file executable chmod + ./hadolint-Linux-x86_64 # Rename the file mv hadolint-Linux-x86_64 hadolint
- Haskell Dockerfile Linter
-
Is adding a USER best practice?
The most common linter I've seen and used it Hadolint, which does: https://github.com/hadolint/hadolint/wiki/DL3002 I didn't bother checking to see if alternatives also support this as well though.
-
Checkmake: Experimental Linter/Analyzer for Makefiles
Some discussion on that here:
https://github.com/koalaman/shellcheck/issues/58
The hadolint project does shell checking for Dockerfiles and it uses shellcheck:
https://github.com/hadolint/hadolint
So the approach is definitely feasible, but you do need a new project and probably it needs to be written in Haskell.
-
Dokter: the doctor for your Dockerfiles
how does this compare to something like hadolint?
What are some alternatives?
bats-core - Bash Automated Testing System
trivy - Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
shellspec - A full-featured BDD unit testing framework for bash, ksh, zsh, dash and all POSIX shells
dockle - Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start
ShellCheck - ShellCheck, a static analysis tool for shell scripts
docker-bench-security - The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production.
sh - A shell parser, formatter, and interpreter with bash support; includes shfmt
stan - 🕵️ Haskell STatic ANalyser
shellharden - The corrective bash syntax highlighter
hlint - Haskell source code suggestions
etc - Things that are too small to keep in a separate repo, but too important not to version them.
grype - A vulnerability scanner for container images and filesystems