Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get project ROOT systematically for git and non-git versions of this codebase #304

Open
3 tasks done
rockett-m opened this issue Oct 6, 2024 · 0 comments
Open
3 tasks done
Assignees
Labels
fix/bug Fixes errant behavior

Comments

@rockett-m
Copy link
Contributor

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-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

  1. download .zip of opencbdc-tx from https://github.com/mit-dci/opencbdc-tx
  2. unzip
  3. cd opencbdc-tx-trunk
  4. ./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

  • I agree to follow this project's Code of Conduct
@rockett-m rockett-m added the fix/bug Fixes errant behavior label Oct 6, 2024
rockett-m added a commit to rockett-m/opencbdc-tx that referenced this issue Oct 7, 2024
rockett-m added a commit to rockett-m/opencbdc-tx that referenced this issue Oct 7, 2024
rockett-m added a commit to rockett-m/opencbdc-tx that referenced this issue Oct 7, 2024
rockett-m added a commit to rockett-m/opencbdc-tx that referenced this issue Oct 7, 2024
rockett-m added a commit to rockett-m/opencbdc-tx that referenced this issue Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix/bug Fixes errant behavior
Projects
None yet
Development

No branches or pull requests

2 participants