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

scripts: make all scripts that need it use realpath #9590

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

Khoyo
Copy link
Contributor

@Khoyo Khoyo commented Nov 6, 2024

No description provided.

@Khoyo Khoyo requested a review from a team as a code owner November 6, 2024 09:07
@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 42.49%. Comparing base (bfa5205) to head (aef57ea).
Report is 6 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #9590      +/-   ##
============================================
- Coverage     42.50%   42.49%   -0.01%     
  Complexity     2271     2271              
============================================
  Files          1311     1311              
  Lines        105413   105413              
  Branches       3297     3297              
============================================
- Hits          44806    44799       -7     
- Misses        58661    58668       +7     
  Partials       1946     1946              
Flag Coverage Δ
core 75.05% <ø> (ø)
editoast 73.65% <ø> (-0.03%) ⬇️
front 18.79% <ø> (ø)
gateway 2.19% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 86.74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emersion
Copy link
Member

emersion commented Nov 6, 2024

There are two more I think:

scripts/cleanup-db.sh:80:echo "'diesel migration run --migration-dir $(dirname $0)/../editoast/migrations'  # 'docker compose up editoast' does it automatically"
scripts/load-backup.sh:47:$(dirname "$0")/cleanup-db.sh # Cleanup and init db (no migration)

@Khoyo Khoyo force-pushed the yk/script-path-consistency branch from 05430b9 to c01af83 Compare November 6, 2024 09:20
@Khoyo
Copy link
Contributor Author

Khoyo commented Nov 6, 2024

You're right, I'm reversing this PR to match the scripts popular vote

@Khoyo Khoyo changed the title scripts: make sync-openapi.sh path behaviour coherent with the rest scripts: make all scripts that need it use realpath Nov 6, 2024
@Khoyo Khoyo force-pushed the yk/script-path-consistency branch from c01af83 to b266467 Compare November 6, 2024 09:22
@emersion
Copy link
Member

emersion commented Nov 6, 2024

The upside of this approach (grabbing the script's directory) is that scripts can be run from anywhere and still work fine. (It's still a bit fragile because $0 may not be a path, e.g. because of $PATH lookup or passing a different argv[0] to exec(3), but that's pretty unlikely to matter in practice.)

@Khoyo
Copy link
Contributor Author

Khoyo commented Nov 6, 2024

It's still a bit fragile because $0 may not be a path, e.g. because of $PATH lookup or passing a different argv[0] to exec(3), but that's pretty unlikely to matter in practice

Indeed which is why I naturally tend to err on the other side. But the most important part imo is to be consistent.

I'm a bit conflicted about the various compose scripts. Should they keep the docker-compose behavior of using the working directory (or any parent), or should they support being run from anywhere?

@Khoyo Khoyo force-pushed the yk/script-path-consistency branch from 12c8d02 to aef57ea Compare November 7, 2024 12:20
@Khoyo Khoyo enabled auto-merge November 7, 2024 12:20
@Khoyo Khoyo added this pull request to the merge queue Nov 7, 2024
Merged via the queue into dev with commit eead565 Nov 7, 2024
24 checks passed
@Khoyo Khoyo deleted the yk/script-path-consistency branch November 7, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants