Skip to content

Commit

Permalink
Fix template environment variables (#310)
Browse files Browse the repository at this point in the history
This commit fixes how environment variables are exported in a
template file by the `CommandTemplateMap` class. In particular,
this commit adds an `export` directive before every variable
declaration to ensure that they are propagated in case of
nested shell commands.
  • Loading branch information
LanderOtto authored Dec 20, 2023
1 parent b4d9b8d commit 1783549
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion streamflow/deployment/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ def get_command(
) -> str:
return self.templates.get(template, self.templates["__DEFAULT__"]).render(
streamflow_command=command,
streamflow_environment=environment,
streamflow_environment=(
" && ".join(
[f'export {key}="{value}"' for (key, value) in environment.items()]
)
if environment is not None
else ""
),
streamflow_workdir=workdir,
**kwargs,
)
Expand Down

0 comments on commit 1783549

Please sign in to comment.