Symlink bash location to /bin/bash in Docker images. #967
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #958
Problem outline
As it currently stands, you can not test source files which have
#!/bin/bashat the top of them inside the bats docker image. This is because bash is not located here.I am aware that it is better practice to have
#!/usr/bin/env bashas the shebang at the top of bash scripts - to make them more portable.However, the vast majority of bash code on GitHub uses /bin/bash (~8 million files). Which means, at them moment, they can't be tested inside the docker image provided by bats without changing their source code.
Summary of change
My proposed change is to symlink bash to the /bin/bash location - which means bats can be used (specifically the docker container running of the tests) can be used by a much wider group of source files.
Testing done
I've done some minimal testing. I've built the docker image using
docker build --build-arg bashver="5" --tag bats/bats:bash-pdruce .and then I tested that I could access /bin/bash with the commanddocker run -it --rm --entrypoint /bin/bash bats/bats:bash-pdruce.This currently doesn't work for bats/bats:latest -
docker run -it --rm --entrypoint /bin/bash bats/bats:latest