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
EARTHLY_PUSH is always false when set in the base target #3919
Comments
I looked into this and noticed that flag is intentionally set to false when the target is not referened directly in the cli or by a BUILD statement. So for example |
This appears to be working as intended, as it follows the same logic of when a from https://docs.earthly.dev/docs/earthfile#what-is-being-output-and-pushedpushed :
any targets that don't have an explicit Maybe there's a use case that we didn't think about when this decision was made -- can you share some details on why you need to perform a push in the base target? |
I need to know if |
I'm still trying to understand your use-case. If you have an intermediate target that needs to perform some sort of optimization, (e.g. using the
|
that is essentially what I'm trying to do, except that It is a simple boolean behavior (I either passed the flag or I didn't) and the variable should be equally as simple (reflecting whether the flag was passed or not) |
The reasoning (as documented under "What is being output and pushed"), can be summarised by this example:
when you run The |
I get that, for implementation, that it may be necessary to keep the current behavior, but it's a lot more cognitive overload to deal with, and I still don't fully understand why my code wasn't working. I have a Unfortunately I can't give you the exact code that wasn't working because I already removed it from my worktree (since it wasn't working), but I will play around with it and see if I can get a better understanding. |
that's interesting that even with the explicit The current behaviour might contain a data race, for example consider calling
where as if
However the race occurs if it's triggered first by a
but if you switch the order of FROM and BUILD, both end up being true:
I agree this is very confusing. |
What went wrong?
When using
ARG EARTHLY_PUSH
in the base target of an Earthfile, the value seems to always contain false whether--push
was passed on the cli or not.What should have happened?
It should accurately reflect whether push was passed or not
Other Helpful Information
Repro:
out of
earthly --push +check
:The text was updated successfully, but these errors were encountered: