diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ce7fe4dcc..1aae2b33932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Changes by Version ### Backend Changes #### Breaking Changes +* Add arm64 support for binaries and docker images. Rename the released binary name format to --, tarball name format to jaeger--- ([#2176](https://github.com/jaegertracing/jaeger/pull/2176), [@MrXinWang](https://github.com/MrXinWang)) #### New Features diff --git a/Makefile b/Makefile index 9b41be1b9e0..710c286c38c 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ ifeq ($(UNAME), s390x) else RACE=-race endif +GOARCH ?= $(shell go env GOARCH) GOBUILD=CGO_ENABLED=0 installsuffix=cgo go build -trimpath GOTEST=go test -v $(RACE) GOLINT=golint @@ -195,20 +196,16 @@ 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) $(GOBUILD) -o ./examples/hotrod/hotrod-$(GOOS)-$(GOARCH) ./examples/hotrod/main.go -else - $(GOBUILD) -o ./examples/hotrod/hotrod-$(GOOS) ./examples/hotrod/main.go -endif .PHONY: build-tracegen build-tracegen: - $(GOBUILD) -o ./cmd/tracegen/tracegen-$(GOOS) ./cmd/tracegen/main.go + $(GOBUILD) -o ./cmd/tracegen/tracegen-$(GOOS)-$(GOARCH) ./cmd/tracegen/main.go .PHONE: docker-hotrod docker-hotrod: GOOS=linux $(MAKE) build-examples - docker build -t $(DOCKER_NAMESPACE)/example-hotrod:${DOCKER_TAG} ./examples/hotrod + docker build -t $(DOCKER_NAMESPACE)/example-hotrod:${DOCKER_TAG} ./examples/hotrod --build-arg ARCH=$(GOARCH) .PHONY: run-all-in-one run-all-in-one: @@ -226,92 +223,64 @@ build-all-in-one-linux: build-ui .PHONY: build-all-in-one build-all-in-one: elasticsearch-mappings -ifeq ($(GOARCH), s390x) $(GOBUILD) -tags ui -o ./cmd/all-in-one/all-in-one-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/all-in-one/main.go -else - $(GOBUILD) -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) $(GOBUILD) -o ./cmd/agent/agent-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/agent/main.go -else - $(GOBUILD) -o ./cmd/agent/agent-$(GOOS) $(BUILD_INFO) ./cmd/agent/main.go -endif .PHONY: build-query build-query: -ifeq ($(GOARCH), s390x) $(GOBUILD) -tags ui -o ./cmd/query/query-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/query/main.go -else - $(GOBUILD) -tags ui -o ./cmd/query/query-$(GOOS) $(BUILD_INFO) ./cmd/query/main.go -endif .PHONY: build-collector build-collector: elasticsearch-mappings -ifeq ($(GOARCH), s390x) $(GOBUILD) -o ./cmd/collector/collector-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/collector/main.go -else - $(GOBUILD) -o ./cmd/collector/collector-$(GOOS) $(BUILD_INFO) ./cmd/collector/main.go -endif .PHONY: build-otel-collector build-otel-collector: elasticsearch-mappings -ifeq ($(GOARCH), s390x) cd ${OTEL_COLLECTOR_DIR}/cmd/collector && $(GOBUILD) -o ./opentelemetry-collector-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go -else - cd ${OTEL_COLLECTOR_DIR}/cmd/collector && $(GOBUILD) -o ./opentelemetry-collector-$(GOOS) $(BUILD_INFO) main.go -endif .PHONY: build-otel-agent build-otel-agent: -ifeq ($(GOARCH), s390x) cd ${OTEL_COLLECTOR_DIR}/cmd/agent && $(GOBUILD) -o ./opentelemetry-agent-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go -else - cd ${OTEL_COLLECTOR_DIR}/cmd/agent && $(GOBUILD) -o ./opentelemetry-agent-$(GOOS) $(BUILD_INFO) main.go -endif .PHONY: build-otel-ingester build-otel-ingester: -ifeq ($(GOARCH), s390x) cd ${OTEL_COLLECTOR_DIR}/cmd/ingester && $(GOBUILD) -o ./opentelemetry-ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) main.go -else - cd ${OTEL_COLLECTOR_DIR}/cmd/ingester && $(GOBUILD) -o ./opentelemetry-ingester-$(GOOS) $(BUILD_INFO) main.go -endif .PHONY: build-ingester build-ingester: -ifeq ($(GOARCH), s390x) $(GOBUILD) -o ./cmd/ingester/ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/ingester/main.go -else - $(GOBUILD) -o ./cmd/ingester/ingester-$(GOOS) $(BUILD_INFO) ./cmd/ingester/main.go -endif .PHONY: docker docker: build-ui build-binaries-linux docker-images-only .PHONY: build-binaries-linux build-binaries-linux: - GOOS=linux $(MAKE) build-platform-binaries + GOOS=linux GOARCH=amd64 $(MAKE) build-platform-binaries .PHONY: build-binaries-windows build-binaries-windows: - GOOS=windows $(MAKE) build-platform-binaries + GOOS=windows GOARCH=amd64 $(MAKE) build-platform-binaries .PHONY: build-binaries-darwin build-binaries-darwin: - GOOS=darwin $(MAKE) build-platform-binaries + GOOS=darwin GOARCH=amd64 $(MAKE) build-platform-binaries .PHONY: build-binaries-s390x build-binaries-s390x: GOOS=linux GOARCH=s390x $(MAKE) build-platform-binaries +.PHONY: build-binaries-arm64 +build-binaries-arm64: + GOOS=linux GOARCH=arm64 $(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 build-tracegen build-otel-collector build-otel-agent build-otel-ingester .PHONY: build-all-platforms -build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x +build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x build-binaries-arm64 .PHONY: docker-images-cassandra docker-images-cassandra: @@ -327,16 +296,16 @@ docker-images-elastic: .PHONY: docker-images-jaeger-backend docker-images-jaeger-backend: for component in agent collector query ingester ; do \ - docker build -t $(DOCKER_NAMESPACE)/jaeger-$$component:${DOCKER_TAG} cmd/$$component ; \ + docker build -t $(DOCKER_NAMESPACE)/jaeger-$$component:${DOCKER_TAG} cmd/$$component --build-arg ARCH=$(GOARCH) ; \ echo "Finished building $$component ==============" ; \ done - docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-collector:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/collector/Dockerfile cmd/opentelemetry-collector/cmd/collector - docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-agent:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/agent/Dockerfile cmd/opentelemetry-collector/cmd/agent - docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-ingester:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/ingester/Dockerfile cmd/opentelemetry-collector/cmd/ingester + docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-collector:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/collector/Dockerfile cmd/opentelemetry-collector/cmd/collector --build-arg ARCH=$(GOARCH) + docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-agent:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/agent/Dockerfile cmd/opentelemetry-collector/cmd/agent --build-arg ARCH=$(GOARCH) + docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-ingester:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/ingester/Dockerfile cmd/opentelemetry-collector/cmd/ingester --build-arg ARCH=$(GOARCH) .PHONY: docker-images-tracegen docker-images-tracegen: - docker build -t $(DOCKER_NAMESPACE)/jaeger-tracegen:${DOCKER_TAG} cmd/tracegen/ + docker build -t $(DOCKER_NAMESPACE)/jaeger-tracegen:${DOCKER_TAG} cmd/tracegen/ --build-arg ARCH=$(GOARCH) @echo "Finished building jaeger-tracegen ==============" .PHONY: docker-images-only diff --git a/cmd/agent/Dockerfile b/cmd/agent/Dockerfile index 25807f48ab9..67191752dc9 100644 --- a/cmd/agent/Dockerfile +++ b/cmd/agent/Dockerfile @@ -2,9 +2,9 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch - +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt EXPOSE 5775/udp 6831/udp 6832/udp 5778 -COPY agent-linux /go/bin/ +COPY agent-linux-$ARCH /go/bin/agent-linux ENTRYPOINT ["/go/bin/agent-linux"] diff --git a/cmd/all-in-one/Dockerfile b/cmd/all-in-one/Dockerfile index 15bcc2b8161..f2c0848e974 100644 --- a/cmd/all-in-one/Dockerfile +++ b/cmd/all-in-one/Dockerfile @@ -2,6 +2,7 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt @@ -26,7 +27,7 @@ EXPOSE 14250 # Web HTTP EXPOSE 16686 -COPY all-in-one-linux /go/bin/ +COPY all-in-one-linux-$ARCH /go/bin/all-in-one-linux COPY sampling_strategies.json /etc/jaeger/ VOLUME ["/tmp"] diff --git a/cmd/collector/Dockerfile b/cmd/collector/Dockerfile index e95b1e903b4..8e8668b6ecb 100644 --- a/cmd/collector/Dockerfile +++ b/cmd/collector/Dockerfile @@ -2,9 +2,9 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch - +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt EXPOSE 14250 -COPY collector-linux /go/bin/ +COPY collector-linux-$ARCH /go/bin/collector-linux ENTRYPOINT ["/go/bin/collector-linux"] diff --git a/cmd/ingester/Dockerfile b/cmd/ingester/Dockerfile index 7e7302bbd7a..0d8344d31bf 100644 --- a/cmd/ingester/Dockerfile +++ b/cmd/ingester/Dockerfile @@ -2,10 +2,10 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch - +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt EXPOSE 14270 EXPOSE 14271 -COPY ingester-linux /go/bin/ +COPY ingester-linux-$ARCH /go/bin/ingester-linux ENTRYPOINT ["/go/bin/ingester-linux"] diff --git a/cmd/opentelemetry-collector/cmd/agent/Dockerfile b/cmd/opentelemetry-collector/cmd/agent/Dockerfile index 58752e82bad..4beb4f356d5 100644 --- a/cmd/opentelemetry-collector/cmd/agent/Dockerfile +++ b/cmd/opentelemetry-collector/cmd/agent/Dockerfile @@ -2,7 +2,9 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch +ARG ARCH=amd64 + COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY opentelemetry-agent-linux /go/bin/ +COPY opentelemetry-agent-linux-$ARCH /go/bin/opentelemetry-agent-linux ENTRYPOINT ["/go/bin/opentelemetry-agent-linux"] diff --git a/cmd/opentelemetry-collector/cmd/collector/Dockerfile b/cmd/opentelemetry-collector/cmd/collector/Dockerfile index 3609a3cd107..63546cad0dc 100644 --- a/cmd/opentelemetry-collector/cmd/collector/Dockerfile +++ b/cmd/opentelemetry-collector/cmd/collector/Dockerfile @@ -2,7 +2,8 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY opentelemetry-collector-linux /go/bin/ +COPY opentelemetry-collector-linux-$ARCH /go/bin/opentelemetry-collector-linux ENTRYPOINT ["/go/bin/opentelemetry-collector-linux"] diff --git a/cmd/opentelemetry-collector/cmd/ingester/Dockerfile b/cmd/opentelemetry-collector/cmd/ingester/Dockerfile index 816fa72350d..bd509b07d3f 100644 --- a/cmd/opentelemetry-collector/cmd/ingester/Dockerfile +++ b/cmd/opentelemetry-collector/cmd/ingester/Dockerfile @@ -2,7 +2,9 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch +ARG ARCH=amd64 + COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY opentelemetry-ingester-linux /go/bin/ +COPY opentelemetry-ingester-linux-$ARCH /go/bin/opentelemetry-ingester-linux ENTRYPOINT ["/go/bin/opentelemetry-ingester-linux"] diff --git a/cmd/query/Dockerfile b/cmd/query/Dockerfile index 80bcdf30da9..0864e16e4bd 100644 --- a/cmd/query/Dockerfile +++ b/cmd/query/Dockerfile @@ -2,10 +2,11 @@ FROM alpine:latest as certs RUN apk add --update --no-cache ca-certificates FROM scratch +ARG ARCH=amd64 COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt EXPOSE 16686 -COPY query-linux /go/bin/ +COPY query-linux-$ARCH /go/bin/query-linux ENTRYPOINT ["/go/bin/query-linux"] diff --git a/cmd/tracegen/Dockerfile b/cmd/tracegen/Dockerfile index 49d14e42594..25b679cff82 100644 --- a/cmd/tracegen/Dockerfile +++ b/cmd/tracegen/Dockerfile @@ -1,4 +1,5 @@ FROM scratch +ARG ARCH=amd64 -COPY tracegen-linux /go/bin/ +COPY tracegen-linux-$ARCH /go/bin/tracegen-linux ENTRYPOINT ["/go/bin/tracegen-linux"] diff --git a/examples/hotrod/Dockerfile b/examples/hotrod/Dockerfile index efdb61d2a80..cde6b548588 100644 --- a/examples/hotrod/Dockerfile +++ b/examples/hotrod/Dockerfile @@ -1,5 +1,6 @@ FROM scratch +ARG ARCH=amd64 EXPOSE 8080 8081 8082 8083 -COPY hotrod-linux /go/bin/ +COPY hotrod-linux-$ARCH /go/bin/hotrod-linux ENTRYPOINT ["/go/bin/hotrod-linux"] CMD ["all"] diff --git a/scripts/travis/build-all-in-one-image.sh b/scripts/travis/build-all-in-one-image.sh index d78f18672a2..f9a60fb476a 100755 --- a/scripts/travis/build-all-in-one-image.sh +++ b/scripts/travis/build-all-in-one-image.sh @@ -3,6 +3,10 @@ set -e BRANCH=${BRANCH:?'missing BRANCH env var'} +# Set default GOARCH variable to the host GOARCH, the target architecture can +# be overrided by passing architecture value to the script: +# `GOARCH= ./scripts/travis/build-all-in-one-image.sh`. +GOARCH=${GOARCH:-$(go env GOARCH)} source ~/.nvm/nvm.sh nvm use 10 @@ -10,10 +14,10 @@ make build-ui set -x -make build-all-in-one GOOS=linux +make build-all-in-one GOOS=linux GOARCH=$GOARCH export REPO=jaegertracing/all-in-one -docker build -f cmd/all-in-one/Dockerfile -t $REPO:latest cmd/all-in-one +docker build -f cmd/all-in-one/Dockerfile -t $REPO:latest cmd/all-in-one --build-arg ARCH=$GOARCH export CID=$(docker run -d -p 16686:16686 -p 5778:5778 $REPO:latest) set +e diff --git a/scripts/travis/es-integration-test.sh b/scripts/travis/es-integration-test.sh index 4e1f5ac28f6..63a8d5ee841 100755 --- a/scripts/travis/es-integration-test.sh +++ b/scripts/travis/es-integration-test.sh @@ -2,6 +2,8 @@ set -e +GOARCH=$(go env GOARCH) + run_integration_test() { ES_VERSION=$1 docker pull docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION} @@ -22,7 +24,7 @@ make build-crossdock-ui-placeholder GOOS=linux make build-query make test-compile-es-scripts -SPAN_STORAGE_TYPE=elasticsearch ./cmd/query/query-linux --es.server-urls=http://127.0.0.1:9200 --es.tls=false --es.version=7 --query.bearer-token-propagation=true & +SPAN_STORAGE_TYPE=elasticsearch ./cmd/query/query-linux-$GOARCH --es.server-urls=http://127.0.0.1:9200 --es.tls=false --es.version=7 --query.bearer-token-propagation=true & PID=$(echo $!) make token-propagation-integration-test kill -9 ${PID} diff --git a/scripts/travis/package-deploy.sh b/scripts/travis/package-deploy.sh index 364449b180b..03653ce061a 100755 --- a/scripts/travis/package-deploy.sh +++ b/scripts/travis/package-deploy.sh @@ -34,11 +34,7 @@ function package { local PLATFORM=$1 local FILE_EXTENSION=$2 # script start - if [ "$PLATFORM" == "linux-s390x" ]; then - local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM - else - local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM-amd64 - fi + local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM mkdir $PACKAGE_STAGING_DIR @@ -67,7 +63,8 @@ rm -rf deploy $DEPLOY_STAGING_DIR mkdir deploy mkdir $DEPLOY_STAGING_DIR -package linux -package darwin -package windows .exe +package linux-amd64 +package darwin-amd64 +package windows-amd64 .exe package linux-s390x +package linux-arm64