-
Notifications
You must be signed in to change notification settings - Fork 6
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
Set variables for stages #96
base: master
Are you sure you want to change the base?
Conversation
Adds all:<stage>, build:<stage> and deploy:<stage> as variable stages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your contribution!
The use case sounds sensible to me, let's get this stuff merged :). Could you apply the formatting I mentioned?
src/DeployRunner.php
Outdated
@@ -210,12 +210,25 @@ private function configureStageServer(Stage $stage, Server $server, Configuratio | |||
); | |||
$host->set($key, $value); | |||
} | |||
foreach ($config->getVariables('all:'.$stage->getName()) as $key => $value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply PSR 12 formatting :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also for the other parts of this patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed a bug for missing variable and combined the four loops into one loop that goes through the four stages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! One more question, does it make sense to have stage specific variables for the build step? How does build for production for example? As far as I know you can only build one variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you call $configuration->setVariable('build_number', 5, "build:production")
. This will only be available in production builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay just curious, how do you build for production? Do you set an env variable? Because it's not possible to pass a stage to the build
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdgroot We haven't started using this. Even with the change we could not get the specific problem fixed. As we could not change or add a task after the symlink task. We had to use another solution.
Adds
all:<stage>
,build:<stage>
anddeploy:<stage>
as variable stages.This is useful to use different variables between public and staging. With this change you can add variables for a deploy step and something different for public and staging.