Lets try that builder again.

This commit is contained in:
Greyscale 2024-05-18 17:31:44 +02:00
parent ba895b221f
commit 06b093362b
14 changed files with 47 additions and 109 deletions

View file

@ -1,4 +1,4 @@
name: Build Swarm Loadbalancer
name: "Build"
permissions:
contents: read

View file

@ -1,4 +1,4 @@
name: Build Swarm Loadbalancer
name: "Build: Docker"
permissions:
contents: read
@ -21,37 +21,13 @@ jobs:
name: Build Swarm Loadbalancer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: date
run: |
{
echo "datetime=$(date +'%Y-%m-%d %H:%M:%S')"
echo "date=$(date +'%Y-%m-%d')"
echo "time=$(date +'%H:%M:%S')"
echo "container_build_datetime=$(date -u +'%Y-%m-%dT%H:%M:%S.%3NZ')"
} >> "$GITHUB_OUTPUT"
- id: read-php-version
run: echo "php_version=$(jq -r '.require["php"]' composer.json | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
- uses: shivammathur/setup-php@v2
- uses: benzine-framework/action-setup-php@main
- uses: benzine-framework/action-setup-docker@main
with:
php-version: ${{ steps.read-php-version.outputs.php_version }}
- uses: docker/setup-qemu-action@v3
- uses: crazy-max/ghaction-github-runtime@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: matthewbaggett
password: ${{ secrets.GITHUB_TOKEN }}
- id: composer-cache-find
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- id: composer-cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-find.outputs.dir }}
key: "${{ runner.os }}-bouncer-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: ${{ runner.os }}-bouncer-composer-
- run: composer install --ignore-platform-reqs --prefer-dist
ghcr_user: ${{ github.repository_owner }}
ghcr_token: ${{ secrets.GHCR_TOKEN }}
docker_hub_user: ${{ secrets.DOCKER_HUB_USER }}
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: "Build & Push Candidate Image as ${{ env.CANDIDATE_IMAGE }}"
uses: docker/build-push-action@v5
with:
@ -62,8 +38,8 @@ jobs:
build-args: |
GIT_SHA=${{ github.sha }}
GIT_BUILD_ID=${{ github.ref_name }}
BUILD_DATE=${{ steps.date.outputs.container_build_datetime }}
GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }}
BUILD_DATE=${{ steps.date.outputs.container_build_datetime }}
platforms: ${{ !env.ACT && env.PLATFORMS || 'linux/amd64' }}
pull: true
push: true

View file

@ -1,4 +1,4 @@
name: Release Swarm Loadbalancer
name: "Build: Release"
permissions:
contents: read
@ -30,9 +30,12 @@ jobs:
steps:
- name: "Pull Candidate Image"
run: docker pull ${{ env.CANDIDATE_IMAGE }}
- name: "Login to Docker Hub"
if: matrix.registry == 'docker'
run: docker login -u matthewbaggett -p ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: benzine-framework/action-setup-docker@main
with:
ghcr_user: ${{ github.repository_owner }}
ghcr_token: ${{ secrets.GHCR_TOKEN }}
docker_hub_user: ${{ secrets.DOCKER_HUB_USER }}
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: "Login to GHCR"
if: matrix.registry == 'ghcr'
run: docker login ghcr.io -u matthewbaggett -p ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,4 +1,4 @@
name: Validate Swarm Loadbalancer
name: "Build: Validate"
permissions:
contents: read

View file

@ -1,4 +1,4 @@
name: "QC: PHP"
name: "Quality Control: PHP"
permissions:
contents: read
@ -24,23 +24,8 @@ jobs:
checks: write # To post annotations
contents: read # For repo checkout
steps:
- uses: actions/checkout@v4
- id: read-php-version
run: echo "php_version=$(jq -r '.require["php"]' composer.json | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ steps.read-php-version.outputs.php_version }}
tools: phpstan
- id: composer-cache-find
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- id: composer-cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-find.outputs.dir }}
key: "${{ runner.os }}-bouncer-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: ${{ runner.os }}-bouncer-composer-
- run: composer install --ignore-platform-reqs --prefer-dist
- run: phpstan analyse src
- uses: benzine-framework/action-setup-php@main
- run: vendor/bin/phpstan analyse src
php-cs-fixer:
name: PHP-CS-Fixer
@ -48,13 +33,6 @@ jobs:
permissions:
checks: write # For trunk to post annotations
contents: read # For repo checkout
pull-requests: write # To create PRs
steps:
- uses: actions/checkout@v4
- id: read-php-version
run: echo "php_version=$(jq -r '.require["php"]' composer.json | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ steps.read-php-version.outputs.php_version }}
tools: php-cs-fixer
- run: php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose --dry-run
- uses: benzine-framework/action-setup-php@main
- run: vendor/bin/php-cs-fixer fix --diff --verbose --dry-run

View file

@ -1,4 +1,4 @@
name: Trunk Cache
name: "Quality Control: Trunk Cache"
permissions: read-all
@ -24,12 +24,7 @@ jobs:
permissions:
actions: write
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: "Checkout"
uses: actions/checkout@v4
- uses: benzine-framework/action-setup-php@main
- name: "Trunk Cache"
uses: trunk-io/trunk-action@v1
with:

View file

@ -1,4 +1,4 @@
name: Trunk Check
name: "Quality Control: Trunk Check"
permissions: read-all
@ -23,11 +23,6 @@ jobs:
checks: write # For trunk to post annotations
contents: read # For repo checkout
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: "Checkout"
uses: actions/checkout@v4
- uses: benzine-framework/action-setup-php@main
- name: "Trunk Check"
uses: trunk-io/trunk-action@v1

View file

@ -1,4 +1,4 @@
name: Trunk Upgrade
name: "Quality Control: Trunk Upgrade"
permissions: read-all
@ -26,12 +26,7 @@ jobs:
contents: write # For trunk to create PRs
pull-requests: write # For trunk to create PRs
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: "Checkout"
uses: actions/checkout@v4
- uses: benzine-framework/action-setup-php@main
- name: "Trunk Upgrade"
uses: trunk-io/trunk-action/upgrade@v1
- name: "PR: Find Pull Request"

View file

@ -11,7 +11,6 @@ use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Rector\Class_\PreferPHPUnitSelfCallRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Removing\Rector\FuncCall\RemoveFuncCallRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Symfony\Set\SensiolabsSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

View file

@ -659,6 +659,7 @@ class Bouncer
if (array_reduce($targets, fn ($carry, $target) => $carry || $target->requiresForcedScanning(), false)) {
$this->logger->warning('Forcing an update in 5 seconds because one or more targets require it.', ['emoji' => Emoji::warning()]);
sleep(5);
return;
}

View file

@ -6,6 +6,4 @@ namespace Bouncer\Logger\Handlers;
use Monolog\Handler\StreamHandler;
class Cli extends StreamHandler
{
}
class Cli extends StreamHandler {}

View file

@ -11,6 +11,4 @@ use Monolog\Handler\TestHandler;
*
* @coversNothing
*/
class Test extends TestHandler
{
}
class Test extends TestHandler {}

View file

@ -7,7 +7,6 @@ namespace Bouncer;
use Bouncer\Logger\AbstractLogger;
use Bouncer\Logger\Logger;
use Bouncer\Settings\Settings;
use Psr\Log\LoggerInterface;
use Spatie\Emoji\Emoji;
class Target
@ -20,17 +19,17 @@ class Target
private bool $letsEncrypt = false;
private string $targetPath;
private bool $allowNonSSL;
private bool $useTemporaryCert = false;
private bool $useGlobalCert = false;
private ?string $customCert = null;
private ?string $customCertKey = null;
private bool $allowWebsocketSupport = true;
private bool $allowLargePayloads = false;
private ?int $proxyTimeoutSeconds = null;
private ?string $username = null;
private ?string $password = null;
private ?string $hostOverride = null;
private ?string $customNginxConfig = null;
private bool $useTemporaryCert = false;
private bool $useGlobalCert = false;
private ?string $customCert = null;
private ?string $customCertKey = null;
private bool $allowWebsocketSupport = true;
private bool $allowLargePayloads = false;
private ?int $proxyTimeoutSeconds = null;
private ?string $username = null;
private ?string $password = null;
private ?string $hostOverride = null;
private ?string $customNginxConfig = null;
private bool $requiresForcedScanning = false;
public function __construct(
@ -414,7 +413,6 @@ class Target
return $this;
}
public function updateLogger(): self
{
$this->logger = $this->logger->withName($this->getLabel());

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
$environment = array_merge($_ENV, $_SERVER);
$site = $environment['SITE_NAME'] ?? 'unknown';
$server = $environment['SERVER_NAME'] ?? gethostname();
printf("<h1>Website %s</h1><p>Running on %s</p>", $site, $server);
$site = $environment['SITE_NAME'] ?? 'unknown';
$server = $environment['SERVER_NAME'] ?? gethostname();
printf('<h1>Website %s</h1><p>Running on %s</p>', $site, $server);