Add expected build arch (#489)

* Add fail status if build unexpected platforms

* Build: set exit code for action

* Build: Change expected platforms message
This commit is contained in:
Danil Titarenko 2022-09-08 15:56:49 +03:00 committed by GitHub
parent e44acbebf7
commit 713a06e999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,6 +47,7 @@ jobs:
DOCKER_TAG=$( echo ${{ env.RELEASE_VERSION }} | sed 's/^.//' ) DOCKER_TAG=$( echo ${{ env.RELEASE_VERSION }} | sed 's/^.//' )
PACKAGE_VERSION=$( echo $DOCKER_TAG | sed -E 's/(.*)\./\1-/' ) PACKAGE_VERSION=$( echo $DOCKER_TAG | sed -E 's/(.*)\./\1-/' )
NODE_PLATFORMS=$( echo ${{ steps.buildx.outputs.platforms }} | sed 's/linux\///g' | sed 's/,/ /g' ) NODE_PLATFORMS=$( echo ${{ steps.buildx.outputs.platforms }} | sed 's/linux\///g' | sed 's/,/ /g' )
EXPECTED_PLATFORMS="linux/amd64,linux/arm64"
echo "Start check avalivable build platforms >>" echo "Start check avalivable build platforms >>"
### ==>> In this loop we will check all avalivable documentserver architectures. After that all accessed arch will be added to build-platforms list. ### ### ==>> In this loop we will check all avalivable documentserver architectures. After that all accessed arch will be added to build-platforms list. ###
@ -76,6 +77,15 @@ jobs:
echo "DONE: Check passed >> Build for platforms: ${BUILD_PLATFORMS}" echo "DONE: Check passed >> Build for platforms: ${BUILD_PLATFORMS}"
echo "Build is starting ... >>" echo "Build is starting ... >>"
### == >> Set exit code for action
if [ ${BUILD_PLATFORMS} == ${EXPECTED_PLATFORMS} ]; then
EXIT_CODE=0
echo "OK: Build platforms is expected"
else
EXIT_CODE=1
echo "WARNING: Build platforms is unexpected action is gonna be marked as Failed"
fi
### ==>> Build and push images at this step ### ### ==>> Build and push images at this step ###
PRODUCT_EDITION=${{ matrix.edition }} \ PRODUCT_EDITION=${{ matrix.edition }} \
PACKAGE_URL=$PACKAGE_URL_BUILD \ PACKAGE_URL=$PACKAGE_URL_BUILD \
@ -89,6 +99,6 @@ jobs:
docker buildx bake \ docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \ -f docker-bake.hcl ${{ matrix.images }} \
--push --push
echo "DONE: Build success >> exit with 0" echo "DONE: Build success >> exit with ${EXIT_CODE}"
exit 0 exit ${EXIT_CODE}
shell: bash shell: bash