Remove shallow() task method

This commit is contained in:
Anton Medvedev 2021-11-21 10:57:25 +01:00
parent e04b166337
commit 3e1540440e
19 changed files with 14 additions and 73 deletions

View File

@ -121,8 +121,7 @@ task('chatwork:test', function () {
set('chatwork_message', get('chatwork_failure_text'));
invoke('chatwork_send_message');
})
->once()
->shallow();
->once();
desc('Notifies Chatwork');
task('chatwork:notify', function () {
@ -137,7 +136,6 @@ task('chatwork:notify', function () {
invoke('chatwork_send_message');
})
->once()
->shallow()
->hidden();
desc('Notifies Chatwork about deploy finish');
@ -154,7 +152,6 @@ task('chatwork:notify:success', function () {
invoke('chatwork_send_message');
})
->once()
->shallow()
->hidden();
desc('Notifies Chatwork about deploy failure');
@ -171,5 +168,4 @@ task('chatwork:notify:failure', function () {
invoke('chatwork_send_message');
})
->once()
->shallow()
->hidden();

View File

@ -115,7 +115,6 @@ task('cimonitor:notify', function () {
Httpie::post(get('cimonitor_webhook'))->jsonBody($body)->send();
})
->once()
->shallow()
->hidden();
desc('Notifies CIMonitor about deploy finish');
@ -144,7 +143,6 @@ task('cimonitor:notify:success', function () {
Httpie::post(get('cimonitor_webhook'))->jsonBody($body)->send();
})
->once()
->shallow()
->hidden();
desc('Notifies CIMonitor about deploy failure');
@ -171,6 +169,5 @@ task('cimonitor:notify:failure', function () {
Httpie::post(get('cimonitor_webhook'))->jsonBody($body)->send();
})
->once()
->shallow()
->hidden();

View File

@ -97,8 +97,7 @@ task('discord:test', function () {
set('discord_message', 'discord_failure_text');
invoke('discord_send_message');
})
->once()
->shallow();
->once();
desc('Notifies Discord');
task('discord:notify', function () {
@ -106,7 +105,6 @@ task('discord:notify', function () {
invoke('discord_send_message');
})
->once()
->shallow()
->isHidden();
desc('Notifies Discord about deploy finish');
@ -115,7 +113,6 @@ task('discord:notify:success', function () {
invoke('discord_send_message');
})
->once()
->shallow()
->isHidden();
desc('Notifies Discord about deploy failure');
@ -124,5 +121,4 @@ task('discord:notify:failure', function () {
invoke('discord_send_message');
})
->once()
->shallow()
->isHidden();

View File

@ -100,7 +100,6 @@ task('chat:notify', function () {
Httpie::post(get('chat_webhook'))->jsonBody(['cards' => $card])->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Google Hangouts Chat about deploy finish');
@ -143,7 +142,6 @@ task('chat:notify:success', function () {
Httpie::post(get('chat_webhook'))->jsonBody(['cards' => $card])->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Google Hangouts Chat about deploy failure');
@ -187,5 +185,4 @@ task('chat:notify:failure', function () {
Httpie::post(get('chat_webhook'))->jsonBody(['cards' => $card])->send();
})
->once()
->shallow()
->hidden();

View File

@ -101,7 +101,6 @@ task('teams:notify', function () {
])->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Teams about deploy finish');
@ -116,7 +115,6 @@ task('teams:notify:success', function () {
])->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Teams about deploy failure');
@ -131,5 +129,4 @@ task('teams:notify:failure', function () {
])->send();
})
->once()
->shallow()
->hidden();

View File

@ -55,5 +55,4 @@ task('newrelic:notify', function () {
}
})
->once()
->shallow()
->hidden();

View File

@ -51,5 +51,4 @@ task('rollbar:notify', function () {
->formBody($params)
->send();
})
->once()
->shallow();
->once();

View File

@ -112,7 +112,6 @@ task('slack:notify', function () {
checkSlackAnswer($result);
})
->once()
->shallow()
->hidden();
desc('Notifies Slack about deploy finish');
@ -132,7 +131,6 @@ task('slack:notify:success', function () {
checkSlackAnswer($result);
})
->once()
->shallow()
->hidden();
desc('Notifies Slack about deploy failure');
@ -152,7 +150,6 @@ task('slack:notify:failure', function () {
checkSlackAnswer($result);
})
->once()
->shallow()
->hidden();
desc('Notifies Slack about rollback');
@ -172,5 +169,4 @@ task('slack:notify:rollback', function () {
checkSlackAnswer($result);
})
->once()
->shallow()
->hidden();

View File

@ -112,7 +112,6 @@ task('telegram:notify', function () {
$httpie->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Telegram about deploy finish');
@ -142,7 +141,6 @@ task('telegram:notify', function () {
$httpie->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Telegram about deploy failure');
@ -172,5 +170,4 @@ task('telegram:notify', function () {
$httpie->send();
})
->once()
->shallow()
->hidden();

View File

@ -103,7 +103,6 @@ task('workplace:notify', function () {
}
})
->once()
->shallow()
->hidden();
desc('Notifies Workplace about deploy finish');
@ -115,7 +114,6 @@ task('workplace:notify:success', function () {
return Httpie::post($url)->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Workplace about deploy failure');
@ -127,5 +125,4 @@ task('workplace:notify:failure', function () {
return Httpie::post($url)->send();
})
->once()
->shallow()
->hidden();

View File

@ -89,7 +89,6 @@ task('yammer:notify', function () {
->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Yammer about deploy finish');
@ -109,7 +108,6 @@ task('yammer:notify:success', function () {
->send();
})
->once()
->shallow()
->hidden();
desc('Notifies Yammer about deploy failure');
@ -129,5 +127,4 @@ task('yammer:notify:failure', function () {
->send();
})
->once()
->shallow()
->hidden();

View File

@ -183,7 +183,6 @@ task('deploy:publish', [
task('deploy:success', function () {
info('successfully deployed!');
})
->shallow()
->hidden();
@ -192,7 +191,6 @@ task('deploy:success', function () {
*/
task('deploy:failed', function () {
})
->shallow()
->hidden();
fail('deploy', 'deploy:failed');

View File

@ -20,5 +20,4 @@ task('deploy:info', function () {
$what = "<fg=magenta;options=bold>HEAD</>";
}
info("deploying $what");
})
->shallow();
});

View File

@ -37,16 +37,14 @@ class Messenger
public function startTask(Task $task): void
{
$this->startTime = round(microtime(true) * 1000);
if (!$task->isShallow()) {
if (getenv('GITHUB_WORKFLOW')) {
$this->output->writeln("::group::task {$task->getName()}");
} else if (getenv('GITLAB_CI')) {
$this->output->writeln("\e[0Ksection_start:{$this->startTime}:{$this->startTime}[collapsed=true]\r\e[0K{$task->getName()}");
} else {
$this->output->writeln("<fg=cyan;options=bold>task</> {$task->getName()}");
}
$this->logger->log("task {$task->getName()}");
if (getenv('GITHUB_WORKFLOW')) {
$this->output->writeln("::group::task {$task->getName()}");
} else if (getenv('GITLAB_CI')) {
$this->output->writeln("\e[0Ksection_start:{$this->startTime}:{$this->startTime}[collapsed=true]\r\e[0K{$task->getName()}");
} else {
$this->output->writeln("<fg=cyan;options=bold>task</> {$task->getName()}");
}
$this->logger->log("task {$task->getName()}");
}
/*
@ -54,9 +52,6 @@ class Messenger
*/
public function endTask(Task $task): void
{
if ($task->isShallow()) {
return;
}
if (empty($this->startTime)) {
$this->startTime = round(microtime(true) * 1000);
}
@ -69,7 +64,7 @@ class Messenger
if (getenv('GITHUB_WORKFLOW')) {
$this->output->writeln("::endgroup::");
} if (getenv('GITLAB_CI')) {
} else if (getenv('GITLAB_CI')) {
$this->output->writeln("\e[0Ksection_end:{$taskTime}:{$this->startTime}\r\e[0K");
} else if ($this->output->isVeryVerbose()) {
$this->output->writeln("<fg=yellow;options=bold>done</> {$task->getName()} $taskTime");

View File

@ -198,7 +198,6 @@ class Importer
'desc',
'once',
'hidden',
'shallow',
'limit',
'select',
];

View File

@ -20,7 +20,6 @@ class Task
private $hidden = false;
private $once = false;
private $oncePerNode = false;
private $shallow = false;
private $limit = null;
private $selector = null;
private $verbose = false;
@ -169,20 +168,6 @@ class Task
return $this->after;
}
/**
* Sets task as shallow. Shallow task will not print execution message/finish messages.
*/
public function shallow(bool $shallow = true): self
{
$this->shallow = $shallow;
return $this;
}
public function isShallow(): bool
{
return $this->shallow;
}
public function getLimit(): ?int
{
return $this->limit;

View File

@ -101,9 +101,6 @@
"hidden": {
"type": "boolean"
},
"shallow": {
"type": "boolean"
},
"limit": {
"type": "number"
},

View File

@ -11,4 +11,4 @@ task('test:functions:run-with-placeholders', function (): void {
$output = run($cmd, ['env' => $env]);
output()->writeln($output); // we use this to skip \Deployer\parse() being called in normal \Deployer\writeln()
})->shallow();
});

View File

@ -8,5 +8,5 @@ task('test:misc:sudo-write-user', function (): void {
$cmd = 'sudo bash -c \'echo Current user is: $USER\'';
$output = run($cmd);
writeln($output);
})->shallow();
});