Skip to content

Commit

Permalink
Cleanup: Log about Hypernode and labels used for cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tdgroot committed Jan 3, 2023
1 parent 47891b4 commit eab093c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions ci/test/run-brancher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ $DP rm -f deployment-report.json
$DP hypernode-deploy cleanup test -vvv | tee cleanup.log

# Run tests on cleanup
grep -F "Cleaning up Brancher instances based on Hypernode hndeployintegr8 with labels [gitref=${GITHUB_SHA:-unknown}]" cleanup.log
grep "Stopping brancher Hypernode ${BRANCHER_INSTANCE}..." cleanup.log
13 changes: 12 additions & 1 deletion src/Command/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Hypernode\DeployConfiguration\BrancherServer;
use Hypernode\DeployConfiguration\Configuration;
use Hypernode\DeployConfiguration\Server;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -23,19 +24,22 @@ class Cleanup extends Command
private DeployerLoader $deployerLoader;
private ConfigurationLoader $configurationLoader;
private BrancherHypernodeManager $brancherHypernodeManager;
private LoggerInterface $logger;

public function __construct(
ReportLoader $reportLoader,
DeployerLoader $deployerLoader,
ConfigurationLoader $configurationLoader,
BrancherHypernodeManager $brancherHypernodeManager
BrancherHypernodeManager $brancherHypernodeManager,
LoggerInterface $logger
) {
parent::__construct();

$this->reportLoader = $reportLoader;
$this->deployerLoader = $deployerLoader;
$this->configurationLoader = $configurationLoader;
$this->brancherHypernodeManager = $brancherHypernodeManager;
$this->logger = $logger;
}

protected function configure()
Expand Down Expand Up @@ -89,6 +93,13 @@ private function cancelByStage(string $stageName, Configuration $config): void
}
$labels = $server->getLabels();
$hypernode = $server->getOptions()[Server::OPTION_HN_PARENT_APP];
$this->logger->debug(
sprintf(
'Cleaning up Brancher instances based on Hypernode %s with labels [%s]',
$hypernode,
implode(', ', $labels),
)
);
$brancherHypernodes = $this->brancherHypernodeManager->queryBrancherHypernodes(
$hypernode,
$labels
Expand Down

0 comments on commit eab093c

Please sign in to comment.