From all the testing I've done with Envoy over the past few months, there doesn't seem to be an efficient way to make the code DRY (as in, avoid duplication). This is more concerning than it appears because envoy scripts can get very long and complicated, even for basic deployment tasks.
Here are some real use-cases I am struggling with at the moment:
Luckily, envoy accepts passing variables into it from the command line, like so:
envoy run build --env=local
envoy run build --env=staging
envoy run build --env=production
envoy run deploy --env=staging
envoy run deploy --env=production
The first 3 build for different environments, the last 2 build and deploy to the appropriate environment.
All of these use-cases involve 90% of the same set of steps (checkout repo, pick the right env file, create build, optionally deploy to the appropriate server or keep it local), except they need to do slightly different things (like use .env.local instead of .env.production) based on the variables that are passed in.
Variables passed in from the command line can be 'read' within the @ setup directive, but the problem arises in taking it a step further from there:
- I don't see a way for a story to call another story dynamically, based on a parameter passed in from the command line.
- There's also no way that I know of to pass variables into Envoy @ tasks . I had asked for this a few months ago but it got closed. Also, asking on discord, laracasts etc did not get any answers...but I have a hard time believing that I am the only person that has this issue or use case.
I am raising this again because copy-pasting and duplicating 200 lines of a task in envoy.blade.php another 3-4 times makes zero sense to me.
The ask is simple...to provide a way to do # 1 or # 2 above, so that envoy scripts can become a lot more manageable.
enhancement