-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
function get_colors() { | ||
COLOR_BLUE=$'\e[34m' | ||
COLOR_GREEN=$'\e[32m' | ||
COLOR_RED=$'\e[31m' | ||
COLOR_RESET=$'\e[0m' | ||
COLOR_YELLOW=$'\e[33m' | ||
export COLOR_BLUE | ||
export COLOR_GREEN | ||
export COLOR_RED | ||
export COLOR_RESET | ||
export COLOR_YELLOW | ||
} | ||
|
||
function release_service() { | ||
|
||
# ex. service_source_tag=onlyoffice/4testing-docspace-service-name:2.5.1.1473 | ||
local service_source_tag=${1} | ||
|
||
echo ${service_source_tag} | ||
|
||
# ex. service_release_tag=onlyoffice/docspace-service-name:2.5.1.1 | ||
# NOTE: latest tag also will be updated | ||
local service_release_tag | ||
service_release_tag=$(echo ${service_source_tag%:*} | sed 's/4testing-//') | ||
|
||
# If specifyed tag look like 2.5.1.1 it will release like 3 different tags: 2.5.1 2.5.1.1 latest | ||
# Make new image manigest and push it to stable images repository | ||
|
||
docker buildx imagetools create --tag ${service_release_tag}:${RELEASE_VERSION%.*} \ | ||
--tag ${service_release_tag}:${RELEASE_VERSION} \ | ||
--tag ${service_release_tag}:latest \ | ||
${service_source_tag} || local STATUS=$? | ||
|
||
# Make alert | ||
if [[ ! ${STATUS} ]]; then | ||
RELEASED_SERVICES+=("${service_release_tag}") | ||
else | ||
UNRELEASED_SERVICES+=("${service_release_tag}") | ||
fi | ||
} | ||
|
||
function main() { | ||
# Import all colors | ||
get_colors | ||
|
||
# Make released|unreleased array | ||
RELEASED_SERVICES=() | ||
UNRELEASED_SERVICES=() | ||
|
||
# REPO mean hub.docker repo owner ex. onlyoffice | ||
: "${REPO:?Should be set}" | ||
|
||
# DOCKER_TAG mean tag from 4testing ex. 2.6.1.3123 | ||
: "${DOCKER_TAG:?Should be set}" | ||
|
||
# RELEASED_VERSION mean tag for stable repo 2.6.1.1 | ||
: "${RELEASE_VERSION:?Should be set}" | ||
|
||
# DOCKER_IMAGE_PREFIX mean tag prefix ex. 4testing-docspace | ||
: "${DOCKER_IMAGE_PREFIX:?Should be set}" | ||
|
||
cd ${GITHUB_WORKSPACE}/install/docker | ||
|
||
SERVICES=($(docker buildx bake -f build.yml --print | jq -r '.target | .[] | .tags[]')) | ||
echo ${SERVICES[@]} | ||
for service in ${SERVICES[@]}; do | ||
release_service ${service} | ||
done | ||
|
||
# Output Result | ||
echo "Released services" | ||
for service in ${RELEASED_SERVICES[@]}; do | ||
echo "${COLOR_GREEN}${service}${COLOR_RESET}" | ||
done | ||
|
||
# PANIC IF SOME SERVICE WASNT RELEASE | ||
if [[ -n ${UNRELEASED_SERVICES} ]]; then | ||
for service in ${UNRELEASED_SERVICES[@]}; do | ||
echo "${COLOR_RED}PANIC: Service ${service} wasn't relese!${COLOR_RED}" | ||
done | ||
exit 1 | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Install OneClickInstall Docker | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
paths: | ||
- '.github/workflows/ci-oci-docker-install.yml' | ||
- 'install/OneClickInstall/install-Docker.sh' | ||
workflow_dispatch: | ||
inputs: | ||
script-branch: | ||
description: 'Branch for OCI script docker' | ||
required: true | ||
type: string | ||
default: master | ||
|
||
jobs: | ||
Install-OneClickInstall-Docker: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Test OCI docker scripts | ||
run: | | ||
sudo docker image prune --all --force | ||
BRANCH_NAME=$( | ||
case "${{ github.event_name }}" in | ||
pull_request) echo "${{ github.event.pull_request.head.ref }}";; | ||
workflow_dispatch) echo "${{ github.event.inputs.script-branch }}";; | ||
push) echo "${GITHUB_REF#refs/heads/}";; | ||
esac | ||
) | ||
wget https://download.onlyoffice.com/docspace/docspace-install.sh | ||
sed '/bash install-Docker.sh/i sed -i "1i set -x" install-Docker.sh' -i docspace-install.sh | ||
sudo bash docspace-install.sh docker -skiphc true -noni true $([ $BRANCH_NAME != "master" ] && echo "-gb $BRANCH_NAME -s 4testing-") || exit $? | ||
echo -n "Waiting for all containers to start..." | ||
timeout 300 bash -c 'while docker ps | grep -q "starting"; do sleep 5; done' && echo "OK" || echo "container_status=timeout" >> $GITHUB_ENV | ||
- name: Check container status | ||
run: | | ||
docker ps --all --format "{{.Names}}" | xargs -I {} sh -c ' | ||
status=$(docker inspect --format="{{if .State.Health}}{{.State.Health.Status}}{{else}}no healthcheck{{end}}" {}); | ||
case "$status" in | ||
healthy) color="\033[0;32m" ;; # green | ||
"no healthcheck") color="\033[0;33m" ;; # yellow | ||
*) color="\033[0;31m"; echo "container_status=red" >> $GITHUB_ENV ;; # red | ||
esac; | ||
printf "%-30s ${color}%s\033[0m\n" "{}:" "$status"; | ||
' | ||
- name: Print logs for crashed container | ||
run: | | ||
docker ps --all --format "{{.Names}}" | xargs -I {} sh -c ' | ||
status=$(docker inspect --format="{{if .State.Health}}{{.State.Health.Status}}{{else}}no healthcheck{{end}}" {}); | ||
case "$status" in | ||
healthy | "no healthcheck") ;; | ||
*) | ||
echo "Logs for container {}:"; | ||
docker logs --tail 30 {} | sed "s/^/\t/g"; | ||
;; | ||
esac; | ||
' | ||
case "${{ env.container_status }}" in | ||
timeout) echo "Timeout reached. Not all containers are running."; exit 1 ;; | ||
red) echo "One or more containers have status 'red'. Job will fail."; exit 1 ;; | ||
esac | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release DocSpace | ||
|
||
run-name: "Release Docker-DocSpace ${{ github.event.inputs.release_version }}" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repo: | ||
description: 'hub.docker repo owner (ex. onlyoffice)' | ||
type: string | ||
required: true | ||
default: 'onlyoffice' | ||
release_version: | ||
type: string | ||
description: 'Tag for stable release (ex. 2.5.1.1)' | ||
required: true | ||
source_version: | ||
type: string | ||
description: '4testing tag from which the release will be created (ex. 2.5.1.2678)' | ||
required: true | ||
|
||
jobs: | ||
docker-release: | ||
uses: ONLYOFFICE/DocSpace-buildtools/.github/workflows/reusable-docspace-release.yaml@master | ||
with: | ||
repo: ${{ github.event.inputs.repo }} | ||
release_version: ${{ github.event.inputs.release_version }} | ||
source_version: ${{ github.event.inputs.source_version }} | ||
secrets: | ||
docker-username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
docker-usertoken: ${{ secrets.DOCKERHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: "<reusable> release Docker-DocSpace" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
repo: | ||
type: string | ||
required: true | ||
description: 'hub.docker repo owner (ex. onlyoffice)' | ||
release_version: | ||
type: string | ||
required: true | ||
description: 'Tag for stable release (ex. 1.0.0.1)' | ||
source_version: | ||
type: string | ||
required: true | ||
description: '4testing tag from which the release will be created (ex. 2.5.1.5678)' | ||
secrets: | ||
docker-username: | ||
required: true | ||
description: "hub.docker username" | ||
docker-usertoken: | ||
description: "hub.docker token" | ||
required: true | ||
|
||
jobs: | ||
Release: | ||
name: "Release Docker-DocSpace" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'ONLYOFFICE/DocSpace-buildtools' | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.docker-username }} | ||
password: ${{ secrets.docker-usertoken }} | ||
|
||
- name: "Release Docker-DocSpace" | ||
shell: bash | ||
env: | ||
REPO: ${{ inputs.repo }} | ||
DOCKER_TAG: ${{ inputs.source_version }} | ||
RELEASE_VERSION: ${{ inputs.release_version }} | ||
DOCKER_IMAGE_PREFIX: "4testing-docspace" | ||
run: | | ||
${GITHUB_WORKSPACE}/.github/scripts/release-docspace.sh |