Skip to content

cron-trigger-action #43

cron-trigger-action

cron-trigger-action #43

Workflow file for this run

name: 4testing multiarch-build
on:
repository_dispatch:
types:
- cron-trigger-action
- config-trigger-action
- client-trigger-action
- server-trigger-action
env:
DOCKER_PATH: "/install/docker"
REPO: "lemmav"
DOCKER_IMAGE_PREFIX: "4testing-docspace"
DOCKERFILE: "Dockerfile.app"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]
branch: ${{ github.event.client_payload.branches }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Free Disk Space
run: |
sudo rm -rf /usr/local/lib/android /opt/ghc
sudo docker image prune --all --force
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build 4load
run: |
cd .${DOCKER_PATH}
if [ "${{ matrix.branch }}" = "develop" ]; then
DOCKER_TAG="develop.${{ github.run_number }}"
else
DOCKER_TAG=$(echo "${{ matrix.branch }}" | sed '/^release\b\|^hotfix\b\|^feature\b/s/release.*\/\|hotfix.*\/\|feature.*\///; s/-git-action$//; s/^v//').${{github.run_number}}
fi
export DOCKER_TAG
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
docker buildx bake -f build.yml \
--set *.args.GIT_BRANCH=${{ matrix.branch }} \
--set *.platform=linux/amd64 \
--load
shell: bash
- name: Test Container
run: |
echo "test ${{github.head_ref}}"
cd .${DOCKER_PATH}
NETWORK_NAME="onlyoffice"
NETWORK_EXISTS=$(docker network ls --filter name=$NETWORK_NAME -q)
if [ -z "$NETWORK_EXISTS" ]; then
echo "Creating Docker network: $NETWORK_NAME"
docker network create -d bridge $NETWORK_NAME
else
echo "Docker network $NETWORK_NAME already exists."
fi
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f db.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f elasticsearch.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f redis.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f rabbitmq.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f healthchecks.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f migration-runner.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f docspace.yml up -d
sleep 10
DOCKER_TAG=${{ env.DOCKER_TAG }} docker-compose -f notify.yml up -d
HAS_ERROR=false
for FILE_NAME in db elasticsearch redis rabbitmq healthchecks migration-runner docspace notify; do
CONTAINER_NAMES=$(docker-compose -f ${FILE_NAME}.yml ps --all | grep onlyoffice | awk '{print $1}')
for CONTAINER_NAME in $CONTAINER_NAMES; do
CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' $CONTAINER_NAME)
if [ "$CONTAINER_NAME" == "onlyoffice-migration-runner" ] ; then
if [ "$CONTAINER_STATUS" == "exited" ] ; then
echo "$CONTAINER_NAME container has successfully exited." >> logs.txt
else
echo "Error: $CONTAINER_NAME container is $CONTAINER_STATUS." >> logs.txt
HAS_ERROR=true
fi
else
if [ "$CONTAINER_STATUS" == "running" ] ; then
echo "$CONTAINER_NAME container is running." >> logs.txt
else
echo "Error: $CONTAINER_NAME container is $CONTAINER_STATUS." >> logs.txt
HAS_ERROR=true
fi
fi
done
if [ "$HAS_ERROR" = true ]; then
exit 1
fi
echo "artifactPath=$PWD" >> $GITHUB_ENV
echo "artifactName=${{ matrix.branch }}-logs" | sed 's/\///g' >> $GITHUB_ENV
done
shell: bash
- name: Build 4push
run: |
cd .${DOCKER_PATH}
export DOCKER_TAG=${{ env.DOCKER_TAG }}
echo "List of local images with tag $DOCKER_TAG:"
docker images --filter=reference="*:${DOCKER_TAG}" --format "{{.Repository}}:{{.Tag}}"
images=$(docker images --filter=reference="*:${DOCKER_TAG}" --format "{{.Repository}}")
for image in $images
do
echo "Executing docker push for image: $image"
docker push $image
done
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ env.artifactName }}
path: ${{ env.artifactPath }}/logs.txt