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

Build binaries for Linux on IBM Z / s390x architecture #1982

Merged
merged 3 commits into from
Jan 13, 2020
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
39 changes: 36 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ ALL_SRC := $(shell find . -name '*.go' \

# ALL_PKGS is used with 'go cover' and 'golint'
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))

RACE=-race
UNAME := $(shell uname -m)
#Race flag is not supported on s390x architecture
ifeq ($(UNAME), s390x)
RACE=
else
RACE=-race
endif
GOTEST=go test -v $(RACE)
GOLINT=golint
GOVET=go vet
Expand Down Expand Up @@ -190,7 +195,11 @@ elasticsearch-mappings:
.PHONY: build-examples
build-examples:
esc -pkg frontend -o examples/hotrod/services/frontend/gen_assets.go -prefix examples/hotrod/services/frontend/web_assets examples/hotrod/services/frontend/web_assets
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -o ./examples/hotrod/hotrod-$(GOOS)-$(GOARCH) ./examples/hotrod/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -o ./examples/hotrod/hotrod-$(GOOS) ./examples/hotrod/main.go
endif

.PHONE: docker-hotrod
docker-hotrod:
Expand All @@ -209,23 +218,43 @@ build-all-in-one-linux: build-ui

.PHONY: build-all-in-one
build-all-in-one: elasticsearch-mappings
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -tags ui -o ./cmd/all-in-one/all-in-one-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/all-in-one/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -tags ui -o ./cmd/all-in-one/all-in-one-$(GOOS) $(BUILD_INFO) ./cmd/all-in-one/main.go
endif

.PHONY: build-agent
build-agent:
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/agent/agent-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/agent/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/agent/agent-$(GOOS) $(BUILD_INFO) ./cmd/agent/main.go
endif

.PHONY: build-query
build-query:
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -tags ui -o ./cmd/query/query-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/query/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -tags ui -o ./cmd/query/query-$(GOOS) $(BUILD_INFO) ./cmd/query/main.go
endif

.PHONY: build-collector
build-collector: elasticsearch-mappings
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/collector/collector-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/collector/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/collector/collector-$(GOOS) $(BUILD_INFO) ./cmd/collector/main.go
endif

.PHONY: build-ingester
build-ingester:
ifeq ($(GOARCH), s390x)
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/ingester/ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/ingester/main.go
else
CGO_ENABLED=0 installsuffix=cgo go build -o ./cmd/ingester/ingester-$(GOOS) $(BUILD_INFO) ./cmd/ingester/main.go
endif

.PHONY: docker
docker: build-ui build-binaries-linux docker-images-only
Expand All @@ -242,11 +271,15 @@ build-binaries-windows:
build-binaries-darwin:
GOOS=darwin $(MAKE) build-platform-binaries

.PHONY: build-binaries-s390x
build-binaries-s390x:
GOOS=linux GOARCH=s390x $(MAKE) build-platform-binaries

.PHONY: build-platform-binaries
build-platform-binaries: build-agent build-collector build-query build-ingester build-all-in-one build-examples

.PHONY: build-all-platforms
build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin
build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x

.PHONY: docker-images-cassandra
docker-images-cassandra:
Expand Down
4 changes: 2 additions & 2 deletions plugin/storage/badger/stats_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func (f *Factory) diskStatisticsUpdate() error {
_ = unix.Statfs(f.Options.GetPrimary().ValueDirectory, &valDirStatfs)

// Using Bavail instead of Bfree to get non-priviledged user space available
f.metrics.ValueLogSpaceAvailable.Update(int64(valDirStatfs.Bavail) * valDirStatfs.Bsize)
f.metrics.KeyLogSpaceAvailable.Update(int64(keyDirStatfs.Bavail) * keyDirStatfs.Bsize)
f.metrics.ValueLogSpaceAvailable.Update(int64(valDirStatfs.Bavail) * int64(valDirStatfs.Bsize))
f.metrics.KeyLogSpaceAvailable.Update(int64(keyDirStatfs.Bavail) * int64(keyDirStatfs.Bsize))

/*
TODO If we wanted to clean up oldest data to free up diskspace, we need at a minimum an index to the StartTime
Expand Down
9 changes: 7 additions & 2 deletions scripts/cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ for pkg in "$@"; do
args="-coverprofile $COVER/cover.${i}.out" # -coverpkg $coverpkg
fi

echo go test $args -v -race "$pkg"
go test $args -v -race "$pkg"
if [[ $(uname -m) == 's390x' ]]; then
echo go test $args -v "$pkg"
go test $args -v "$pkg"
else
echo go test $args -v -race "$pkg"
go test $args -v -race "$pkg"
fi
done

gocovmerge "$COVER"/*.out > cover.out
10 changes: 8 additions & 2 deletions scripts/travis/package-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ function stage-platform-files {
function package {
local PLATFORM=$1
local FILE_EXTENSION=$2

local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM-amd64
# script start
if [ "$PLATFORM" == "linux-s390x" ]; then
local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM
else
local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM-amd64
fi

mkdir $PACKAGE_STAGING_DIR

stage-platform-files $PLATFORM $PACKAGE_STAGING_DIR $FILE_EXTENSION
Expand Down Expand Up @@ -64,3 +69,4 @@ mkdir $DEPLOY_STAGING_DIR
package linux
package darwin
package windows .exe
package linux-s390x