Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b566f7f
require php 8.4
Baptouuuu Nov 16, 2025
f9d304b
better integrate tests in blackbox
Baptouuuu Nov 16, 2025
27dee27
update dependencies
Baptouuuu Nov 16, 2025
d541785
remove mock system (it will be rebuilt later on)
Baptouuuu Nov 16, 2025
c6714a9
make Server a final class
Baptouuuu Nov 16, 2025
bb4a5c4
make Volumes a final class
Baptouuuu Nov 16, 2025
0d5cc12
make Processes a final class
Baptouuuu Nov 16, 2025
59cc564
add Server::via()
Baptouuuu Nov 16, 2025
70eab14
fix tests
Baptouuuu Nov 16, 2025
f359b5c
let the caller choose the process pid
Baptouuuu Nov 16, 2025
4ffb7a4
add Command::overSSH()
Baptouuuu Dec 2, 2025
a4f9fbc
Revert "add Command::overSSH()"
Baptouuuu Dec 4, 2025
6200deb
extract ssh commands into its own class to let runners inspect them
Baptouuuu Dec 4, 2025
02087ca
avoid using clone
Baptouuuu Dec 4, 2025
c6e05a3
decouple commands definitions from piping them
Baptouuuu Dec 4, 2025
8f4ffa1
expose command definition details
Baptouuuu Dec 4, 2025
5801269
remove Parameter interface
Baptouuuu Dec 4, 2025
a352b58
expose the raw values of parameters
Baptouuuu Dec 4, 2025
a3c8dad
regroup append and overwrite in the same class
Baptouuuu Dec 4, 2025
835c210
simplify string escaping api
Baptouuuu Dec 4, 2025
32b5494
expose pipe sub commands
Baptouuuu Dec 4, 2025
ce14479
tag dependencies
Baptouuuu Jan 31, 2026
45084ad
replace innmind/time-continuum and innmind/time-warp by innmind/time
Baptouuuu Jan 31, 2026
009c0ca
fix warnings
Baptouuuu Jan 31, 2026
94f14f4
add extensive CI
Baptouuuu Jan 31, 2026
913de65
CS
Baptouuuu Jan 31, 2026
83bb281
avoid force unwrapping of Eithers
Baptouuuu Jan 31, 2026
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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ jobs:
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
cs:
uses: innmind/github-workflows/.github/workflows/cs.yml@main
with:
php-version: '8.2'
12 changes: 12 additions & 0 deletions .github/workflows/extensive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Extensive CI

on:
push:
tags:
- '*'
paths:
- '.github/workflows/extensive.yml'

jobs:
blackbox:
uses: innmind/github-workflows/.github/workflows/extensive.yml@main
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Unreleased]

### Changed

- Requires PHP `8.4`
- `Innmind\Server\Control\Server` is now a final class, all previous implementations are now flagged as internal
- `Innmind\Server\Control\Server\Volumes` is now a final class
- `Innmind\Server\Control\Server\Processes` is now a final class
- Requires `innmind/time:~1.0`

## 6.1.0 - 2025-08-06

### Added
Expand Down
4 changes: 4 additions & 0 deletions blackbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
};

Application::new($argv)
->when(
\getenv('BLACKBOX_SET_SIZE') !== false,
static fn(Application $app) => $app->scenariiPerProof((int) \getenv('BLACKBOX_SET_SIZE')),
)
->when(
\getenv('ENABLE_COVERAGE') !== false,
static fn(Application $app) => $app
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
"issues": "http://github.com/Innmind/ServerControl/issues"
},
"require": {
"php": "~8.2",
"innmind/immutable": "~5.12",
"innmind/url": "~4.0",
"php": "~8.4",
"innmind/immutable": "~6.0",
"innmind/url": "~5.0",
"psr/log": "~3.0",
"innmind/time-continuum": "^4.1.1",
"innmind/filesystem": "~8.0",
"innmind/time-warp": "~4.0",
"innmind/io": "~3.1"
"innmind/time": "~1.0",
"innmind/filesystem": "~9.0",
"innmind/io": "~4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -34,7 +33,7 @@
}
},
"require-dev": {
"innmind/static-analysis": "^1.2.1",
"innmind/static-analysis": "~1.3",
"innmind/black-box": "~6.5",
"innmind/coding-standard": "~2.0"
}
Expand Down
21 changes: 21 additions & 0 deletions src/Run/Implementation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types = 1);

namespace Innmind\Server\Control\Run;

use Innmind\Server\Control\Server\{
Command,
Process,
};
use Innmind\Immutable\Attempt;

/**
* @internal
*/
interface Implementation
{
/**
* @return Attempt<Process>
*/
public function __invoke(Command|Command\OverSsh $command): Attempt;
}
48 changes: 48 additions & 0 deletions src/Run/Logger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
declare(strict_types = 1);

namespace Innmind\Server\Control\Run;

use Innmind\Server\Control\Server\Command;
use Innmind\Immutable\Attempt;
use Psr\Log\LoggerInterface;

/**
* @internal
*/
final class Logger implements Implementation
{
private function __construct(
private Implementation $run,
private LoggerInterface $logger,
) {
}

#[\Override]
public function __invoke(Command|Command\OverSsh $command): Attempt
{
$toLog = $command;

if ($toLog instanceof Command\OverSsh) {
$toLog = $toLog->normalize();
}

$this->logger->info('About to execute the {command}', [
'command' => $toLog->toString(),
'workingDirectory' => $toLog->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
),
]);

return ($this->run)($command);
}

/**
* @internal
*/
public static function psr(Implementation $run, LoggerInterface $logger): self
{
return new self($run, $logger);
}
}
54 changes: 54 additions & 0 deletions src/Run/Remote.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
declare(strict_types = 1);

namespace Innmind\Server\Control\Run;

use Innmind\Server\Control\Server\Command;
use Innmind\Url\Authority\{
Host,
Port,
UserInformation\User,
};
use Innmind\Immutable\Attempt;

/**
* @internal
*/
final class Remote implements Implementation
{
private function __construct(
private Implementation $run,
private User $user,
private Host $host,
private ?Port $port,
) {
}

#[\Override]
public function __invoke(Command|Command\OverSsh $command): Attempt
{
return ($this->run)(Command\OverSsh::of(
$this->user,
$this->host,
$this->port,
$command,
));
}

/**
* @internal
*/
public static function of(
Implementation $run,
User $user,
Host $host,
?Port $port = null,
): self {
return new self(
$run,
$user,
$host,
$port,
);
}
}
71 changes: 71 additions & 0 deletions src/Run/Unix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
declare(strict_types = 1);

namespace Innmind\Server\Control\Run;

use Innmind\Server\Control\Server\{
Command,
Process,
};
use Innmind\Time\{
Clock,
Period,
Halt,
};
use Innmind\IO\IO;
use Innmind\Immutable\Attempt;

/**
* @internal
*/
final class Unix implements Implementation
{
private function __construct(
private Clock $clock,
private IO $io,
private Halt $halt,
private Period $grace,
) {
}

#[\Override]
public function __invoke(Command|Command\OverSsh $command): Attempt
{
if ($command instanceof Command\OverSsh) {
$command = $command->normalize();
}

return Attempt::of(function() use ($command) {
$process = new Process\Unix(
$this->clock,
$this->io,
$this->halt,
$this->grace,
$command,
);

if ($command->toBeRunInBackground()) {
return Process::background($process());
}

return Process::foreground($process(), $command->outputToBeStreamed());
});
}

/**
* @internal
*/
public static function of(
Clock $clock,
IO $io,
Halt $halt,
?Period $grace = null,
): self {
return new self(
$clock,
$io,
$halt,
$grace ?? Period::second(1),
);
}
}
40 changes: 40 additions & 0 deletions src/Run/Via.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
declare(strict_types = 1);

namespace Innmind\Server\Control\Run;

use Innmind\Server\Control\Server\{
Command,
Process,
};
use Innmind\Immutable\Attempt;

/**
* @internal
*/
final class Via implements Implementation
{
/**
* @param \Closure(Command|Command\OverSsh): Attempt<Process> $run
*/
private function __construct(
private \Closure $run,
) {
}

#[\Override]
public function __invoke(Command|Command\OverSsh $command): Attempt
{
return ($this->run)($command);
}

/**
* @internal
*
* @param callable(Command|Command\OverSsh): Attempt<Process> $run
*/
public static function of(callable $run): self
{
return new self(\Closure::fromCallable($run));
}
}
Loading