-
-
Notifications
You must be signed in to change notification settings - Fork 63
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 #115 from cytopia/release-0.43
Release 0.43
- Loading branch information
Showing
11 changed files
with
689 additions
and
984 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -35,18 +35,37 @@ on: | |
description: 'Dertermines whether we upload the artifact not.' | ||
required: true | ||
type: boolean | ||
pull_base_image: | ||
description: 'Pull Docker base image before building?.' | ||
push_image: | ||
description: 'Push docker image after build (and test if ran)?' | ||
required: false | ||
type: boolean | ||
default: false | ||
pull_base_image: | ||
description: 'Pull Docker base image before building?' | ||
required: false | ||
type: boolean | ||
default: false | ||
extra_make_var_name: | ||
description: 'Extra makefile variable name to assign matrix.EXTRA value to' | ||
required: true | ||
type: string | ||
### | ||
### Secrets | ||
### | ||
secrets: | ||
dockerhub_username: | ||
description: 'The username for Dockerhub.' | ||
required: true | ||
dockerhub_password: | ||
description: 'The password for Dockerhub.' | ||
required: true | ||
|
||
jobs: | ||
# ----------------------------------------------------------------------------------------------- | ||
# JOB: BUILD | ||
# ----------------------------------------------------------------------------------------------- | ||
build: | ||
name: ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.stage }}${{ matrix.kops }} (${{ matrix.arch }}) ${{ matrix.refs }} | ||
name: ${{ matrix.NAME }}-${{ matrix.VERSION }}-${{ inputs.stage }}${{ matrix.EXTRA }} (${{ matrix.ARCH }}) ${{ matrix.REFS }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
@@ -63,11 +82,11 @@ jobs: | |
fetch-depth: 0 | ||
if: ${{ !inputs.has_refs }} | ||
|
||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})" | ||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.REFS }})" | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ matrix.refs }} | ||
ref: ${{ matrix.REFS }} | ||
if: ${{ inputs.has_refs }} | ||
|
||
- name: "[SETUP] Install QEMU environment" | ||
|
@@ -77,40 +96,32 @@ jobs: | |
image: tonistiigi/binfmt:latest | ||
platforms: all | ||
|
||
- name: "[SETUP] Install Docker Buildx" | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: "[SETUP] Set artifact names" | ||
id: set-artifact-name | ||
run: | | ||
PRE_HASH="$( git rev-parse HEAD | head -c 10 )" | ||
VERSION="${{ matrix.version }}" | ||
ARCH="$( echo "${{ matrix.arch }}" | sed 's|/|-|g' )" | ||
VERSION="$( echo "${{ matrix.VERSION }}" )" | ||
ARCH="$( echo "${{ matrix.ARCH }}" | sed 's|/|-|g' )" | ||
NAME_PREV="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}" | ||
NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage }}${{ matrix.kops }}" | ||
NAME_PREV="${{ inputs.artifact_prefix }}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}" | ||
NAME_CURR="${{ inputs.artifact_prefix }}-${VERSION}-${ARCH}-${{ inputs.stage }}${{ matrix.EXTRA }}" | ||
echo "prev=${NAME_PREV}" >> $GITHUB_OUTPUT | ||
echo "curr=${NAME_CURR}" >> $GITHUB_OUTPUT | ||
- name: "[DEBUG] Show setup" | ||
shell: bash | ||
- name: "[SETUP] Determine Docker tag" | ||
id: tag | ||
uses: cytopia/[email protected] | ||
|
||
# https://github.com/alpinelinux/docker-alpine/issues/98 | ||
- name: "[SETUP] Fix Docker IP forwarding" | ||
run: | | ||
echo '(qemu) Platforms: ${{ steps.qemu.outputs.platforms }}' | ||
echo "(buildx) Name: ${{ steps.buildx.outputs.name }}" | ||
echo "(buildx) Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
echo "(buildx) Status: ${{ steps.buildx.outputs.status }}" | ||
echo "(buildx) Flags: ${{ steps.buildx.outputs.flags }}" | ||
echo "(buildx) Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
sysctl net.ipv4.ip_forward | ||
sudo sysctl -w net.ipv4.ip_forward=1 | ||
sudo systemctl restart docker | ||
# ------------------------------------------------------------ | ||
# Artifact Import | ||
# ------------------------------------------------------------ | ||
|
||
### | ||
### Download and import previously built image (if it exists) | ||
### | ||
- name: "[Artifact Load] Download previously built image" | ||
uses: cytopia/[email protected] | ||
with: | ||
|
@@ -132,14 +143,14 @@ jobs: | |
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make docker-pull-base-image VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} KOPS=${{ matrix.kops }} | ||
make docker-pull-base-image VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
if: ${{ inputs.pull_base_image }} | ||
|
||
- name: Build | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make build VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} KOPS=${{ matrix.kops }} | ||
make build VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
# ------------------------------------------------------------ | ||
|
@@ -149,24 +160,44 @@ jobs: | |
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make test VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} KOPS=${{ matrix.kops }} | ||
make test VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
if: ${{ inputs.run_tests }} | ||
|
||
|
||
# ------------------------------------------------------------ | ||
# Artifact Export | ||
# Push | ||
# ------------------------------------------------------------ | ||
- name: Docker Tag | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make tag VERSION="${{ matrix.VERSION }}" STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} TAG=${{ steps.tag.outputs.docker-tag }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.dockerhub_username }} | ||
password: ${{ secrets.dockerhub_password }} | ||
if: ${{ inputs.push_image }} | ||
|
||
- name: Docker push | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make push VERSION="${{ matrix.version }}" STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
if: ${{ inputs.push_image }} | ||
|
||
|
||
### | ||
### Export current image | ||
### | ||
# ------------------------------------------------------------ | ||
# Artifact Export | ||
# ------------------------------------------------------------ | ||
- name: "[Artifact Save] Upload built artifact" | ||
uses: cytopia/[email protected] | ||
with: | ||
name: ${{ steps.set-artifact-name.outputs.curr }} | ||
path: ${{ steps.set-artifact-name.outputs.curr }} | ||
pre_command: | | ||
make save-verify VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} KOPS=${{ matrix.kops }} OUTFILE=${{ steps.set-artifact-name.outputs.curr }} INFILE=${{ steps.set-artifact-name.outputs.curr }} | ||
make save-verify VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} OUTFILE=${{ steps.set-artifact-name.outputs.curr }} INFILE=${{ steps.set-artifact-name.outputs.curr }} ${{ inputs.extra_make_var_name }}=${{ matrix.EXTRA }} | ||
post_command: | | ||
make load INFILE={{download_path}} | ||
if: ${{ inputs.upload_artifact }} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
name: "Build multistage docker images (multi -flavours, -versions, -architectures -helm)" | ||
name: "Build multistage docker images (multi -flavours, -versions, -architectures)" | ||
|
||
on: | ||
workflow_call: | ||
|
@@ -35,18 +35,33 @@ on: | |
description: 'Dertermines whether we upload the artifact not.' | ||
required: true | ||
type: boolean | ||
pull_base_image: | ||
description: 'Pull Docker base image before building?.' | ||
push_image: | ||
description: 'Push docker image after build (and test if ran)?' | ||
required: false | ||
type: boolean | ||
default: false | ||
pull_base_image: | ||
description: 'Pull Docker base image before building?' | ||
required: false | ||
type: boolean | ||
default: false | ||
### | ||
### Secrets | ||
### | ||
secrets: | ||
dockerhub_username: | ||
description: 'The username for Dockerhub.' | ||
required: true | ||
dockerhub_password: | ||
description: 'The password for Dockerhub.' | ||
required: true | ||
|
||
jobs: | ||
# ----------------------------------------------------------------------------------------------- | ||
# JOB: BUILD | ||
# ----------------------------------------------------------------------------------------------- | ||
build: | ||
name: ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.stage }}${{ matrix.helm }} (${{ matrix.arch }}) ${{ matrix.refs }} | ||
name: ${{ matrix.NAME }}-${{ matrix.VERSION }}-${{ inputs.stage }} (${{ matrix.ARCH }}) ${{ matrix.REFS }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
@@ -63,11 +78,11 @@ jobs: | |
fetch-depth: 0 | ||
if: ${{ !inputs.has_refs }} | ||
|
||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})" | ||
- name: "[SETUP] Checkout repository (ref: ${{ matrix.REFS }})" | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ matrix.refs }} | ||
ref: ${{ matrix.REFS }} | ||
if: ${{ inputs.has_refs }} | ||
|
||
- name: "[SETUP] Install QEMU environment" | ||
|
@@ -77,40 +92,32 @@ jobs: | |
image: tonistiigi/binfmt:latest | ||
platforms: all | ||
|
||
- name: "[SETUP] Install Docker Buildx" | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: "[SETUP] Set artifact names" | ||
id: set-artifact-name | ||
run: | | ||
PRE_HASH="$( git rev-parse HEAD | head -c 10 )" | ||
VERSION="${{ matrix.version }}" | ||
ARCH="$( echo "${{ matrix.arch }}" | sed 's|/|-|g' )" | ||
VERSION="$( echo "${{ matrix.VERSION }}" )" | ||
ARCH="$( echo "${{ matrix.ARCH }}" | sed 's|/|-|g' )" | ||
NAME_PREV="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}" | ||
NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage }}${{ matrix.helm }}" | ||
NAME_PREV="${{ inputs.artifact_prefix }}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}" | ||
NAME_CURR="${{ inputs.artifact_prefix }}-${VERSION}-${ARCH}-${{ inputs.stage }}" | ||
echo "prev=${NAME_PREV}" >> $GITHUB_OUTPUT | ||
echo "curr=${NAME_CURR}" >> $GITHUB_OUTPUT | ||
- name: "[DEBUG] Show setup" | ||
shell: bash | ||
- name: "[SETUP] Determine Docker tag" | ||
id: tag | ||
uses: cytopia/[email protected] | ||
|
||
# https://github.com/alpinelinux/docker-alpine/issues/98 | ||
- name: "[SETUP] Fix Docker IP forwarding" | ||
run: | | ||
echo '(qemu) Platforms: ${{ steps.qemu.outputs.platforms }}' | ||
echo "(buildx) Name: ${{ steps.buildx.outputs.name }}" | ||
echo "(buildx) Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
echo "(buildx) Status: ${{ steps.buildx.outputs.status }}" | ||
echo "(buildx) Flags: ${{ steps.buildx.outputs.flags }}" | ||
echo "(buildx) Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
sysctl net.ipv4.ip_forward | ||
sudo sysctl -w net.ipv4.ip_forward=1 | ||
sudo systemctl restart docker | ||
# ------------------------------------------------------------ | ||
# Artifact Import | ||
# ------------------------------------------------------------ | ||
|
||
### | ||
### Download and import previously built image (if it exists) | ||
### | ||
- name: "[Artifact Load] Download previously built image" | ||
uses: cytopia/[email protected] | ||
with: | ||
|
@@ -132,14 +139,14 @@ jobs: | |
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make docker-pull-base-image VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} HELM=${{ matrix.helm }} | ||
make docker-pull-base-image VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} | ||
if: ${{ inputs.pull_base_image }} | ||
|
||
- name: Build | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make build VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} HELM=${{ matrix.helm }} | ||
make build VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} | ||
# ------------------------------------------------------------ | ||
|
@@ -149,24 +156,44 @@ jobs: | |
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make test VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} HELM=${{ matrix.helm }} | ||
make test VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} | ||
if: ${{ inputs.run_tests }} | ||
|
||
|
||
# ------------------------------------------------------------ | ||
# Artifact Export | ||
# Push | ||
# ------------------------------------------------------------ | ||
- name: Docker Tag | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make tag VERSION="${{ matrix.VERSION }}" STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} TAG=${{ steps.tag.outputs.docker-tag }} | ||
### | ||
### Export current image | ||
### | ||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.dockerhub_username }} | ||
password: ${{ secrets.dockerhub_password }} | ||
if: ${{ inputs.push_image }} | ||
|
||
- name: Docker push | ||
uses: cytopia/[email protected] | ||
with: | ||
command: | | ||
make push VERSION="${{ matrix.version }}" STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} | ||
if: ${{ inputs.push_image }} | ||
|
||
|
||
# ------------------------------------------------------------ | ||
# Artifact Export | ||
# ------------------------------------------------------------ | ||
- name: "[Artifact Save] Upload built artifact" | ||
uses: cytopia/[email protected] | ||
with: | ||
name: ${{ steps.set-artifact-name.outputs.curr }} | ||
path: ${{ steps.set-artifact-name.outputs.curr }} | ||
pre_command: | | ||
make save-verify VERSION=${{ matrix.version }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} HELM=${{ matrix.helm }} OUTFILE=${{ steps.set-artifact-name.outputs.curr }} INFILE=${{ steps.set-artifact-name.outputs.curr }} | ||
make save-verify VERSION=${{ matrix.VERSION }} STAGE=${{ inputs.stage }} FLAVOUR=${{ matrix.FLAVOUR }} ARCH=${{ matrix.ARCH }} OUTFILE=${{ steps.set-artifact-name.outputs.curr }} INFILE=${{ steps.set-artifact-name.outputs.curr }} | ||
post_command: | | ||
make load INFILE={{download_path}} | ||
if: ${{ inputs.upload_artifact }} |
Oops, something went wrong.