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

[Refactor] Remove fastlane context and replace it with environment variables #68

Closed
KrauseFx opened this issue Feb 21, 2015 · 7 comments

Comments

@KrauseFx
Copy link
Member

Since the environment variables are not passed from fastlane to the parent process after execution, we could easily use the ENV to store the lane context.

Big advantage is, that all values inside ENV are also accessible for all actions. Disadvantages are possible naming conflicts and not being able to store complex objects, but only strings.

@KrauseFx
Copy link
Member Author

@joshdholtz
Copy link
Member

Hmm, I'm not sure actually. I personally don't think there is anything wrong with either approach. I do like the flexibility that the fastlane context can hold any object 😇

@milch
Copy link
Collaborator

milch commented Feb 21, 2015

How about just shadowing the ENV variables in the lane context? This wouldn't sacrifice the lane context's flexibility and would also remove the need to use both everywhere.

@KrauseFx
Copy link
Member Author

How would that handle complex objects in the fastlane context?

@milch
Copy link
Collaborator

milch commented Feb 22, 2015

The "new" lane context I'm proposing would have the following logic on key lookup:

  • Look up the key in the lane context's Hash
  • If there was an object returned, return that
  • Look up the key in ENV
  • Return the result of that

The complex objects would just be stored in the Hash (and could even overwrite values from ENV)

@viktorbenei
Copy link

I like what @milch proposes and I'm not that deeply involved with fastlane tools so far, one thing to consider (based on our project @KrauseFx linked) is how much you care about integration with other tools. What we try to solve with the https://github.com/steplib/steplib project is to connect tools no matter what technology it's built with (can be a bash script, ruby, Go, binary, ...). In that case you just can't use a language specific mechanism for sharing parameters / context.

Generally though you probably won't be able to provide a truly "no wrapper required" solution especially if you want to support existing tools, so I think the parameter passing/context just have to support a unified mechanism for which others can write thin wrappers.

For example we have Steps (tools / components) which basically just expose an interface for an existing tool, and the actual Step code is nothing but a really thin wrapper which transforms the inputs from our interface format (we only use environment variables) to the format the actual tool uses (writes a config file or calls the tool with command line parameters).

Sidenote: we handle complex parameters through the filesystem.

I think the format of the context is less important and that the biggest issue is actually handling tool output collisions, when you run the same tool (or two tools which generate into the same output, be it a context, environment or anything else) multiple times and so only the last output will be actually available. It's even more crucial in case a tool/Step creates multiple outputs but might not export all every time it runs.

A minimalistic example is if a tool/step generates both a success state (true or false) and an optional error message output. If the tool first runs and fails it will generate an error message output. If you run it again and it finishes with success then it will probably only generate the state output but not the error message one, so you can end up with a context where the tool's "state" is "success" but an error message will still be available.

Our best solution so far is the one @KrauseFx linked (https://github.com/steplib/steplib/issues/68) but it's not yet tested and it requires a central tool with which other tools communicate. Our plan at the moment is to have a CLI tool installed in a specific path / made available to other tools and so other tools (rather the wrappers around the tools) will communicate exactly with that specific CLI tool to store generated outputs and the CLI tool manages the aliasing of the outputs in a similar way as Docker environment binding works but we're still discussing the pros&cons of this system with our team.

@KrauseFx
Copy link
Member Author

KrauseFx commented Apr 2, 2015

Thanks everyone for the feedback, I'll close this issue for now and won't change how fastlane handles the environment.

@KrauseFx KrauseFx closed this as completed Apr 2, 2015
KrauseFx added a commit that referenced this issue Mar 7, 2016
KrauseFx added a commit that referenced this issue Mar 7, 2016
Added support for `-derivedDataPath` and `-resultBundlePath` options.
KrauseFx added a commit that referenced this issue Mar 7, 2016
Removed env variable in options.rb
KrauseFx pushed a commit that referenced this issue Mar 7, 2016
@fastlane fastlane locked and limited conversation to collaborators Sep 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants