mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2025-12-21 00:11:14 +00:00
Fix deploy
This commit is contained in:
16
.github/workflows/aaa-build.yml
vendored
16
.github/workflows/aaa-build.yml
vendored
@@ -33,8 +33,22 @@ jobs:
|
||||
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# (2/2) Build 'base'
|
||||
deploy:
|
||||
deploy-images:
|
||||
needs: [params, configure]
|
||||
uses: ./.github/workflows/aaa-reuse-deploy-images.yml
|
||||
with:
|
||||
enabled: true
|
||||
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
|
||||
build_matrix: ${{ needs.configure.outputs.matrix_build }}
|
||||
has_refs: ${{ needs.configure.outputs.has_refs }}
|
||||
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
|
||||
secrets:
|
||||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# (2/2) Build 'base'
|
||||
deploy-manifests:
|
||||
needs: [params, configure, deploy-images]
|
||||
uses: ./.github/workflows/aaa-reuse-deploy.yml
|
||||
with:
|
||||
enabled: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Deploy multi-arch image
|
||||
name: Build multi-arch images
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
@@ -14,23 +14,18 @@ on:
|
||||
description: 'Determines wheather this workflow will also deploy (login and push).'
|
||||
required: true
|
||||
type: boolean
|
||||
deploy_matrix:
|
||||
description: 'The version deploy matrix as JSON string ( list of objects: [{NAME, VERSION[], ARCH[]}] ).'
|
||||
required: true
|
||||
type: string
|
||||
params_matrix:
|
||||
description: 'The build matrix set via params.yml.'
|
||||
required: true
|
||||
type: string
|
||||
artifact_prefix:
|
||||
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
|
||||
build_matrix:
|
||||
description: 'The build matrix'
|
||||
required: true
|
||||
type: string
|
||||
has_refs:
|
||||
description: 'The ref build matrix as JSON string (list of git refs to build/deploy).'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
artifact_prefix:
|
||||
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
|
||||
required: true
|
||||
type: string
|
||||
###
|
||||
### Secrets
|
||||
###
|
||||
@@ -44,18 +39,42 @@ on:
|
||||
|
||||
jobs:
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
# JOB (3/3): DEPLOY
|
||||
# JOB: BUILD
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
deploy:
|
||||
name: Deploy ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) ${{ matrix.refs }}
|
||||
debug:
|
||||
name: debug
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Show inputs"
|
||||
run: |
|
||||
echo "enabled=${{ inputs.enabled }}"
|
||||
echo
|
||||
|
||||
echo "can_deploy=${{ inputs.can_deploy }}"
|
||||
echo
|
||||
|
||||
echo "build_matrix=${{ inputs.build_matrix }}"
|
||||
echo
|
||||
|
||||
echo "has_refs=${{ inputs.has_refs }}"
|
||||
echo
|
||||
|
||||
echo "artifact_prefix=${{ inputs.artifact_prefix }}"
|
||||
echo
|
||||
|
||||
echo "flavour=${{ inputs.flavour }}"
|
||||
echo
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.flavour }} (${{ matrix.arch }}) ${{ matrix.refs }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJson(inputs.deploy_matrix) }}
|
||||
# FIXME: re-enable
|
||||
#if: inputs.enabled && inputs.can_deploy
|
||||
include: ${{ fromJson(inputs.build_matrix) }}
|
||||
if: inputs.enabled
|
||||
steps:
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Setup repository
|
||||
# ------------------------------------------------------------
|
||||
@@ -63,14 +82,14 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
if: ${{ inputs.has_refs == 0 }}
|
||||
if: inputs.has_refs == 0
|
||||
|
||||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ matrix.refs }}
|
||||
if: ${{ inputs.has_refs != 0 }}
|
||||
if: inputs.has_refs != 0
|
||||
|
||||
- name: "[SETUP] Setup QEMU environment"
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@@ -78,22 +97,6 @@ jobs:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
|
||||
- name: "[SETUP] Determine Docker tag"
|
||||
id: tag
|
||||
uses: cytopia/docker-tag-action@v0.4.15
|
||||
|
||||
- name: "[SETUP] Determine manifest arches"
|
||||
id: manifest
|
||||
run: |
|
||||
ARCHES="$( echo '${{ inputs.params_matrix }}' \
|
||||
| jq 'group_by(.NAME, .VERSION, .ARCH)' \
|
||||
| jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], FLAVOUR: .[].FLAVOUR[], ARCHES: .[].ARCH|join(",")})' \
|
||||
| jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}" and .FLAVOUR=="${{ matrix.flavour }}") | .ARCHES' \
|
||||
| jq -c -M \
|
||||
)"
|
||||
echo "::set-output name=arches::${ARCHES}"
|
||||
echo "ARCHES: ${ARCHES}"
|
||||
|
||||
- name: "[SETUP] Set artifact names"
|
||||
id: set-artifact-name
|
||||
run: |
|
||||
@@ -270,75 +273,3 @@ jobs:
|
||||
command: |
|
||||
make push VERSION=${{ matrix.version }} FLAVOUR=work TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Create Manifest
|
||||
# ------------------------------------------------------------
|
||||
|
||||
- name: "[Create Manifest] base (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=base ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] mods (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=mods ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] prod (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=prod ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] work (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=work ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Create Manifest
|
||||
# ------------------------------------------------------------
|
||||
|
||||
- name: "[Push Manifest] base: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=base TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] mods: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=mods TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] prod: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=prod TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] work: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=work TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
179
.github/workflows/aaa-reuse-deploy-manifests.yml
vendored
Normal file
179
.github/workflows/aaa-reuse-deploy-manifests.yml
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
name: Deploy multi-arch image manifests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
###
|
||||
### Variables
|
||||
###
|
||||
inputs:
|
||||
enabled:
|
||||
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
|
||||
required: true
|
||||
type: boolean
|
||||
can_deploy:
|
||||
description: 'Determines wheather this workflow will also deploy (login and push).'
|
||||
required: true
|
||||
type: boolean
|
||||
deploy_matrix:
|
||||
description: 'The version deploy matrix as JSON string ( list of objects: [{NAME, VERSION[], ARCH[]}] ).'
|
||||
required: true
|
||||
type: string
|
||||
params_matrix:
|
||||
description: 'The build matrix set via params.yml.'
|
||||
required: true
|
||||
type: string
|
||||
artifact_prefix:
|
||||
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
|
||||
required: true
|
||||
type: string
|
||||
has_refs:
|
||||
description: 'The ref build matrix as JSON string (list of git refs to build/deploy).'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
###
|
||||
### Secrets
|
||||
###
|
||||
secrets:
|
||||
dockerhub_username:
|
||||
description: 'The username for Dockerhub.'
|
||||
required: false
|
||||
dockerhub_password:
|
||||
description: 'The password for Dockerhub.'
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
# JOB (3/3): DEPLOY
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
deploy:
|
||||
name: Deploy ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) ${{ matrix.refs }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJson(inputs.deploy_matrix) }}
|
||||
# FIXME: re-enable
|
||||
#if: inputs.enabled && inputs.can_deploy
|
||||
steps:
|
||||
# ------------------------------------------------------------
|
||||
# Setup repository
|
||||
# ------------------------------------------------------------
|
||||
- name: "[SETUP] Checkout repository (current)"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
if: ${{ inputs.has_refs == 0 }}
|
||||
|
||||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ matrix.refs }}
|
||||
if: ${{ inputs.has_refs != 0 }}
|
||||
|
||||
- name: "[SETUP] Setup QEMU environment"
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
|
||||
- name: "[SETUP] Determine Docker tag"
|
||||
id: tag
|
||||
uses: cytopia/docker-tag-action@v0.4.15
|
||||
|
||||
- name: "[SETUP] Determine manifest arches"
|
||||
id: manifest
|
||||
run: |
|
||||
ARCHES="$( echo '${{ inputs.params_matrix }}' \
|
||||
| jq 'group_by(.NAME, .VERSION, .ARCH)' \
|
||||
| jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], FLAVOUR: .[].FLAVOUR[], ARCHES: .[].ARCH|join(",")})' \
|
||||
| jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}" and .FLAVOUR=="${{ matrix.flavour }}") | .ARCHES' \
|
||||
| jq -c -M \
|
||||
)"
|
||||
echo "::set-output name=arches::${ARCHES}"
|
||||
echo "ARCHES: ${ARCHES}"
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Login
|
||||
# ------------------------------------------------------------
|
||||
- name: "Login"
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
if: always()
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Create Manifest
|
||||
# ------------------------------------------------------------
|
||||
|
||||
- name: "[Create Manifest] base (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=base ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] mods (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=mods ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] prod (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=prod ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Create Manifest] work (${{ steps.manifest.outputs.arches }})"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=work ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Deploy Manifest
|
||||
# ------------------------------------------------------------
|
||||
|
||||
- name: "[Push Manifest] base: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=base TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] mods: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=mods TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] prod: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=prod TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
|
||||
- name: "[Push Manifest] work: ${{ steps.tag.outputs.docker-tag }}"
|
||||
uses: cytopia/shell-command-retry-action@v0.1.2
|
||||
with:
|
||||
retries: 2
|
||||
command: |
|
||||
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=work TAG=${{ steps.tag.outputs.docker-tag }}
|
||||
if: always()
|
||||
Reference in New Issue
Block a user