Skip to content

Conversation

tdgroot
Copy link
Member

@tdgroot tdgroot commented Nov 22, 2022

The configuration can be done as follows:

$testStage = $configuration->addStage('test', 'example.com');
$testStage->addBrancherServer('appname')
    ->setLabels(['stage=test', 'ci_ref=' . \getenv('GITHUB_REF') ?: 'none'])
    ->setSettings(['cron_enabled' => false, 'supervisor_enabled' => false]);

These labels can be used in Hypernode Deploy to determine what brancher nodes to clean up, for example: clean up brancher servers matching specified stage and their labels.

Copy link
Contributor

@AlexanderGrooff AlexanderGrooff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -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'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These labels are all formatted as X=Y, but there isn't some validation based on this format right? Any format of label is allowed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any format is allowed indeed

*/
public function setLabels(array $labels): self
{
$this->setOption(self::OPTION_HN_BRANCHER_LABELS, $labels);
Copy link
Contributor

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?

Copy link
Member Author

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

@tdgroot tdgroot force-pushed the brancher_labels_and_settings branch from 0d97601 to de45e75 Compare November 23, 2022 09:08
@tdgroot tdgroot merged commit 400b3b3 into master Nov 23, 2022
@tdgroot tdgroot deleted the brancher_labels_and_settings branch November 23, 2022 11:16
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.

3 participants