-
Notifications
You must be signed in to change notification settings - Fork 941
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-fds-e2e-tests-to-ci
- Loading branch information
Showing
469 changed files
with
37,953 additions
and
3,255 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
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,144 @@ | ||
name: Reusable docker server image build workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
namespace-repository: | ||
description: "The namespace and repository in the following format `namespace/repository` e.g. (flwr/base)." | ||
required: true | ||
type: string | ||
file-dir: | ||
description: "Path of the directory that contains the Dockerfile." | ||
required: true | ||
type: string | ||
build-args: | ||
description: "List of build-time variables." | ||
required: false | ||
type: string | ||
tags: | ||
description: "List of tags." | ||
required: true | ||
type: string | ||
secrets: | ||
dockerhub-user: | ||
required: true | ||
dockerhub-token: | ||
required: true | ||
outputs: | ||
metadata: | ||
description: "Metadata of the docker image." | ||
value: ${{ jobs.build-manifest.outputs.metadata }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
# based on https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners | ||
jobs: | ||
build: | ||
name: Build server image | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 60 | ||
outputs: | ||
build-id: ${{ steps.build-id.outputs.id }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
platform: [ | ||
# build-push action and qemu use different platform names | ||
# therefore we create a map | ||
{ qemu: "", docker: "linux/amd64" }, | ||
{ qemu: "arm64", docker: "linux/arm64" }, | ||
] | ||
steps: | ||
- name: Create build id | ||
id: build-id | ||
shell: python | ||
run: | | ||
import hashlib | ||
import os | ||
hash = hashlib.sha256('''${{ inputs.build-args }}'''.encode()) | ||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | ||
print(f"id={hash.hexdigest()}", file=fh) | ||
- name: Set up QEMU | ||
if: matrix.platform.qemu != '' | ||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | ||
with: | ||
platforms: ${{ matrix.platform.qemu }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0 | ||
with: | ||
images: ${{ inputs.namespace-repository }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
username: ${{ secrets.dockerhub-user }} | ||
password: ${{ secrets.dockerhub-token }} | ||
|
||
- name: Build and push | ||
id: build | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
platforms: ${{ matrix.platform.docker }} | ||
context: "{{defaultContext}}:${{ inputs.file-dir }}" | ||
build-args: ${{ inputs.build-args }} | ||
outputs: type=image,name=${{ inputs.namespace-repository }},push-by-digest=true,name-canonical=true,push=true | ||
|
||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
name: digests-${{ steps.build-id.outputs.id }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
build-manifest: | ||
name: Build and push docker manifest for all platforms | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
needs: build | ||
outputs: | ||
metadata: ${{ steps.meta.outputs.json }} | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: digests-${{ needs.build.outputs.build-id }} | ||
path: /tmp/digests | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0 | ||
with: | ||
images: ${{ inputs.namespace-repository }} | ||
tags: ${{ inputs.tags }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
username: ${{ secrets.dockerhub-user }} | ||
password: ${{ secrets.dockerhub-token }} | ||
|
||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ inputs.namespace-repository }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: docker buildx imagetools inspect ${{ inputs.namespace-repository }}:${{ steps.meta.outputs.version }} |
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,60 @@ | ||
name: Build docker base image | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "src/docker/base/**" | ||
- ".github/workflows/docker-base.yml" | ||
# re-run if something chnages in the bootstrap action (e.g. version of the dependencies) | ||
- ".github/actions/bootstrap/action.yml" | ||
- ".github/workflows/_docker-build.yml" | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
DEFAULT_UBUNTU: 22.04 | ||
|
||
jobs: | ||
parameters: | ||
name: Collect build parameters | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
outputs: | ||
pip-version: ${{ steps.versions.outputs.pip-version }} | ||
setuptools-version: ${{ steps.versions.outputs.setuptools-version }} | ||
ubuntu-version: ${{ steps.versions.outputs.ubuntu-version }} | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- uses: ./.github/actions/bootstrap | ||
id: bootstrap | ||
|
||
- id: versions | ||
run: | | ||
echo "pip-version=${{ steps.bootstrap.outputs.pip-version }}" >> "$GITHUB_OUTPUT" | ||
echo "setuptools-version=${{ steps.bootstrap.outputs.setuptools-version }}" >> "$GITHUB_OUTPUT" | ||
echo "ubuntu-version=${{ env.DEFAULT_UBUNTU }}" >> "$GITHUB_OUTPUT" | ||
build-base-images: | ||
name: Build images | ||
uses: ./.github/workflows/_docker-build.yml | ||
needs: parameters | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
with: | ||
namespace-repository: flwr/base | ||
file-dir: src/docker/base | ||
build-args: | | ||
PYTHON_VERSION=${{ matrix.python-version }} | ||
PIP_VERSION=${{ needs.parameters.outputs.pip-version }} | ||
SETUPTOOLS_VERSION=${{ needs.parameters.outputs.setuptools-version }} | ||
UBUNTU_VERSION=${{ needs.parameters.outputs.ubuntu-version }} | ||
tags: py${{ matrix.python-version }}-ubuntu${{ needs.parameters.outputs.ubuntu-version }} | ||
secrets: | ||
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} |
Oops, something went wrong.