-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Variable and environment variable order and use needs clarification #291
Comments
Hi @tommyalatalo, This issue is related to #287 and #218. i.e. variables in Task have some bugs and gotchas, and I plan to rewrite the whole thing in v3, specially respecting declaration order as you suggested, and avoiding the need for multiple passes/expansions if possible. This should avoid a lot of confusion users have often regarding variables. The reason for why it didn't happen yet is because I haven't find the time to work on this, but that will happen eventually. |
Yeah I see now that the example in #287 is pretty much exactly what I was trying to do, get some string from git and refine in in the second variable. It will be really good to fix this, I worked around it for now by making really long commands where I did the parsing in the sh: module. Not optimal, and really ugly to be honest, but it works. Do you have any idea of what the time frame would be to get this implemented? |
This seems to be another behavior that's not covered in the docs:
Doesn't matter if I write it in this format:
Is this a known thing, and how do I get around it? |
Sorry, but this can take a while. My time is limited and I try my best to keep moving this project forward. I think I'll give priority to the vars rework, though, since it's the biggest blocker to the v3 release. But your reports are very useful so I can try to fix these issues. |
I ran into another issue today when evaluating a
The error message doesn't really specify anything: However just running |
I bumped into something odd with variables today too: version: '2'
vars:
FIRST:
sh: echo first
SECOND:
sh: echo second after {{.FIRST}}
tasks:
default:
cmds:
Seems that I cannot reference variables from within the same section |
I've been trying to write some tasks today and found that the way that variables and environment variables have some gaps in the documentation regarding how they behave.
First off, in the example below the EXPORTED variable is an env var set with
export EXPORTED=foo
:This results in the output:
Why does it work to do
echo {{.EXPORTED}}
for an exported env var, but notecho {{.MYVAR}}
?There is no clear explanation in the docs as to when the
$
notation vs the{{ }}
should be used with regards to environment variables.Second, it's not really explained in the documentation in which order and how variables are interpolated, I found and issue when trying to do something like the below:
resulting output:
The variable TWO doesn't expand/find ".ONE", but I couldn't find an explanation in the docs as to why. This is problematic as I would like to do several operations throughout the vars to parse a string which I then am going to use in multiple commands for http requests with curl.
However I can't seem to pass the resulting vars forward. I think this could relate to #277 in being able to run multiple commands in the same shell. Maybe a simple rationale here would be to interpolate vars in order from top to bottom as they're defined in the "vars"?
The text was updated successfully, but these errors were encountered: