Refactoring stable build (#490)
* Refactoring stable build * Build: setting up push 4enterprise images * Cosmetic change * Remove needless tag * Rename dockerfile * Small fix * Rename dockerfile for nonexample Co-authored-by: danilapog <danil.titarenko@onlyoffice.com>
This commit is contained in:
parent
713a06e999
commit
61a5a021cf
1
.github/workflows/4testing-build.yml
vendored
1
.github/workflows/4testing-build.yml
vendored
|
@ -5,7 +5,6 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
- "!v*-stable"
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
COMPANY_NAME: "onlyoffice"
|
COMPANY_NAME: "onlyoffice"
|
||||||
|
|
71
.github/workflows/stable-build.yml
vendored
71
.github/workflows/stable-build.yml
vendored
|
@ -2,9 +2,12 @@
|
||||||
name: Multi-arch build stable
|
name: Multi-arch build stable
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
tags:
|
inputs:
|
||||||
- "v*-stable"
|
tag:
|
||||||
|
description: 'Tag for release (ex. 1.2.3.45)'
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
COMPANY_NAME: "onlyoffice"
|
COMPANY_NAME: "onlyoffice"
|
||||||
|
@ -35,37 +38,28 @@ jobs:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
- name: Get Tag Name
|
|
||||||
id: tag_name
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
|
||||||
|
|
||||||
- name: Build documentserver-release
|
- name: Build documentserver-release
|
||||||
run: |
|
run: |
|
||||||
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
|
set -eux
|
||||||
SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+')
|
VERSION=${{ github.event.inputs.tag }}
|
||||||
SHORTEST_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+')
|
PRODUCT_EDITION=${{ matrix.edition }}
|
||||||
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?)
|
TESTING_IMAGE=${COMPANY_NAME}/4testing-${PRODUCT_NAME}${PRODUCT_EDITION}
|
||||||
if [[ "$IMAGE_STATUS" = "0" ]]; then
|
if docker manifest inspect ${TESTING_IMAGE}:${VERSION} > /dev/null; then
|
||||||
echo "Image present on docker.hub >> start build stable version"
|
echo "Image present on docker.hub >> start build stable version"
|
||||||
PRODUCT_EDITION=${{ matrix.edition }} \
|
export PRODUCT_EDITION
|
||||||
PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
|
export TAG=${VERSION}
|
||||||
COMPANY_NAME=${{ env.COMPANY_NAME}} \
|
export SHORTER_TAG=${VERSION%.*}
|
||||||
TAG=$TAG \
|
export SHORTEST_TAG=${VERSION%.*.*}
|
||||||
SHORTER_TAG=$SHORTER_TAG \
|
docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push
|
||||||
SHORTEST_TAG=$SHORTEST_TAG \
|
echo "DONE: Build success >> exit with 0"
|
||||||
docker buildx bake \
|
exit 0
|
||||||
-f docker-bake.hcl ${{ matrix.images }} \
|
else
|
||||||
--push
|
echo "FAILED: Image with tag ${VERSION} do not presented on docker.hub >> build will not started >> exit with 1"
|
||||||
echo "DONE: Build success >> exit with 0"
|
exit 1
|
||||||
exit 0
|
fi
|
||||||
else
|
|
||||||
echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 1"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
build-nonExample:
|
build-nonexample:
|
||||||
name: "Release image: DocumentServer${{ matrix.edition }}-nonExample"
|
name: "Release image: DocumentServer${{ matrix.edition }}-nonExample"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
|
@ -91,19 +85,10 @@ jobs:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
- name: Get Tag Name
|
|
||||||
id: tag_name
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
|
||||||
|
|
||||||
- name: build image
|
- name: build image
|
||||||
run: |
|
run: |
|
||||||
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
|
set -eux
|
||||||
PRODUCT_EDITION=${{ matrix.edition }} \
|
export PRODUCT_EDITION=${{ matrix.edition }}
|
||||||
PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
|
export TAG=${{ github.event.inputs.tag }}
|
||||||
COMPANY_NAME=${{ env.COMPANY_NAME }} \
|
docker buildx bake -f docker-bake.hcl ${{ matrix.images }} --push
|
||||||
TAG=$TAG \
|
|
||||||
docker buildx bake \
|
|
||||||
-f docker-bake.hcl ${{ matrix.images }} \
|
|
||||||
--push
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
@ -44,7 +44,7 @@ variable "DEVELOP_BUILD" {
|
||||||
|
|
||||||
target "documentserver" {
|
target "documentserver" {
|
||||||
target = "documentserver"
|
target = "documentserver"
|
||||||
dockerfile= "${DOCKERFILE}"
|
dockerfile = "${DOCKERFILE}"
|
||||||
tags = [
|
tags = [
|
||||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
|
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
|
||||||
notequal("",DEVELOP_BUILD) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "",
|
notequal("",DEVELOP_BUILD) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "",
|
||||||
|
@ -61,11 +61,12 @@ target "documentserver" {
|
||||||
|
|
||||||
target "documentserver-stable" {
|
target "documentserver-stable" {
|
||||||
target = "documentserver-stable"
|
target = "documentserver-stable"
|
||||||
dockerfile= "Dockerfile.production"
|
dockerfile = "production.dockerfile"
|
||||||
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
|
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}:${SHORTER_TAG}",
|
||||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}",
|
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}",
|
||||||
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"]
|
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest",
|
||||||
|
equal("-ee",PRODUCT_EDITION) ? "docker.io/${COMPANY_NAME}4enterprise/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}": "",]
|
||||||
platforms = ["linux/amd64", "linux/arm64"]
|
platforms = ["linux/amd64", "linux/arm64"]
|
||||||
args = {
|
args = {
|
||||||
"TAG": "${TAG}"
|
"TAG": "${TAG}"
|
||||||
|
@ -77,7 +78,7 @@ target "documentserver-stable" {
|
||||||
|
|
||||||
target "documentserver-nonexample" {
|
target "documentserver-nonexample" {
|
||||||
target = "documentserver-nonexample"
|
target = "documentserver-nonexample"
|
||||||
dockerfile = "Dockerfile.production"
|
dockerfile = "production.dockerfile"
|
||||||
tags = [ "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PREFIX_NAME}${PRODUCT_EDITION}:${TAG}-nonexample" ]
|
tags = [ "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PREFIX_NAME}${PRODUCT_EDITION}:${TAG}-nonexample" ]
|
||||||
platforms = ["linux/amd64", "linux/arm64"]
|
platforms = ["linux/amd64", "linux/arm64"]
|
||||||
args = {
|
args = {
|
||||||
|
|
Loading…
Reference in a new issue