diff --git a/.utilities/build.sh b/.utilities/build.sh
new file mode 100644
index 0000000..ef75070
--- /dev/null
+++ b/.utilities/build.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Docker Seafile client, help you mount a Seafile library as a volume.
+# Copyright (C) 2019-2020, flow.gunso@gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# Hard reset to the latest tag.
+latest_version=$(git describe --abbrev=0)
+git reset --hard $latest_version
+
+cp -R tests seafile-client/
+cd seafile-client/
+
+docker build \
+ --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
+ --build-arg VCS_REF=$(git rev-parse --short HEAD) \
+ --build-arg VERSION=$latest_version \
+ --tag $CI_PROJECT_NAME:build .
+
+docker save --output ../$CI_PROJECT_NAME.tar $CI_PROJECT_NAME:build
diff --git a/.utilities/check.sh b/.utilities/check.sh
new file mode 100644
index 0000000..9160cb0
--- /dev/null
+++ b/.utilities/check.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Docker Seafile client, help you mount a Seafile library as a volume.
+# Copyright (C) 2019-2020, flow.gunso@gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# Check the CI pipeline sources.
+if ! [[ "$CI_PIPELINE_SOURCE" == "push" || "$CI_PIPELINE_SOURCE" == "schedule" ]]; then
+ echo "CI pipelines are only allowed from the push and schedule sources"
+ exit 1
+fi
+
+# Check the schedule target for the scheduled CI pipelines.
+if [[ "$CI_PIPELINE_SOURCE" == "schedule" ]]; then
+ if [[ -z "$SCHEDULE_TARGET" ]]; then
+ echo "\$SCHELUDE_TARGET was not provided."
+ exit 1
+ fi
+
+ if ! [[ "$SCHEDULE_TARGET" == "weekly" ]]; then
+ echo "\$SCHEDULE_TARGET $SCHEDULE_TARGET is not known."
+ exit 1
+ fi
+fi
+
+# Check the tag is properly defined on job other than update_docker_hub_full_description job,
+# on pushed CI pipelines.
+if [[ "$CI_PIPELINE_SOURCE" == "push" ]]; then
+ if ! [[ "$CI_JOB_NAME" == "update_docker_hub_full_description" ]]; then
+ if [[ -z "$CI_COMMIT_TAG" && "$CI_COMMIT_TAG" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]
+ echo "The \$CI_COMMIT_TAG $CI_COMMIT_TAG does not match the MAJOR.Minor.revision layout."
+ exit 1
+ fi
+ fi
+fi
diff --git a/.utilities/publish.sh b/.utilities/publish.sh
new file mode 100644
index 0000000..8c21ad0
--- /dev/null
+++ b/.utilities/publish.sh
@@ -0,0 +1,34 @@
+# !/bin/bash
+
+# Docker Seafile client, help you mount a Seafile library as a volume.
+# Copyright (C) 2019-2020, flow.gunso@gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+SCRIPT_DIRECTORY=$(dirname ${BASH_SOURCE[0]})
+source $SCRIPT_DIRECTORY/utilities.sh
+load_images_artifacts
+
+tags=("latest")
+for version_component in $(git describe --abbrev=0 | tr "." "\n"); do
+ tag+="$version_component"
+ tags+=("$tag")
+ tag+="."
+done
+
+echo $CI_REGISTRY_BOT_PASSWORD | docker login --password-stdin --username $CI_REGISTRY_BOT_USERNAME
+for tag in "${tags[@]}"; do
+ echo "docker tag $CI_PROJECT_NAME:$tag $CI_REGISTRY_IMAGE:build"
+ echo "docker push $CI_REGISTRY_IMAGE:$tag"
+done
diff --git a/.utilities/test.sh b/.utilities/test.sh
new file mode 100644
index 0000000..b4b1014
--- /dev/null
+++ b/.utilities/test.sh
@@ -0,0 +1,26 @@
+# !/bin/bash
+
+# Docker Seafile client, help you mount a Seafile library as a volume.
+# Copyright (C) 2019-2020, flow.gunso@gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+SCRIPT_DIRECTORY=$(dirname ${BASH_SOURCE[0]})
+source $SCRIPT_DIRECTORY/utilities.sh
+load_images_artifacts
+
+docker run \
+ --interactive \
+ --attach stderr \
+ $CI_PROJECT_NAME:build /test/test_binaries.sh
diff --git a/.utilities/update-docker-hub-full-description.sh b/.utilities/update-docker-hub-full-description.sh
new file mode 100644
index 0000000..ac772b2
--- /dev/null
+++ b/.utilities/update-docker-hub-full-description.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# Docker Seafile client, help you mount a Seafile library as a volume.
+# Copyright (C) 2019-2020, flow.gunso@gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# Based upon https://gist.github.com/jlhawn/8f218e7c0b14c941c41f
+# and https://github.com/moikot/golang-dep/blob/master/.travis/push.sh
+
+# This action can only be done with the actual owner of the repository,
+# unless you can extend the collaborator's permissions but as far as I know, you can't.
+
+# Install required system packages.
+apk add curl jq
+
+# Get a token from hub.docker.com with the owner credentials.
+token=$(curl -s \
+ -X POST \
+ -H "Content-Type: application/json" \
+ -d '{"username": "'"$CI_REGISTRY_OWNER_USERNAME"'", "password": "'"$CI_REGISTRY_OWNER_PASSWORD"'"}' \
+ https://hub.docker.com/v2/users/login/ | jq -r .token)
+
+# Generate a JSON with the README.md as the full_description.
+json=$(jq -n \
+ --arg readme "$(.
+
+load_images_artifacts() {
+ docker load --input $CI_PROJECT_NAME.tar
+}