Skip to content

Commit 9a1e587

Browse files
committed
fix: disable buildx attestations via environment variable instead of --provenance option
1 parent 96126fb commit 9a1e587

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/Executable/AbstractExecutable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ protected function isExecutableInstalled(string $executable): bool
4949
/**
5050
* Run the executable with the given command and return the Process object used to run it.
5151
*/
52-
protected function run(string $command, ?string $cwd = null, ?float $timeout = 60): Process
52+
protected function run(string $command, ?string $cwd = null, ?array $env = null, ?float $timeout = 60): Process
5353
{
5454
if (!$this->isInstalled()) {
5555
throw new ExecutableNotDetectedException($this);
5656
}
5757

58-
return Process::runShellCommandline(sprintf('%s %s', $this->getExecutable(), $command), $cwd, null, null, $timeout);
58+
return Process::runShellCommandline(sprintf('%s %s', $this->getExecutable(), $command), $cwd, $env, null, $timeout);
5959
}
6060

6161
/**

src/Executable/DockerExecutable.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ public function build(string $file, string $tag, string $architecture = '', ?str
2929
}
3030

3131
$command = sprintf('build --pull --file=%s --platform=%s --tag=%s', $file, $platform, $tag);
32+
$environment = null;
3233

3334
if ('docker' === $this->getExecutable()) {
34-
$command .= ' --provenance=false';
35+
$environment = ['BUILDX_NO_DEFAULT_ATTESTATIONS' => '1'];
3536
}
3637

37-
$this->run(sprintf('%s .', $command), $cwd, null);
38+
$this->run(sprintf('%s .', $command), $cwd, $environment, null);
3839
}
3940

4041
/**
@@ -72,7 +73,7 @@ public function login(string $username, string $password, string $server, ?strin
7273
*/
7374
public function push(string $image, ?string $cwd = null): void
7475
{
75-
$this->run(sprintf('push %s', $image), $cwd, null);
76+
$this->run(sprintf('push %s', $image), $cwd, null, null);
7677
}
7778

7879
/**

src/Executable/WpCliExecutable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ public function listPlugins(?string $cwd = null): Collection
9090
/**
9191
* {@inheritdoc}
9292
*/
93-
protected function run(string $command, ?string $cwd = null, ?float $timeout = 60): Process
93+
protected function run(string $command, ?string $cwd = null, ?array $env = null, ?float $timeout = 60): Process
9494
{
9595
if (function_exists('posix_geteuid') && 0 === posix_geteuid()) {
9696
throw new WpCliException('WP-CLI commands can only be run as a non-root user');
9797
}
9898

9999
try {
100-
return parent::run($command, $cwd, $timeout);
100+
return parent::run($command, $cwd, $env, $timeout);
101101
} catch (RuntimeException $exception) {
102102
throw new WpCliException($exception->getMessage(), $exception->getCode(), $exception);
103103
}

0 commit comments

Comments
 (0)