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

LET/SET values cannot be used in parallel commands such as BUILD #3997

Closed
idodod opened this issue Apr 9, 2024 · 2 comments
Closed

LET/SET values cannot be used in parallel commands such as BUILD #3997

idodod opened this issue Apr 9, 2024 · 2 comments
Labels
type:bug Something isn't working

Comments

@idodod
Copy link
Contributor

idodod commented Apr 9, 2024

What went wrong?

Trying to defined the name of the target in a LET statement, the name of the target is not properly expanded and the target cannot be built.

VERSION 0.8

FROM alpine

foo:
    LET target=+bar
    BUILD $target

bar:
    RUN echo hello from bar

earthly +foo

What should have happened?

The command should succeed in eventually building +bar.
chan

Other Helpful Information

Changing the LET command to an ARG allows the target to be built.

It appears LET/SET do not block parallel commands, thus BUILD is executed before LET is evaluated.

@idodod
Copy link
Contributor Author

idodod commented Apr 9, 2024

This also fixes a bug where a BUILD might get executed twice with different values of an arg.
Consider the folliwing:

FROM alpine

foo:
   LET my_val=abc
   BUILD +bar --my_arg=$my_val
   
bar:
  ARG my_arg="123"
  RUN echo $my_arg   

earthly +foo would result in +bar getting executed twice - once with my_arg="" and once with my_arg="abc", where the latter is the intended behavior.

@idodod
Copy link
Contributor Author

idodod commented Apr 10, 2024

will be included in next releases (v0.8.8)

@idodod idodod closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

1 participant