Add short tags for released images (#446)

* Add short tags for images

* Edit workflow tags
This commit is contained in:
Danil Titarenko 2022-06-10 15:43:50 +03:00 committed by GitHub
parent a6562f4017
commit 86cbb01bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

@ -16,8 +16,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
edition: ["", "-ee", "-de"]
images: ["documentserver-stable"]
edition: ["", "-ee", "-de"]
steps:
- name: Checkout code
uses: actions/checkout@v3
@ -41,18 +41,23 @@ jobs:
- name: Build documentserver-stable
run: |
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG > /dev/null ; echo $?)
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+')
SHORTEST_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+')
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?)
if [[ "$IMAGE_STATUS" = "0" ]]; then
echo "Image present on docker.hub >> start build stable version"
echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable
echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable
PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable TAG=$DOCKER_TAG \
COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable \
TAG=$TAG \
SHORTER_TAG=$SHORTER_TAG \
SHORTEST_TAG=$SHORTEST_TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push ;
else
echo "FAILED: Image with tag $DOCKER_TAG do not presented on docker.hub >> build will not started >> exit with 0"
echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 0"
exit 0
fi
shell: bash

@ -2,6 +2,14 @@ variable "TAG" {
default = ""
}
variable "SHORTER_TAG" {
default = ""
}
variable "SHORTEST_TAG" {
default = ""
}
variable "COMPANY_NAME" {
default = ""
}
@ -37,7 +45,10 @@ target "documentserver" {
target "documentserver-stable" {
target = "documentserver-stable"
dockerfile= "${DOCKERFILE}"
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"]
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTER_TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"]
platforms = ["linux/amd64", "linux/arm64"]
args = {
"PRODUCT_EDITION": "${PRODUCT_EDITION}"