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

[Feature Request] Parameter interpolation should work for runFlow.file #1314

Open
solidcell opened this issue Aug 3, 2023 · 3 comments
Open
Labels
enhancement New feature request or improvement of an existing feature

Comments

@solidcell
Copy link
Contributor

solidcell commented Aug 3, 2023

Is your feature request related to a problem? Please describe.
In order to dry usage of nested flows, I'd like to define constants for their paths. However, parameters don't seem to work when used for runFlow.file.

For instance:

$ export MAESTRO_EMAIL_LOGIN_SUBFLOW=/path/to/subflows/email-login.yaml

...
- runFlow:
    file: /${MAESTRO_SUBFLOW_EMAIL_LOGIN}
...

Note: I'm using a leading / so that the path isn't interpreted as a relative path. Ostensibly, this wouldn't be necessary if interpolation worked, since it would see there's already a leading /.

Describe the solution you'd like
I'd like for the above to interpolate correctly. However, it looks like interpolation doesn't occur. The text is taken literally.

I get a failure with the following error message:
Flow file is invalid: /${MAESTRO_SUBFLOW_EMAIL_LOGIN}

The documentation doesn't go into specifics about where interpolation is permitted, but from the examples and my experimentation, it seems like it only works on top-level nodes.

Not only would I like this to work in order to keep my flow files DRY and less verbose, but they are much too coupled with the directory structure otherwise. For instance, if I have the following structure:

flows/auth/feature.yaml
flows/subflows/email-login.yaml

Then in feature.yaml I need to reference the subflow via ../../subflows/email-login.yaml
The flow file shouldn't need to know internally where it lives. And I'd argue it shouldn't need to know where a subflow files lives either.
If I change the directory structure of my flow files in the future, even just a little, it will case a lot of pain.

Describe alternatives you've considered

  1. I could just continue to fully type out the paths, which is quite verbose and not DRY.
  2. I could run some external preprocessor to interpolate it myself and not rely on Maestro's interpolation, however this doesn't seem worth it. The documentation should at least be specific about the intended usage and limitations.
@solidcell solidcell added the enhancement New feature request or improvement of an existing feature label Aug 3, 2023
@ricardo7martins
Copy link

This would be super helpful. Interesting how this is a thing for actions, but not for runFlow/runScript. As pointed above, having to type the same path on several files is quite cumbersome. I was trying to create an output.paths for a while before coming here and seeing it's not a thing already. Sad

@kris-luminar
Copy link

I'm encountering this same limitation. I agree with OP that this should be supported and if not, should be explicitly stated in the docs that file: doesn't accept variable input.

I tried a million different variations and nothing works. I tried using a JavaScript variable too, which is my current use-case.

@ramosjoel
Copy link

I'm running into the same thing as OP. The real issue is working with relative paths where a flow to relies on another file (yaml or JS).

For me, relative paths work locally but don't work in CI when I try to run tests in Robin Cloud via the maestro cloud command.

I'm trying to have separate iOS and Android tests rely on common JS scripts that are not platform-specific.

js/
- script.js
ios/
- test.yaml # relies on ../js/script.js
android/
- test.yaml # relies on ../js/script.js

This works locally, but when I try to run a version of maestro cloud --flows=ios/ in Bitrise CI, I get:

Uploading Flow(s)...
....................Upload request failed (400): Syntax error: Failed to parse file: /./test.yaml
Flow file does not exist: jar:file:///tmp/tmp-workspace-file12442427285540960186!/./../js/script.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request or improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants