Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the built tag to be prefixed with docker- which can be used to … #2868

Merged
merged 1 commit into from
Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ before_install:
install: ./mvnw install -DskipTests=true -Dlicense.skip=true -Dmaven.javadoc.skip=true -B -V
script: ./travis/publish.sh

# Don't build release tags. This avoids publish conflicts because the version commit exists both on master and the release tag.
# See https://github.com/travis-ci/travis-ci/issues/1532
branches:
except:
# Don't build release tags. This avoids publish conflicts because the version commit exists both on master and the release tag.
# See https://github.com/travis-ci/travis-ci/issues/1532
- /^[0-9]/
# Don't build docker- tags with Travis. Docker Hub will pick up and run the build. docker- tags are used to recreate
# docker images without rebuilding Zipkin so we don't need to run here.
- /^docker-/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool


notifications:
webhooks:
Expand Down
44 changes: 41 additions & 3 deletions docker/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,49 @@ set -v
# to top level.
cd ..

# SOURCE_BRANCH contains the name of the branch or tag being built. Our build of the master branch
# ignores this argument, while our build of release tags uses it to fetch the right release artifact.
docker build --build-arg version="$SOURCE_BRANCH" -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .
# SOURCE_BRANCH is something like
#
# master - Building the master branch. This cut command will return 'master', and Dockerfiles will ignore it
# 1.0.1 - Building a release image along with a new Zipkin server version. This cut command will return
# '1.0.1' and Dockerfiles will use it to fetch the correct version of Zipkin.
# docker-1.0.1 - Building a release image, but not a new Zipkin server. This cut command will return
# '1.0.1' and Dockerfiles will use it to fetch the correct version of Zipkin.
VERSION=$(echo "$SOURCE_BRANCH" | cut -d '-' -f 2)
echo "Building images for version $VERSION"

docker build --build-arg version="$VERSION" -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .

IFS=',' read -ra TAGS <<< "$DOCKER_TAG"
for tag in ${TAGS[@]}; do
docker tag "$IMAGE_NAME" "${DOCKER_REPO}:${tag}"
done

# We always build zipkin-slim
echo Building zipkin-slim
docker build --build-arg version="$VERSION" -f "$DOCKERFILE_PATH" -t "openzipkin/zipkin-slim:${TAGS[0]}" --target zipkin-slim .
for tag in ${TAGS[@]:1}; do
docker tag "openzipkin/zipkin-slim:${TAGS[0]}" "openzipkin/zipkin-slim:$tag"
done

# We always build test images formerly hosted on https://github.com/openzipkin/docker-zipkin
echo Building zipkin-ui
docker build --build-arg version="VERSION" -f "$DOCKERFILE_PATH" -t "openzipkin/zipkin-ui:${TAGS[0]}" --target zipkin-ui .
for tag in ${TAGS[@]:1}; do
docker tag "openzipkin/zipkin-ui:${TAGS[0]}" "openzipkin/zipkin-ui:$tag"
done

# We also build testing images to correspond with the server version to keep schemas up to date
for path in collector/kafka storage/cassandra storage/elasticsearch6 storage/elasticsearch7 storage/mysql; do
image=zipkin-$(basename ${path})
echo Building ${image}
docker build --build-arg version="$VERSION" -f "docker/${path}/Dockerfile" -t "openzipkin/${image}:${TAGS[0]}" .
for tag in ${TAGS[@]:1}; do
docker tag "openzipkin/${image}:${TAGS[0]}" "openzipkin/${image}:$tag"
done
done

if [[ "$DOCKER_TAG" == "master" ]]; then
# We rebuild the builder image on master push, not on release pushes.
echo Building zipkin-builder
docker build -f "$DOCKERFILE_PATH" -t openzipkin/zipkin-builder --target zipkin-builder .
fi
42 changes: 0 additions & 42 deletions docker/hooks/post_build

This file was deleted.