Merge branch 'staging'

This commit is contained in:
flow.gunso
2019-03-25 11:36:08 +01:00
6 changed files with 63 additions and 22 deletions

View File

@@ -6,11 +6,11 @@ services:
stages:
- build_publish
staging:
stage: build_publish
before_script:
- apk add bash
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
staging:
stage: build_publish
script:
- /bin/bash utils/publish/staging.sh
only:
@@ -18,12 +18,16 @@ staging:
production:
stage: build_publish
before_script:
- apk add bash
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
script:
- /bin/bash utils/publish/production.sh
only:
- tags
except:
- branches
update_docker_hub_full_description:
stage: build_publish
script:
- /bin/bash utils/publish/update-docker-hub-full-description.sh
only:
- master

View File

@@ -1,3 +1,8 @@
### [1.0.4] - 2019/03/25
- Fix the build target detection (@a52559ddb38a64d7fceaa8bf9b8afd7356ccc439)
- Login to the Docker Hub from within the script, not the gitlab-ci.yml, using (@72bab017c1167b8ab35cef3cc709ff83686eaca4, @f69483354a4cf8afdbea89ef2bb1d9a9b7b2ac10)
- Require Bash on all Gitlab CI stages (@72bab017c1167b8ab35cef3cc709ff83686eaca4)
- Add a script to push the README.md into the Docker Hub repository's full_description (@8cb49cbc8253368701d718c2e38017790c78ceca, @ca6128fb96602da71f3b7a560e834d1b7587abac)
### [1.0.3] - 2019/03/19
- Restrict staging pipelines to pushed pipelines
- Restrict production pipelines to pushed and triggered pipelines

View File

@@ -1,4 +1,4 @@
[![1.0.3 status](https://gitlab.com/flwgns-docker/seafile-client/badges/1.0.3/pipeline.svg)](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.3)
[![1.0.4 status](https://gitlab.com/flwgns-docker/seafile-client/badges/1.0.4/pipeline.svg)](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.4)
[![docker pulls](https://img.shields.io/docker/pulls/flowgunso/seafile-client.svg)](https://hub.docker.com/r/flowgunso/seafile-client)
# Available tags
@@ -9,13 +9,15 @@ Permanent stable releases will not be built again.
You can rely on the weekly stable releases. They are stable.
## Weekly stable releases.
[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3),
[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3),
[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3),
[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3)
(see tag/release [1.0.3](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3))
[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.4),
[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.4),
[`1.0.4`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.4),
[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.4)
(see tag/release [1.0.4](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.4))
## Permanent stable releases.
[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3)
(see tag/release [1.0.3](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3))
[`1.0.2`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2)
(see tag/release [1.0.2](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2))
[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0)

View File

@@ -28,9 +28,9 @@ fi
if [ $CI_PIPELINE_SOURCE == "push" ]; then
BUILD_LATEST=true
elif [ $CI_PIPELINE_SOURCE == "trigger" ]; then
if [ -z $BUILD_LATEST ] || \
[ -z $BUILD_MAJOR ] || \
[ -z $BUILD_MINOR ] || \
if [ -z $BUILD_LATEST ] && \
[ -z $BUILD_MAJOR ] && \
[ -z $BUILD_MINOR ] && \
[ -z $BUILD_REVISION ]; then
echo "You must provide build targets to this stage when ran from Pipeline Triggers."
exit 1
@@ -60,8 +60,11 @@ docker build \
-t $CI_REGISTRY_IMAGE:$MINOR \
-t $CI_REGISTRY_IMAGE:$REVISION .
# Login with Docker Registry.
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER docker.io --password-stdin
# Only push requested builds.
if [ $BUILD_LATEST ]; then docker push $CI_REGISTRY_IMAGE:latest; fi
if [ $BUILD_MAJOR ]; then docker push $CI_REGISTRY_IMAGE:$MAJOR; fi
if [ $BUILD_MINOR ]; then docker push $CI_REGISTRY_IMAGE:$MINOR; fi
if [ $BUILD_REVISION ]; then docker push $CI_REGISTRY_IMAGE:$REVISION; fi
if [ $BUILD_LATEST ]; then docker push index.docker.io/$CI_REGISTRY_IMAGE:latest; fi
if [ $BUILD_MAJOR ]; then docker push index.docker.io/$CI_REGISTRY_IMAGE:$MAJOR; fi
if [ $BUILD_MINOR ]; then docker push index.docker.io/$CI_REGISTRY_IMAGE:$MINOR; fi
if [ $BUILD_REVISION ]; then docker push index.docker.io/$CI_REGISTRY_IMAGE:$REVISION; fi

View File

@@ -22,6 +22,9 @@ if [ $CI_PIPELINE_SOURCE != "push" ]; then
exit 1
fi
# Login with Docker Registry.
echo $CI_REGISTRY_BOT_PASSWORD | docker login -u $CI_REGISTRY_BOT_USERNAME docker.io --password-stdin
# Build and push as staging.
docker build -t $CI_REGISTRY_IMAGE:staging .
docker push $CI_REGISTRY_IMAGE:staging
docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging .
docker push index.docker.io/$CI_REGISTRY_IMAGE:staging

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Based upon https://gist.github.com/jlhawn/8f218e7c0b14c941c41f
# and https://github.com/moikot/golang-dep/blob/master/.travis/push.sh
# 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 "$(<README.md)" \
'{"full_description": "'"$readme"'"}')
# Update the Docker Hub repository's full_description.
curl -s -L \
-X PATCH \
-d "$json" \
-H "Content-Type: application/json" \
-H "Authorization: JWT $token" \
https://cloud.docker.com/v2/repositories/$CI_REGISTRY_IMAGE/