Skip to content

Feature: Dynamically added env variables #1786

@michaszcz

Description

@michaszcz

I'd like to have some option to set env variables dynamically for all steps of the task.

Example 1:

version: '3'

tasks:
  greet:
    cmds:
      - export GREETING=Hello
      - echo $GREETING  # Currently it'll print an empty string, I'd like to receive the value `Hello`

Example 2:

version: '3'

tasks:
  task_name:
    dynamic_env:  # Currently not possible
      sh: python script_that_exports_env_variables.py
    cmds:
      - echo $DYNAMIC_VAR1 $DYNAMIC_VAR2  # Env vars set by the script

Without the feature I have to export variables and use them in one step - example:
Example 2:

version: '3'

tasks:
  task_name:
    cmds:
      - ./export_vars.sh && echo $DYNAMIC_VAR1 $DYNAMIC_VAR2
      - echo $DYNAMIC_VAR1 $DYNAMIC_VAR2  # Currently vars are not available in this step

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions