Skip to content

How can I set a default for GIT_COMMIT when running locally? #17633

Answered by kaos
kaos asked this question in Q&A
Discussion options

You must be logged in to vote

By using a .pants.bootstrap shell script, it will be sourced before invoking your Pants command so any environment variables that needs to be set or other functionality you need to happen for each call to ./pants may be placed into that file.

Example:

# .pants.bootstrap

# Ensure GIT_COMMIT is set and exported
: ${GIT_COMMIT:=$(git rev-parse HEAD)}
export GIT_COMMIT
# ...

Make sure you have these lines in your ./pants script. If not you need to update your local ./pants script first ;)

Replies: 1 comment 1 reply

Comment options

kaos
Nov 24, 2022
Collaborator Author

You must be logged in to vote
1 reply
@kaos
Comment options

kaos Nov 27, 2022
Collaborator Author

Answer selected by kaos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant