Divide jobs and scripts by use case
This commit is contained in:
@@ -11,20 +11,28 @@ stages:
|
|||||||
before_script:
|
before_script:
|
||||||
- apk add bash git
|
- apk add bash git
|
||||||
|
|
||||||
build:
|
build.tags:
|
||||||
stage: build
|
stage: build
|
||||||
script: /bin/bash -e .utilities/build.sh
|
script: /bin/bash -e utilities/build.tags.sh
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
- schedules
|
|
||||||
- milestone--2.0
|
- milestone--2.0
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- $CI_PROJECT_NAME.tar
|
- $CI_PROJECT_NAME.tar
|
||||||
|
|
||||||
|
build.schedules:
|
||||||
|
stage: build
|
||||||
|
script: /bin/bash -e utilities/build.schedules.sh
|
||||||
|
only:
|
||||||
|
- schedules
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- $CI_PROJECT_NAME.tar
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script: /bin/bash -e .utilities/test.sh
|
script: /bin/bash -e utilities/test.sh
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
- schedules
|
- schedules
|
||||||
@@ -33,11 +41,19 @@ test:
|
|||||||
paths:
|
paths:
|
||||||
- $CI_PROJECT_NAME.tar
|
- $CI_PROJECT_NAME.tar
|
||||||
|
|
||||||
publish:
|
publish.tags:
|
||||||
stage: publish
|
stage: publish
|
||||||
script: /bin/bash -e .utilities/publish.sh
|
script: /bin/bash -e utilities/publish.tags.sh
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- $CI_PROJECT_NAME.tar
|
||||||
|
|
||||||
|
publish.schedules:
|
||||||
|
stage: publish
|
||||||
|
script: /bin/bash -e utilities/publish.schedules.sh
|
||||||
|
only:
|
||||||
- schedules
|
- schedules
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
@@ -45,6 +61,6 @@ publish:
|
|||||||
|
|
||||||
update_docker_hub_full_description:
|
update_docker_hub_full_description:
|
||||||
stage: publish
|
stage: publish
|
||||||
script: /bin/bash -e .utilities/update-docker-hub-full-description.sh
|
script: /bin/bash -e utilities/update-docker-hub-full-description.sh
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|||||||
28
.utilities/build.tags.sh
Normal file
28
.utilities/build.tags.sh
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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
|
||||||
34
.utilities/publish.schedules.sh
Normal file
34
.utilities/publish.schedules.sh
Normal file
@@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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
|
||||||
@@ -21,7 +21,7 @@ source $SCRIPT_DIRECTORY/utilities.sh
|
|||||||
load_images_artifacts
|
load_images_artifacts
|
||||||
|
|
||||||
tags=("latest")
|
tags=("latest")
|
||||||
for version_component in $(git describe --abbrev=0 | tr "." "\n"); do
|
for version_component in "$CI_COMMIT_TAG"; do
|
||||||
tag+="$version_component"
|
tag+="$version_component"
|
||||||
tags+=("$tag")
|
tags+=("$tag")
|
||||||
tag+="."
|
tag+="."
|
||||||
Reference in New Issue
Block a user