Skip to content

Commit

Permalink
Merge 0810615 into 59cc364
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Carl committed Apr 12, 2018
2 parents 59cc364 + 0810615 commit bdf3621
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ matrix:
- go: 1.9
env:
- HOTROD=true
- go: 1.9
env:
- LINUX=true
- go: 1.9
env:
- WINDOWS=true
- go: 1.9
env:
- DARWIN=true

services:
- docker
Expand Down Expand Up @@ -54,9 +63,34 @@ script:
- if [ "$DOCKER" == true ]; then bash ./scripts/travis/build-docker-images.sh ; else echo 'skipping docker images'; fi
- if [ "$ES_INTEGRATION_TEST" == true ]; then bash ./scripts/travis/es-integration-test.sh ; else echo 'skipping elastic search integration test'; fi
- if [ "$HOTROD" == true ]; then bash ./scripts/travis/hotrod-integration-test.sh ; else echo 'skipping hotrod example'; fi
- if [ "$LINUX" == true ]; then make build-linux ; else echo 'skipping linux'; fi
- if [ "$WINDOWS" == true ]; then make build-windows ; else echo 'skipping windows'; fi
- if [ "$DARWIN" == true ]; then make build-darwin ; else echo 'skipping darwin'; fi

after_success:
- if [ "$COVERAGE" == true ]; then travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true ; else echo 'skipping coverage'; fi

after_failure:
- if [ "$CROSSDOCK" == true ]; then make crossdock-logs ; else echo 'skipping crossdock'; fi

before_deploy:
- bash ./scripts/travis/package-deploy.sh

deploy:
provider: releases
api_key:
secure: YOUR_API_KEY_ENCRYPTED
file:
- "cmd/standalone/standalone-linux"
- "cmd/standalone/standalone-windows.exe"
- "cmd/agent/agent-linux"
- "cmd/agent/agent-windows.exe"
- "cmd/query/query-linux"
- "cmd/query/query-windows.exe"
- "cmd/collector/collector-linux"
- "cmd/collector/collector-windows.exe"
skip_cleanup: true
on:
tags: true
repo: jaegertracing/jaeger
branch: master
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,50 @@ build_ui:
build-all-in-one-linux: build_ui
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/standalone/standalone-linux $(BUILD_INFO) ./cmd/standalone/main.go

.PHONY: build-all-in-one-windows
build-all-in-one-windows: build_ui
CGO_ENABLED=0 GOOS=windows installsuffix=cgo go build -o ./cmd/standalone/standalone-windows.exe $(BUILD_INFO) ./cmd/standalone/main.go

.PHONY: build-all-in-one-darwin
build-all-in-one-darwin: build_ui
CGO_ENABLED=0 GOOS=darwin installsuffix=cgo go build -o ./cmd/standalone/standalone-darwin $(BUILD_INFO) ./cmd/standalone/main.go

.PHONY: build-agent-linux
build-agent-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/agent/agent-linux $(BUILD_INFO) ./cmd/agent/main.go

.PHONY: build-agent-windows
build-agent-windows:
CGO_ENABLED=0 GOOS=windows installsuffix=cgo go build -o ./cmd/agent/agent-windows.exe $(BUILD_INFO) ./cmd/agent/main.go

.PHONY: build-agent-darwin
build-agent-darwin:
CGO_ENABLED=0 GOOS=darwin installsuffix=cgo go build -o ./cmd/agent/agent-darwin $(BUILD_INFO) ./cmd/agent/main.go

.PHONY: build-query-linux
build-query-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/query/query-linux $(BUILD_INFO) ./cmd/query/main.go

.PHONY: build-query-windows
build-query-windows:
CGO_ENABLED=0 GOOS=windows installsuffix=cgo go build -o ./cmd/query/query-windows.exe $(BUILD_INFO) ./cmd/query/main.go

.PHONY: build-query-darwin
build-query-darwin:
CGO_ENABLED=0 GOOS=darwin installsuffix=cgo go build -o ./cmd/query/query-darwin $(BUILD_INFO) ./cmd/query/main.go

.PHONY: build-collector-linux
build-collector-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/collector/collector-linux $(BUILD_INFO) ./cmd/collector/main.go

.PHONY: build-collector-windows
build-collector-windows:
CGO_ENABLED=0 GOOS=windows installsuffix=cgo go build -o ./cmd/collector/collector-windows.exe $(BUILD_INFO) ./cmd/collector/main.go

.PHONY: build-collector-darwin
build-collector-darwin:
CGO_ENABLED=0 GOOS=darwin installsuffix=cgo go build -o ./cmd/collector/collector-darwin $(BUILD_INFO) ./cmd/collector/main.go

.PHONY: docker-no-ui
docker-no-ui: build-agent-linux build-collector-linux build-query-linux build-crossdock-linux
mkdir -p jaeger-ui-build/build/
Expand All @@ -167,6 +199,15 @@ docker-no-ui: build-agent-linux build-collector-linux build-query-linux build-cr
.PHONY: docker
docker: build_ui docker-no-ui

.PHONY: build-linux
build-linux: build-agent-linux build-collector-linux build-query-linux build-all-in-one-linux

.PHONY: build-windows
build-windows: build-agent-windows build-collector-windows build-query-windows build-all-in-one-windows

.PHONY: build-darwin
build-darwin: build-agent-darwin build-collector-darwin build-query-darwin build-all-in-one-darwin

.PHONY: docker-images-only
docker-images-only:
cp -r jaeger-ui-build/build/ cmd/query/jaeger-ui-build
Expand Down Expand Up @@ -262,3 +303,7 @@ install-mockery:
.PHONY: generate-mocks
generate-mocks: install-mockery
$(MOCKERY) -all -dir ./pkg/es/ -output ./pkg/es/mocks && rm pkg/es/mocks/ClientBuilder.go

.PHONY: echo-version
echo-version:
@echo $(GIT_CLOSEST_TAG)
80 changes: 80 additions & 0 deletions scripts/travis/package-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

# stage-file copies the file $1 with the specified path $2
# if no file exists it will silently continue
function stage-file {
if [ -f $1 ]; then
echo "Copying $1 to $2"
cp $1 $2
else
echo "$1 does not exist. Continuing on."
fi
}

# stage-platform-files stages the different the platform ($1) into the package
# staging dir ($2). If you pass in a file extension ($3) it will be used when
# copying on both the target and the source
function stage-platform-files {
local PLATFORM=$1
local PACKAGE_STAGING_DIR=$2
local FILE_EXTENSION=$3

stage-file ./cmd/standalone/standalone-$PLATFORM$FILE_EXTENSION $PACKAGE_STAGING_DIR/jaeger-standalone$FILE_EXTENSION
stage-file ./cmd/agent/agent-$PLATFORM$FILE_EXTENSION $PACKAGE_STAGING_DIR/jaeger-agent$FILE_EXTENSION
stage-file ./cmd/query/query-$PLATFORM$FILE_EXTENSION $PACKAGE_STAGING_DIR/jaeger-query$FILE_EXTENSION
stage-file ./cmd/collector/collector-$PLATFORM$FILE_EXTENSION $PACKAGE_STAGING_DIR/jaeger-collector$FILE_EXTENSION
}

# package pulls built files for the platform ($1). If you pass in a file
# extension ($2) it will be used on the binaries
function package {
local PLATFORM=$1
local FILE_EXTENSION=$2

local PACKAGE_STAGING_DIR=$DEPLOY_STAGING_DIR/$PLATFORM
mkdir $PACKAGE_STAGING_DIR

stage-platform-files $PLATFORM $PACKAGE_STAGING_DIR $FILE_EXTENSION

local PACKAGE_FILES=$(ls -A $PACKAGE_STAGING_DIR/*) 2>/dev/null

if [ "$PACKAGE_FILES" ]; then
local ARCHIVE_NAME="jaeger-$VERSION-$PLATFORM-amd64.tar.gz"
echo "Packaging the following files into $ARCHIVE_NAME:"
echo $PACKAGE_FILES
tar -czvf ./deploy/$ARCHIVE_NAME $PACKAGE_FILES
else
echo "Will not package or deploy $PLATFORM files as there are no files to package!"
fi
}

# script start

DEPLOY_STAGING_DIR=./deploy-staging
VERSION="$(make echo-version | awk 'match($0, /([0-9]*\.[0-9]*\.[0-9]*)$/) { print substr($0, RSTART, RLENGTH) }')"
echo "Working on version: $VERSION"

# make needed directories
mkdir deploy
mkdir $DEPLOY_STAGING_DIR

# package linux
if [ "$LINUX" = true ]; then
package linux
else
echo "Skipping the packaging of linux binaries as \$LINUX was not true."
fi

# package darwin
if [ "$DARWIN" = true ]; then
package darwin
else
echo "Skipping the packaging of darwin binaries as \$DARWIN was not true."
fi

# package windows
if [ "$WINDOWS" = true ]; then
package windows .exe
else
echo "Skipping the packaging of windows binaries as \$WINDOWS was not true."
fi

0 comments on commit bdf3621

Please sign in to comment.