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

Misc. operability tweaks for clang-format #5422

Merged
merged 6 commits into from
Jan 10, 2025

Conversation

johnkerl
Copy link
Contributor

@johnkerl johnkerl commented Jan 9, 2025

Found while debugging CI fails on #5421.


TYPE: NO_HISTORY

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
Copy link
Member

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@johnkerl johnkerl force-pushed the kerl/clang-format-version-info branch from afe70c8 to d2b951b Compare January 9, 2025 21:36

src=$GITHUB_WORKSPACE
src=$(dirname $0)/../..
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out CI invokes this with source not with bash, and when you source a script, its $0 is -bash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ cat foo
echo '$0' is $0
echo '$*' is $*
$ bash ./foo 1 2 3
$0 is ./foo
$* is 1 2 3
$ bash $(pwd)/foo 1 2 3
$0 is /Users/kerl/git/TileDB-Inc/TileDB/foo
$* is 1 2 3
$ source foo 1 2 3
$0 is -bash
$* is 1 2 3
$ source $(pwd)/foo 1 2 3
$0 is -bash
$* is 1 2 3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should fix the workflow, it doesn't make much sense to run this script by sourcing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷

I saw somewhen/somewhere some comments about sourcing in GH YAML; maybe a recommended best practice? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'm happy with trying the experimental method -- I can modify the calling YAML to bash the script than source the script ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. 😅

My intuition is that sourcing should be done only in special circumstances and when a script is less of a "function" and more of an "environment initializer".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@teo-tsirpanis oh I 100% agree, and have for years, even before TileDB. The only good reason for source to me is something that needs to set environment variables, aliases, etc. for the parent process.

I'm simply wondering if there's some other good reason, within this particular GHA context, which the person who keystroked source into GHA YAML didn't bother to explain at the time, leaving you & me to wonder. But again, I'm happy to find that out by experiment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever the reason (good or bad) whenever this was written, there's a lot of it:

kerl@arvad[prod][kerl/current-domain-error-message][TileDB]$ rg ' source ' .github/workflows/*ml
.github/workflows/unit-test-runs.yml
88:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/test-cloud-e2e.yml
57:          source $GITHUB_WORKSPACE/scripts/ci/bootstrap_libtiledb.sh
68:          source $GITHUB_WORKSPACE/scripts/ci/build_libtiledb.sh
106:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/release.yml
136:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/check-formatting.yml
41:          source $GITHUB_WORKSPACE/scripts/ci/check_formatting_linux.sh

.github/workflows/build-ubuntu20.04-backwards-compatibility.yml
41:          source $GITHUB_WORKSPACE/scripts/ci/bootstrap_libtiledb.sh
42:          source $GITHUB_WORKSPACE/scripts/ci/build_libtiledb.sh
122:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/ci-linux_mac.yml
157:          source $GITHUB_WORKSPACE/scripts/ci/bootstrap_libtiledb.sh
168:          source $GITHUB_WORKSPACE/scripts/ci/build_libtiledb.sh
189:          source $GITHUB_WORKSPACE/scripts/ci/posix/build-services-start.sh
211:          source $GITHUB_WORKSPACE/scripts/ci/posix/build-services-stop.sh
221:          # It relies on finding its source directory.
227:          source $GITHUB_WORKSPACE/scripts/ci/build_benchmarks.sh
274:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/build-rtools40.yml
66:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

.github/workflows/build-windows.yml
432:          source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh

@teo-tsirpanis
Copy link
Member

The check-formatting job is green.

@johnkerl
Copy link
Contributor Author

@teo-tsirpanis please feel free to merge when you are ready. I lack permssions on this repo. Thank you!

@teo-tsirpanis teo-tsirpanis merged commit 0aecf50 into main Jan 10, 2025
59 of 60 checks passed
@teo-tsirpanis teo-tsirpanis deleted the kerl/clang-format-version-info branch January 10, 2025 15:20
@johnkerl
Copy link
Contributor Author

Thank you @teo-tsirpanis !

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.

2 participants