-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Publish binaries to GitHub Releases #766
Changes from 8 commits
bc13eff
0120ea5
896fa37
d98cde9
19ca6e6
222e388
527a042
cf9f34d
0810615
4488a72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not familiar with travis deploy workflow - where do these files end up? And do we need a different naming conventions? E.g. https://prometheus.io/download/:
Also, since these are archive files, do we want to bundle all binaries into one archive? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, we should change these commands to only build and deploy these binaries on landing the PR rather than every commit (unless this already does this) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those files will end up as individual assets over at the release message (e.g. https://github.com/jaegertracing/jaeger/releases/tag/v1.3.0). That's why we need someone to supply a token at Because we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think that's what we want:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jpkrohling I think that's only if you have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I verified from the Travis docs:
So if we have |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason not to call this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just following convention since the agent for linux is called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yurishkuro what if we named the different binaries for windows along the lines of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my preference would be to have identical names but group them into dirs/archives by target, e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it. I'll work on getting that setup @yurishkuro. |
||
|
||
.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/ | ||
|
@@ -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 | ||
|
@@ -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) |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall this looks good, but this 3 additions concern me as they are going to significantly increase Travis build times. I'd rather have a single DEPLOY=true step that would build files for all targets, which would be a lot faster since we don't have to wait for Travis VM/container to initialize.
Also, there's now a huge amount of duplication in the make file, I think it could be simplified a lot through variables, similar to the deploy.sh file, e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact, DEPLOY=true doesn't even need to be a new matrix entry, we can co-locate it with the DOCKER=true entry (since it requires linux binaries anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the input @yurishkuro! I'll have time closer to the middle of this week to make these changes.