Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom options for Dockerfile.app #285

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/cron-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,29 @@ jobs:
run: |
all_branches=$(git ls-remote -hq | sed -n 's/^[0-9a-f]\{40\}\s\+refs\/heads\//''/p')
matching_branches=""
hashes=""

for branch in $all_branches; do
if [[ $branch =~ ^release/v[0-9]+ || $branch =~ ^hotfix/v[0-9]+ || $branch == "develop" ]]; then
matching_branches="${matching_branches},\"${branch}\""
curl_buildtools=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/commits/${branch}" | jq -r '.sha')

curl_client=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-client/commits/${branch}" | jq -r '.sha')

curl_server=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-server/commits/${branch}" | jq -r '.sha')

echo "${branch}_buildtools_hash=${curl_buildtools}" >> $GITHUB_ENV
echo "${branch}_client_hash=${curl_client}" >> $GITHUB_ENV
echo "${branch}_server_hash=${curl_server}" >> $GITHUB_ENV
fi
done

Expand All @@ -35,12 +54,15 @@ jobs:
run: |
echo "${{ steps.list-branches.outputs.json_output }}"

payload=$((env | grep '_hash=' | awk -F'=' '{print "\"" $1 "\": \"" $2 "\""}' | paste -sd, - | sed 's/^/{/;s/$/}/')| tr -d '[:space:]')
echo "Payload JSON: $payload"

curl \
-X POST \
-u "${{ secrets.USERNAME}}:${{secrets.TOKEN}}" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/dispatches" \
-H "Accept: application/vnd.github.everest-preview+json" \
--data '{"event_type": "cron-trigger-action", "client_payload": { "branches": ${{ steps.list-branches.outputs.json_output }}}}'
--data '{"event_type": "cron-trigger-action", "client_payload": { "branches": ${{ steps.list-branches.outputs.json_output }}, "hashes": '$payload' } }'

curl \
-X POST \
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,22 @@ jobs:
DOCKER_TAG=${PRODUCT_VERSION}.${{github.run_number}}
fi
export DOCKER_TAG
BUILDTOOLS_ENV="${{ github.event.client_payload.hashes[ format('{0}_buildtools_hash', matrix.branch)] }}"
SERVER_ENV="${{ github.event.client_payload.hashes[ format('{0}_server_hash', matrix.branch)] }}"
CLIENT_ENV="${{ github.event.client_payload.hashes[ format('{0}_client_hash', matrix.branch)] }}"
echo "buildtools_hash: $BUILDTOOLS_ENV"
echo "server_hash: $SERVER_ENV"
echo "client_hash: $CLIENT_ENV"
docker buildx bake -f build.yml \
--set *.args.GIT_BRANCH=${{ matrix.branch }} \
--set *.args.PRODUCT_VERSION=${PRODUCT_VERSION} \
--set *.args.BUILD_NUMBER=${BUILD_NUMBER} \
--set *.platform=linux/amd64 \
--set *.args.PRODUCT_VERSION=${PRODUCT_VERSION} \
--set *.args.BUILD_NUMBER=${{github.run_number}} \
--set *.args.BUILDTOOLS_COMMIT=$BUILDTOOLS_ENV \
--set *.args.SERVER_COMMIT=$SERVER_ENV \
--set *.args.CLIENT_COMMIT=$CLIENT_ENV \
--push

echo "version=${DOCKER_TAG}" >> "$GITHUB_OUTPUT"
Expand Down
4 changes: 3 additions & 1 deletion debuginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def fetchCommits(url, type):
print("Error folder does not exists", path)
return

branch_env = f"{type.upper()}_BRANCH"
branch = os.environ.get(branch_env)
repo = Repo(path)

info = f"| [DocSpace-{type}]({url}) | [{repo.active_branch.name}]({url}/tree/{repo.active_branch.name}) | [{repo.head.commit}]({url}/commit/{repo.head.commit}) |{os.linesep}"
info = f"| [DocSpace-{type}]({url}) | [{branch}]({url}/tree/{branch}) | [{repo.head.commit}]({url}/commit/{repo.head.commit}) |{os.linesep}"

commits_str = repo.git.log(f"--pretty=format: {format}", "--no-merges", f"--since={LIMIT_DAYS}.days")
#print(commits_str)
Expand Down
28 changes: 23 additions & 5 deletions install/docker/Dockerfile.app
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,27 @@ ARG DEPLOY_ARGS="deploy"
ARG DEBUG_INFO="true"
ARG PUBLISH_CNF="Release"

ARG GIT_BRANCH_BUILDTOOLS=""
ARG GIT_BRANCH_SERVER=""
ARG GIT_BRANCH_CLIENT=""
ARG GIT_BRANCH_CAMPAIGNS=""
ARG BUILDTOOLS_COMMIT=""
ARG SERVER_COMMIT=""
ARG CLIENT_COMMIT=""
ARG CAMPAIGNS_COMMIT=""

LABEL onlyoffice.appserver.release-date="${RELEASE_DATE}" \
maintainer="Ascensio System SIA <[email protected]>"

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8

ARG GIT_BRANCH_BUILDTOOLS=${GIT_BRANCH_BUILDTOOLS:-$GIT_BRANCH}
ARG GIT_BRANCH_SERVER=${GIT_BRANCH_SERVER:-$GIT_BRANCH}
ARG GIT_BRANCH_CLIENT=${GIT_BRANCH_CLIENT:-$GIT_BRANCH}
ARG GIT_BRANCH_CAMPAIGNS=${GIT_BRANCH_CAMPAIGNS:-$GIT_BRANCH}

RUN apt-get -y update && \
apt-get install -yq \
sudo \
Expand All @@ -39,11 +53,15 @@ RUN apt-get -y update && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*

ADD https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/git/refs/heads/${GIT_BRANCH} version.json
RUN git clone -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/DocSpace-buildtools.git ${SRC_PATH}/buildtools && \
git clone --recurse-submodules -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/DocSpace-Server.git ${SRC_PATH}/server && \
git clone -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/DocSpace-Client.git ${SRC_PATH}/client && \
git clone -b "master" --depth 1 https://github.com/ONLYOFFICE/ASC.Web.Campaigns.git ${SRC_PATH}/campaigns
ADD https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/git/refs/heads/${GIT_BRANCH_BUILDTOOLS} version.json
RUN git clone -b ${GIT_BRANCH_BUILDTOOLS} https://github.com/ONLYOFFICE/DocSpace-buildtools.git ${SRC_PATH}/buildtools && \
if [ -n "${BUILDTOOLS_COMMIT}" ]; then git -C ${SRC_PATH}/buildtools checkout ${BUILDTOOLS_COMMIT}; fi && \
git clone --recurse-submodules -b ${SERVER_BRANCH} https://github.com/ONLYOFFICE/DocSpace-Server.git ${SRC_PATH}/server && \
if [ -n "${SERVER_COMMIT}" ]; then git -C ${SRC_PATH}/server checkout ${SERVER_COMMIT}; fi && \
git clone -b ${GIT_BRANCH_CLIENT} https://github.com/ONLYOFFICE/DocSpace-Client.git ${SRC_PATH}/client && \
if [ -n "${CLIENT_COMMIT}" ]; then git -C ${SRC_PATH}/client checkout ${CLIENT_COMMIT}; fi && \
git clone -b master --depth 1 https://github.com/ONLYOFFICE/ASC.Web.Campaigns.git ${SRC_PATH}/campaigns && \
if [ -n "${CAMPAIGNS_COMMIT}" ]; then git -C ${SRC_PATH}/campaigns checkout ${CAMPAIGNS_COMMIT}; fi

RUN cd ${SRC_PATH} && \
mkdir -p /app/onlyoffice/config/ && \
Expand Down