fix: do not override bake's platform definitions (#4518)

* do not override bake's platform definitions

* test

* fix job name and remove override from minor version job

* test

* bump docker login action

* fix plurals

* Remove platform from matrix and test both platform in a single job

* Remove branch trigger used for testing

---------

Co-authored-by: Silvano Cerza <silvanocerza@gmail.com>
This commit is contained in:
Massimiliano Pippi 2023-03-28 17:57:29 +02:00 committed by GitHub
parent 651be37afc
commit 0dfa5d6ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,16 +13,13 @@ env:
jobs:
build-and-push:
name: Build ${{ matrix.target }} image for ${{ matrix.platform }}
name: Build ${{ matrix.target }} images
runs-on: ubuntu-latest
strategy:
matrix:
target:
- "cpu"
- "gpu"
platform:
- "linux/amd64"
- "linux/arm64"
steps:
- name: Checkout
@ -35,7 +32,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
@ -46,7 +43,7 @@ jobs:
with:
images: $DOCKER_REPO_NAME
- name: Build base image
- name: Build base images
uses: docker/bake-action@v2
env:
IMAGE_TAG_SUFFIX: ${{ steps.meta.outputs.version }}
@ -60,14 +57,19 @@ jobs:
run: |
EXPECTED_VERSION=$(cat VERSION.txt)
TAG="base-${{ matrix.target }}-${{ steps.meta.outputs.version }}"
PLATFORM="${{ matrix.platform }}"
PLATFORM="linux/amd64"
VERSION=$(docker run --platform "$PLATFORM" --rm "deepset/haystack:$TAG" python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]] || echo "::error 'Haystack version in deepset/haystack:$TAG image for $PLATFORM is different from expected'"
PLATFORM="linux/arm64"
VERSION=$(docker run --platform "$PLATFORM" --rm "deepset/haystack:$TAG" python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]] || echo "::error 'Haystack version in deepset/haystack:$TAG image for $PLATFORM is different from expected'"
# Remove image after test to avoid filling the GitHub runner and prevent its failure
docker rmi "deepset/haystack:$TAG"
- name: Build api image
- name: Build api images
uses: docker/bake-action@v2
env:
IMAGE_TAG_SUFFIX: ${{ steps.meta.outputs.version }}
@ -76,7 +78,6 @@ jobs:
workdir: docker
targets: ${{ matrix.target }}
push: true
set: "*.platform=${{ matrix.platform }}"
- name: Get latest version of Haystack
id: latest-version
@ -111,4 +112,3 @@ jobs:
workdir: docker
targets: ${{ matrix.target }}-latest
push: true
set: "*.platform=${{ matrix.platform }}"