Affected Branch
trunk
Basic Diagnostics
Description
If a repo is a git clone, it is easy to get the ROOT with this command: git rev-parse --show-toplevel
However, this does not work inside a docker image or a non-cloned version of the codebase like unpacking a zip download of it.
Scripts inside the scripts/* dir need the ROOT to run, so this should be systematized to work on the codebase whether it is a git clone or docker image or download of the code.
In order to reproduce the issue, follow these steps:
Zip download
- download .zip of opencbdc-tx from
https://github.com/mit-dci/opencbdc-tx
- unzip
- cd opencbdc-tx-trunk
- ./scripts/native-system-benchmark.sh
~/Downloads/opencbdc-tx-trunk/ ./scripts/native-system-benchmark.sh
Linting...
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
Usage: native-system-benchmark.sh [options]
...
Docker image
To test on a docker image, I edited the .dockerignore and Dockerfile to copy all the scripts to the docker image after running scripts/build-docker.sh.
After entering creating and entering the docker image, the output is same as the other method above.
root@90b0004db519:/opt/tx-processor# ./scripts/native-system-benchmark.sh
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
Usage: native-system-benchmark.sh [options]
This can be solved by scripts calling the output of a short, flexible script that handles finding the project ROOT whether inside a git repository or not.
Sidenote: some of the scripts use git for other purposes such as seeing which files are tracked by git ls-files, which will also fail in non-git repos. Example inside scripts/lint.sh. Fixing that git-reliance can be another issue/PR.
Discussed this with @HalosGhost
Code of Conduct
Affected Branch
trunk
Basic Diagnostics
I've pulled the latest changes on the affected branch and the issue is still present.
The issue is reproducible in docker
Description
If a repo is a git clone, it is easy to get the ROOT with this command:
git rev-parse --show-toplevelHowever, this does not work inside a docker image or a non-cloned version of the codebase like unpacking a zip download of it.
Scripts inside the
scripts/*dir need the ROOT to run, so this should be systematized to work on the codebase whether it is a git clone or docker image or download of the code.In order to reproduce the issue, follow these steps:
Zip download
https://github.com/mit-dci/opencbdc-txDocker image
To test on a docker image, I edited the
.dockerignoreandDockerfileto copy all the scripts to the docker image after runningscripts/build-docker.sh.After entering creating and entering the docker image, the output is same as the other method above.
This can be solved by scripts calling the output of a short, flexible script that handles finding the project ROOT whether inside a git repository or not.
Sidenote: some of the scripts use git for other purposes such as seeing which files are tracked by
git ls-files, which will also fail in non-git repos. Example insidescripts/lint.sh. Fixing that git-reliance can be another issue/PR.Discussed this with @HalosGhost
Code of Conduct