Skip to content
Snippets Groups Projects
Commit 35759727 authored by Fabrizio Chiarello's avatar Fabrizio Chiarello
Browse files
parent 6cd81c9b
No related branches found
Tags v0.1.0
No related merge requests found
......@@ -26,7 +26,9 @@ image: python:2.7
stages:
- test
- release
- docker
- docker-build
- docker-test
- docker-release
variables: &variables
CI_DEBUG_TRACE: "false"
......@@ -58,7 +60,7 @@ pep8:
- tox -e pep8
allow_failure: true
.release_template: &release_template
release:
stage: release
variables:
<<: *variables
......@@ -66,56 +68,48 @@ pep8:
- ci-tools/prepare.sh
script:
- ci-tools/release-build.sh
release:build:
<<: *release_template
artifacts:
paths:
- releases/caos_collector-$(ci-tools/git-semver-pbr.sh)-py2-none-any.whl
expire_in: 1 day
except:
- master
release:master:
<<: *release_template
artifacts:
paths:
- releases/caos_collector-$(ci-tools/git-semver-pbr.sh)-py2-none-any.whl
only:
- master
.docker_template: &docker_template
image: docker:stable
stage: docker
services:
- docker:stable-dind
tags:
- docker-dind
variables: &docker_template_variables
<<: *variables
DO_DOCKER_LOGIN: "true"
before_script:
- docker info
- apk add --no-cache bash git
script:
- ci-tools/docker-build.sh
docker:build:
docker-build:
<<: *docker_template
stage: docker-build
variables:
<<: *docker_template_variables
DO_DOCKER_PUSH: "true"
dependencies:
- release:build
except:
- master
- tags
- release
script:
- ci-tools/docker-build.sh
docker:master:
docker-test:
<<: *docker_template
stage: docker-test
script:
- ci-tools/docker-test.sh
docker-release:
<<: *docker_template
stage: docker-release
variables:
<<: *docker_template_variables
DO_DOCKER_PUSH: "true"
dependencies:
- release:master
script:
- ci-tools/docker-release.sh
only:
- master
- tags
......@@ -23,7 +23,7 @@
#
################################################################################
set -e
set -ex
ANSI_COLOR_GREEN="\033[32;1m"
ANSI_COLOR_RED="\033[31;1m"
......@@ -61,3 +61,26 @@ function say_red () {
function say_yellow () {
say_with_color ${ANSI_COLOR_YELLOW} "$@"
}
function export_version_vars () {
PBR_VERSION=$(ci-tools/git-semver-pbr.sh)
RELEASE_GIT_VERSION=$(ci-tools/git-describe.sh)
if [ -z "${PBR_VERSION}" ] ; then
die "PBR_VERSION not set."
fi
if [ -z "${RELEASE_GIT_VERSION}" ] ; then
die "RELEASE_GIT_VERSION not set."
fi
export PBR_VERSION="${PBR_VERSION}"
export CAOS_COLLECTOR_RELEASE_GIT_VERSION="${RELEASE_GIT_VERSION}"
}
function docker_login () {
if [ "${DO_DOCKER_LOGIN}" == true ] ; then
say_yellow "docker login to ${CI_REGISTRY}"
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
fi
}
......@@ -27,23 +27,11 @@ set -e
source ${CI_PROJECT_DIR}/ci-tools/common.sh
export PBR_VERSION=$(ci-tools/git-semver-pbr.sh)
export CAOS_COLLECTOR_RELEASE_GIT_VERSION=$(ci-tools/git-describe.sh)
export_version_vars
if [ -z "${PBR_VERSION}" ] ; then
die "PBR_VERSION not set."
fi
if [ -z "${CAOS_COLLECTOR_RELEASE_GIT_VERSION}" ] ; then
die "CAOS_COLLECTOR_RELEASE_GIT_VERSION not set."
fi
if [ "${DO_DOCKER_PUSH}" == true ] ; then
say_yellow "docker login"
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
fi
docker_login
CAOS_COLLECTOR_DOCKER_IMAGE_TAG=${CI_REGISTRY_IMAGE}:${CAOS_COLLECTOR_RELEASE_GIT_VERSION}
CAOS_COLLECTOR_DOCKER_IMAGE_TAG=${CI_REGISTRY_IMAGE}:${CAOS_COLLECTOR_RELEASE_GIT_VERSION}-test
say_yellow "Building docker container"
docker build \
......
#!/usr/bin/env bash
################################################################################
#
# caos-collector - CAOS collector
#
# Copyright © 2017 INFN - Istituto Nazionale di Fisica Nucleare (Italy)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Author: Fabrizio Chiarello <fabrizio.chiarello@pd.infn.it>
#
################################################################################
set -e
source ${CI_PROJECT_DIR}/ci-tools/common.sh
export_version_vars
docker_login
CAOS_COLLECTOR_DOCKER_IMAGE_TAG=${CI_REGISTRY_IMAGE}:${CAOS_COLLECTOR_RELEASE_GIT_VERSION}
say_yellow "Pulling docker container"
docker pull ${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}-test
say_yellow "Tagging docker container"
docker tag ${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}-test ${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}
say_yellow "Pushing container"
docker push ${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}
#!/usr/bin/env bash
################################################################################
#
# caos-collector - CAOS collector
#
# Copyright © 2017 INFN - Istituto Nazionale di Fisica Nucleare (Italy)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Author: Fabrizio Chiarello <fabrizio.chiarello@pd.infn.it>
#
################################################################################
set -e
source ${CI_PROJECT_DIR}/ci-tools/common.sh
export_version_vars
docker_login
CAOS_COLLECTOR_DOCKER_IMAGE_TAG=${CI_REGISTRY_IMAGE}:${CAOS_COLLECTOR_RELEASE_GIT_VERSION}
say_yellow "Pulling docker container"
docker pull ${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}-test
say_yellow "Running docker container"
docker run --rm \
${CAOS_COLLECTOR_DOCKER_IMAGE_TAG}-test --help
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment