提交 0ee1fade 编写于 作者: M Matteo Merli 提交者: GitHub

Build and publish docker images (#575)

上级 9dae2070
......@@ -21,6 +21,11 @@ language: java C++ ruby
jdk:
- oraclejdk8
sudo: required
services:
- docker
cache:
directories:
- $HOME/.m2
......@@ -44,7 +49,10 @@ install:
script:
# Build Java and C++
- mvn license:check test && sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR compile
- mvn license:check test package && sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR compile
# Build docker images
- docker/build.sh
# Generate website
- (cd site && make travis_build)
deploy:
......@@ -81,3 +89,9 @@ deploy:
on:
repo: apache/incubator-pulsar
branch: master
-
provider: script
skip_cleanup: true
script: docker/publish.sh
on:
tags: true
......@@ -18,14 +18,10 @@
# under the License.
#
# Get the project version from Maven
pushd .. > /dev/null
MVN_VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
popd > /dev/null
ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR/docker
MVN_VERSION=`./get-version.sh`
echo "Pulsar version: ${MVN_VERSION}"
......@@ -54,14 +50,14 @@ rm pulsar-${MVN_VERSION}-bin.tar.gz
# Build pulsar-grafana image
docker build -t pulsar-grafana grafana
docker build -t pulsar-grafana:latest grafana
if [ $? != 0 ]; then
echo "Error: Failed to create Docker image for pulsar-grafana"
exit 1
fi
# Build dashboard docker image
docker build -t pulsar-dashboard ../dashboard
docker build -t pulsar-dashboard:latest ../dashboard
if [ $? != 0 ]; then
echo "Error: Failed to create Docker image for pulsar-dashboard"
exit 1
......
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
ROOT_DIR=$(git rev-parse --show-toplevel)
pushd $ROOT_DIR > /dev/null
# Get the project version from the Maven pom.xml
cat pom.xml | xmllint --format - \
| sed "s/xmlns=\".*\"//g" | xmllint --stream --pattern /project/version --debug - \
| grep -A 2 "matches pattern" | grep text | sed "s/.* [0-9] //g"
popd > /dev/null
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR/docker
# We should only publish images that are made from official and approved releases
# and thus ignore all the release candidates that are just tagged during the release
# process
if [[ ${TRAVIS_TAG} == *"candidate"* || ${TRAVIS_TAG} == *"rc"* ]]; then
echo "Skipping non-final release tag ${TRAVIS_TAG}"
exit 0
fi
if [ -z "$DOCKER_USER" ]; then
echo "Docker user in variable \$DOCKER_USER was not set. Skipping image publishing"
exit 1
fi
if [ -z "$DOCKER_PASSWORD" ]; then
echo "Docker password in variable \$DOCKER_PASSWORD was not set. Skipping image publishing"
exit 1
fi
DOCKER_ORG="${DOCKER_ORG:-apachepulsar}"
docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD"
if [ $? -ne 0 ]; then
echo "Failed to loging to Docker Hub"
exit 1
fi
MVN_VERSION=`./get-version.sh`
echo "Pulsar version: ${MVN_VERSION}"
set -x
# Fail if any of the subsequent commands fail
set -e
docker tag pulsar:latest $DOCKER_ORG/pulsar:latest
docker tag pulsar-grafana:latest $DOCKER_ORG/pulsar-grafana:latest
docker tag pulsar-dashboard:latest $DOCKER_ORG/pulsar-dashboard:latest
docker tag pulsar:latest $DOCKER_ORG/pulsar:$MVN_VERSION
docker tag pulsar-grafana:latest $DOCKER_ORG/pulsar-grafana:$MVN_VERSION
docker tag pulsar-dashboard:latest $DOCKER_ORG/pulsar-dashboard:$MVN_VERSION
# Push all images and tags
docker push $DOCKER_ORG/pulsar:latest
docker push $DOCKER_ORG/pulsar-grafana:latest
docker push $DOCKER_ORG/pulsar-dashboard:latest
docker push $DOCKER_ORG/pulsar:$MVN_VERSION
docker push $DOCKER_ORG/pulsar-grafana:$MVN_VERSION
docker push $DOCKER_ORG/pulsar-dashboard:$MVN_VERSION
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册