From e46e17b15609a44e5fd759fe1f4c9a439b782a29 Mon Sep 17 00:00:00 2001 From: Shyim Date: Thu, 11 Apr 2024 09:44:42 +0200 Subject: [PATCH] ci: use k8s runner for arm64 --- .github/workflows/build.yml | 11 +- functions.php | 18 ---- generate.php | 197 ------------------------------------ 3 files changed, 10 insertions(+), 216 deletions(-) delete mode 100644 functions.php delete mode 100644 generate.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4416441..465aa04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,10 +63,19 @@ jobs: build-fpm-arm64: name: PHP FPM ${{ matrix.php }} on arm64 - runs-on: hcloud-arm64-small + runs-on: shopware-arm64 + container: ghcr.io/catthehacker/ubuntu:act-22.04 + env: + DOCKER_HOST: localhost:2375 + services: + docker: + image: docker:23-dind-rootless needs: [generate-matrix] strategy: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} steps: + - name: wait for docker to be available + run: while ! docker info 2>&1 >/dev/null; do sleep 1; done + - name: Checkout uses: actions/checkout@v4 diff --git a/functions.php b/functions.php deleted file mode 100644 index 1143823..0000000 --- a/functions.php +++ /dev/null @@ -1,18 +0,0 @@ -\d\.\d\.\d{1,}(RC\d)?)/m'; - -$supervisord = get_digest_of_image('shyim/supervisord', 'latest'); - -$workflow = << $phpShort, - '${PHP_VERSION}' => $supportedVersion, - '${PHP_PATCH_VERSION}' => $patchVersion['version'], - '${PHP_DIGEST}' => $phpDigest, - '${SUPERVISORD_DIGEST}' => $supervisord, - ]; - - file_put_contents($folder . 'Dockerfile', str_replace(array_keys($replaces), array_values($replaces), $tpl)); - - $index[$supportedVersion] = $patchVersion['version']; - - $workflowTpl = <<<'TPL' - - php${PHP_VERSION_SHORT}-arm64: - name: ${PHP_VERSION} on ARM64 - runs-on: hcloud-arm64-small - steps: - - uses: actions/checkout@v3 - - - name: Install Cosign - uses: sigstore/cosign-installer@v3 - - - name: Login into Docker Hub - run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - - name: Login into Github Docker Registery - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - uses: docker/build-push-action@v4 - with: - tags: ghcr.io/shopware/docker-base:${PHP_PATCH_VERSION}-arm64 - context: . - file: ${PHP_VERSION}/Dockerfile - cache-from: type=registry,ref=ghcr.io/shopware/docker-cache:${PHP_VERSION}-arm64 - cache-to: type=registry,ref=ghcr.io/shopware/docker-cache:${PHP_VERSION}-arm64,mode=max - platforms: linux/arm64 - push: true - provenance: false - - php${PHP_VERSION_SHORT}-amd64: - name: ${PHP_VERSION} on AMD64 - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - - name: Install Cosign - uses: sigstore/cosign-installer@v3 - - - name: Login into Github Docker Registery - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - uses: docker/build-push-action@v4 - with: - tags: ghcr.io/shopware/docker-base:${PHP_PATCH_VERSION}-amd64 - context: . - file: ${PHP_VERSION}/Dockerfile - cache-from: type=registry,ref=ghcr.io/shopware/docker-cache:${PHP_VERSION}-amd64 - cache-to: type=registry,ref=ghcr.io/shopware/docker-cache:${PHP_VERSION}-amd64,mode=max - platforms: linux/amd64 - push: true - provenance: false - -TPL; - - $workflow .= str_replace(array_keys($replaces), array_values($replaces), $workflowTpl); - - $dockerMerges[] = 'docker manifest create ghcr.io/shopware/docker-base:' . $supportedVersion . ' --amend ghcr.io/shopware/docker-base:' . $patchVersion['version'] . '-amd64 --amend ghcr.io/shopware/docker-base:' . $patchVersion['version'] . '-arm64'; - $dockerMerges[] = 'docker manifest create ghcr.io/shopware/docker-base:' . $patchVersion['version'] . ' --amend ghcr.io/shopware/docker-base:' . $patchVersion['version'] . '-amd64 --amend ghcr.io/shopware/docker-base:' . $patchVersion['version'] . '-arm64'; - $dockerMerges[] = 'docker manifest push ghcr.io/shopware/docker-base:' . $supportedVersion; - $dockerMerges[] = 'docker manifest push ghcr.io/shopware/docker-base:' . $patchVersion['version']; - - $dockerMerges[] = 'cosign sign --yes ghcr.io/shopware/docker-base:' . $supportedVersion; - $dockerMerges[] = 'cosign sign --yes ghcr.io/shopware/docker-base:' . $patchVersion['version']; - - $dockerMerges[] = './regctl-linux-amd64 image copy ghcr.io/shopware/docker-base:' . $supportedVersion . ' shopware/docker-base:' . $supportedVersion; - $dockerMerges[] = './regctl-linux-amd64 image copy ghcr.io/shopware/docker-base:' . $patchVersion['version'] . ' shopware/docker-base:' . $patchVersion['version']; - - $stages[] = 'php' . $phpShort . '-arm64'; - $stages[] = 'php' . $phpShort . '-amd64'; -} - -$workflow .= ' - - merge-manifest: - name: Merge Manifest - runs-on: ubuntu-latest - needs: -'; - -foreach ($stages as $stage) { - $workflow .= ' - ' . $stage . "\n"; -} - -$workflow .= ' - steps: - - name: Login into Docker Hub - run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - - name: Login into Github Docker Registery - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Install Cosign - uses: sigstore/cosign-installer@v3 - - - name: Install Regclient - run: | - wget https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 - chmod +x regctl-linux-amd64 - -'; - -foreach ($dockerMerges as $merge) { - $workflow .= " - run: " . $merge . "\n\n"; -} - -file_put_contents('.github/workflows/build.yml', $workflow);