-
Notifications
You must be signed in to change notification settings - Fork 6
Add interface for specifying brancher labels and settings #31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hypernode\DeployConfiguration; | ||
|
||
class BrancherServer extends Server | ||
{ | ||
public function getLabels(): array | ||
{ | ||
return $this->getOptions()[self::OPTION_HN_BRANCHER_LABELS] ?? []; | ||
} | ||
|
||
/** | ||
* @param string[] $labels Labels to be applied to the brancher node | ||
* @return $this | ||
*/ | ||
public function setLabels(array $labels): self | ||
{ | ||
$this->setOption(self::OPTION_HN_BRANCHER_LABELS, $labels); | ||
return $this; | ||
} | ||
|
||
public function getSettings(): array | ||
{ | ||
return $this->getOptions()[self::OPTION_HN_BRANCHER_SETTINGS] ?? []; | ||
} | ||
|
||
/** | ||
* @param array $settings Settings to be applied to the brancher node | ||
* @return $this | ||
*/ | ||
public function setSettings(array $settings): self | ||
{ | ||
$this->setOption(self::OPTION_HN_BRANCHER_SETTINGS, $settings); | ||
return $this; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
$productionStage->addServer('appname.hypernode.io'); | ||
|
||
$testStage = $configuration->addStage('test', 'example.com'); | ||
$testStage->addBrancherServer('appname'); | ||
$testStage->addBrancherServer('appname') | ||
->setLabels(['stage=test', 'ci_ref=' . \getenv('GITHUB_RUN_ID') ?: 'none']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These labels are all formatted as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any format is allowed indeed |
||
->setSettings(['cron_enabled' => false, 'supervisor_enabled' => false]); | ||
|
||
return $configuration; |
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.
Do you think it's wise to add input validation in the client here or should we let the API validate the data?
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.
Yes I think so, since this is a very light component, let's add the validation in hypernode-deploy