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

Required tasks should inherit inputs (Or be able to map inputs for task X to inputs for required task Y) #103

Open
chrisalbright opened this issue Nov 13, 2023 · 4 comments

Comments

@chrisalbright
Copy link

Given:

  • a task X with zero or more inputs
  • a task Y with one or more inputs
  • a requires relationship from X to Y
    When:
  • i execute task X with inputs needed for task Y
    Then:
  • The execution of task Y should have access to inputs provided when running task X

For example, given a readme:

Tasks

y

Inputs: v

echo my inputs are $v

x

Requires: y

echo 'hello world'

this invocation will work:
v=hello xc x

but this one will fail:
xc x hello

Likewise, this readme will also fail in the same way as described above:

Tasks

y

Inputs: v

echo my inputs are $v

x

Inputs: v
Requires: y

echo "$v world"
@joerdav
Copy link
Owner

joerdav commented Nov 14, 2023

I can see the issue you are raising here. Let's workshop some potential solutions.

I think each task should expresss it's own inputs, so the first example you provided I believe should fail as task y expresses no required inputs.

You should be able to create Requires statements that contain inputs:

Requires: y hello

But this doesn't help if you would like to have the input to y be dynamic.

Maybe if an input is named the same as an input on a required task, it should be mapped?

@joerdav
Copy link
Owner

joerdav commented Nov 14, 2023

What about if requires inputs are expanded:

## y

Inputs: v

```
echo $v
```

## x

Inputs: v

Requires: y $v

@chrisalbright
Copy link
Author

I think the second idea is better, because it is more explicit and seems easier to understand. I'd thought the first idea would probably be easier to implement, and possibly simpler to use.

@bartmeuris
Copy link

I was looking at the issues here, having a similar use-case, where I would like to change the behavior of a dependency/requirement depending on which task it triggers.

The second solution could work, but I was more thinking of inheriting environment variables of parent tasks, but since this could break existing setups, maybe introduce the concept of "global" environment variables, which could both be set directly under the ## Tasks, and overridden per task for itself and the required tasks/dependencies it would trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants