-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29945 from julien-jean/player-next-as-player
[player] new player version
- Loading branch information
Showing
266 changed files
with
10,478 additions
and
4,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: build_canary | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Docker meta | ||
id: docker_meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: blackfire/player | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=raw,value=canary | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- | ||
name: Wait for package to be available | ||
timeout-minutes: 10 | ||
run: | | ||
until $(curl --output /dev/null --silent --head --fail https://get.blackfire.io/blackfire-player-latest.phar); do | ||
printf '.' | ||
sleep 5 | ||
done | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/386,linux/arm64 | ||
build-args: | | ||
VERSION_SUFFIX=-latest | ||
push: true | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Blackfire Player package. | ||
* | ||
* (c) Fabien Potencier <fabien@blackfire.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Blackfire\Player\Adapter; | ||
|
||
use Blackfire\Client; | ||
use Blackfire\ClientConfiguration; | ||
use Blackfire\Exception\ApiException; | ||
use Blackfire\Player\Build\Build; | ||
use Blackfire\Player\Exception\ApiCallException; | ||
use Blackfire\Profile; | ||
use Blackfire\Profile\Configuration; | ||
use Blackfire\Profile\Request; | ||
|
||
class BlackfireSdkAdapter implements BlackfireSdkAdapterInterface | ||
{ | ||
public function __construct( | ||
private readonly Client $blackfireClient, | ||
) { | ||
} | ||
|
||
public function getConfiguration(): ClientConfiguration | ||
{ | ||
try { | ||
return $this->blackfireClient->getConfiguration(); | ||
} catch (ApiException $e) { | ||
throw $this->createApiCallException($e); | ||
} | ||
} | ||
|
||
public function createRequest(string|Configuration $config = null): Request | ||
{ | ||
try { | ||
return $this->blackfireClient->createRequest($config); | ||
} catch (ApiException $e) { | ||
throw $this->createApiCallException($e); | ||
} | ||
} | ||
|
||
public function updateProfile(string $uuid, string $title, array $metadata = null): bool | ||
{ | ||
try { | ||
return $this->blackfireClient->updateProfile($uuid, $title, $metadata); | ||
} catch (ApiException $e) { | ||
throw $this->createApiCallException($e); | ||
} | ||
} | ||
|
||
public function getProfile(string $uuid): Profile | ||
{ | ||
try { | ||
return $this->blackfireClient->getProfile($uuid); | ||
} catch (ApiException $e) { | ||
throw $this->createApiCallException($e); | ||
} | ||
} | ||
|
||
public function startBuild(string $env = null, array $options = []): Build | ||
{ | ||
try { | ||
$sdkBuild = $this->blackfireClient->startBuild($env, $options); | ||
|
||
return new Build($sdkBuild->getUuid(), $sdkBuild->getUrl()); | ||
} catch (ApiException $e) { | ||
throw $this->createApiCallException($e); | ||
} | ||
} | ||
|
||
private function createApiCallException(ApiException $e): ApiCallException | ||
{ | ||
// Remove the headers from the exception | ||
$message = preg_replace('/ \[headers: [^\]]*\]$/', '', $e->getMessage()); | ||
|
||
return new ApiCallException($message, $e->getCode(), $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Blackfire Player package. | ||
* | ||
* (c) Fabien Potencier <fabien@blackfire.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Blackfire\Player\Adapter; | ||
|
||
use Blackfire\ClientConfiguration; | ||
use Blackfire\Player\Build\Build; | ||
use Blackfire\Profile; | ||
use Blackfire\Profile\Configuration; | ||
use Blackfire\Profile\Request; | ||
|
||
interface BlackfireSdkAdapterInterface | ||
{ | ||
public function getConfiguration(): ClientConfiguration; | ||
|
||
public function createRequest(string|Configuration $config = null): Request; | ||
|
||
public function updateProfile(string $uuid, string $title, array $metadata = null): bool; | ||
|
||
public function getProfile(string $uuid): Profile; | ||
|
||
public function startBuild(string $env = null, array $options = []): Build; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Blackfire Player package. | ||
* | ||
* (c) Fabien Potencier <fabien@blackfire.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Blackfire\Player\Build; | ||
|
||
readonly class Build | ||
{ | ||
public function __construct( | ||
public string $uuid, | ||
public null|string $url = null, | ||
) { | ||
} | ||
} |
Oops, something went wrong.