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

Set variables for stages #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mbm-peter
Copy link

@mbm-peter mbm-peter commented Dec 13, 2023

Adds all:<stage>, build:<stage> and deploy:<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.

Adds all:<stage>, build:<stage> and deploy:<stage> as variable stages.
Copy link
Collaborator

@tdgroot tdgroot left a 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?

@@ -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) {
Copy link
Collaborator

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 :)

Copy link
Collaborator

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

Copy link
Author

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.

Copy link
Collaborator

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.

Copy link
Author

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.

Copy link
Collaborator

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.

Copy link
Author

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.

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

Successfully merging this pull request may close these issues.

2 participants