Writing production-ready Bash scripts and reuse them across multiple projects ensuring predictable automation behavior across local environments and CI/CD pipelines alike, is really important.
We have developed and have been using bashutils for a while.
How to use it?
download the helper script into the root of your project, with:
| |
if eventually you experience issues with the corporation proxy, try (python needed):
| |
have a go, run ./helper.sh
- if non-existent, it creates the files
.variables(should be version-managed),.local_variablesand.secrets(these 2 are for personal development purposes and should NOT be version-managed) next to the script - it downloads
.bashutilson the first run,m it gets then included from now on - it provides a set of logging functions
- on later runs it checks for updates at most once per day and replaces the local
.bashutilsfrommainonly when newer - every downloaded
.bashutilsfile is verified with SHA256 using.bashutils.checksum - you can now reuse
.bashutilsfunctions by referencing functions in your own.helper.sh:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17case "$1" in reqs) reqs ;; verify) verify_env ;; deploy) databricks_bundle_deploy "$2" "$3" ;; destroy) databricks_bundle_destroy "$2" "$3" ;; *) usage ;; esac - you can also add your own functions directly to the
.helper.shscript - you are encouraged to submit PR’s to contribute with new functionality to
.bashutils
do check it.
