Skip to content
This repository was archived by the owner on Oct 18, 2021. It is now read-only.

jrbeverly/bazel-bash-packaged

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bazel Bash Packaged

Experimenting with using Bazel & Bats in container images for writing up tests for shell scripts.

Notes

Sometimes while developing things it can be useful to have a small shell script that performs a simple action or operation, that in the short-term makes sense as a shell script. In this case, it can be useful to add some simple tests to ensure that:

  1. The script is runnable
  2. Simple transformations work as expected
  3. Any environment variable or file references work as intended

This isn't intended for cases where a shell script is increasing in complexity, but rather where it acts as 'Glue' responsible for filling in gaps that might exist in a system.

Some minor notes about this process are included below:

  • Using docker allows avoiding requiring the expected toolchains to be installed locally (or defined in bazel)
  • The Bats image is used instead of installed bats onto an image. Installing bats onto an existing image might be a better option
  • Container tests can check other properties of the executable shell scripts (as it should be packed the same as it would be for other targets)

About

Experimenting with using bazel to package+test glue shell scripts

Topics

Resources

Stars

Watchers

Forks

Contributors