-
Notifications
You must be signed in to change notification settings - Fork 49
Add support to get config variable from CLI #549
Comments
Hey @hpcsc, is https://batect.dev/CLIReference.html#set-a-config-variable-config-var what you're after? |
hey @charleskorn No, I'm looking for way to get the value of config var to use outside of batect, not to set it |
Ah sorry, I misread your question. There's no built-in way to do that at the moment, but as a workaround, you could achieve the same thing by creating a task that prints the value to the console, and then running the task in quiet mode ( print-git-sha:
run:
container: # anything with a shell
command: sh -c "echo $GIT_SHA"
environment:
GIT_SHA: <{GIT_SHA}
|
thanks @charleskorn |
hey @charleskorn , could I check with you one more thing related to this issue: so far we have used your workaround above in our pipeline like this:
This works fine when batect is already cached in build agents. When it's not, the command above will download batect and the variable I take a brief look at the wrapper and there's a variable |
That looks like a bug - the wrapper should be passing |
…set. This resolves the issue described in #549 (comment).
awesome, thanks for the fast reply (and commit). Will do some workaround for now and wait for the next version with this change |
This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues. |
This issue has been automatically closed because it has not had any recent activity. |
Hi @charleskorn , thanks for the great work on batect! I have a question related to this issue. If I should open a new issue instead, please let me know. Our scenario:
May I know if there's a way to define these dynamic config vars so that it's computed at the time of running the batect tasks? Thank you! |
It would be nice if batect can provide a CLI command to get config variable by name (with consideration of config variable files, override variables etc)
Scenario:
Currently we use batect config variables to keep repo-wide variables in a central place (.e.g. component name to be used in the code, infra code etc). There are a few exceptional cases where we want to get the same variable names to be used outside of batect like:
we can do some scripting like using
grep
andsed
but feel hacky. It would be much nicer to have it supported directly from batect like:The text was updated successfully, but these errors were encountered: