Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/DeployRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Member

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
Member

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
Member

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
Member

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.

$this->log->debug(
sprintf('Setting var "%s" to %s for stage "%s"', $key, json_encode($value), $stage->getName())
);
$host->set($key, $value);
}

foreach ($config->getVariables('deploy') as $key => $value) {
$this->log->debug(
sprintf('Setting var "%s" to %s for stage "%s"', $key, json_encode($value), $stage->getName())
);
$host->set($key, $value);
}
foreach ($config->getVariables('deploy:'.$stage->getName()) as $key => $value) {
$this->log->debug(
sprintf('Setting var "%s" to %s for stage "%s"', $key, json_encode($value), $stage->getName())
);
$host->set($key, $value);
}
}

private function maybeConfigureBrancherServer(Server $server, bool $reuseBrancher): void
Expand Down Expand Up @@ -279,13 +292,26 @@ private function initializeBuildStage(Configuration $config): void
);
$host->set($key, $value);
}

foreach ($config->getVariables('all:'.$stage->getName()) as $key => $value) {
$this->log->debug(
sprintf('Setting var "%s" to %s for stage "%s"', $key, json_encode($value), $stage->getName())
);
$host->set($key, $value);
}

foreach ($config->getVariables('build') as $key => $value) {
$this->log->debug(
sprintf('Setting var "%s" to %s for stage "build"', $key, json_encode($value))
);
$host->set($key, $value);
}
foreach ($config->getVariables('build:'.$stage->getName()) as $key => $value) {
$this->log->debug(
sprintf('Setting var "%s" to %s for stage "%s"', $key, json_encode($value), $stage->getName())
);
$host->set($key, $value);
}
}

/**
Expand Down