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

Normalize build-binaries targets #5924

Merged
merged 6 commits into from
Sep 3, 2024
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
41 changes: 17 additions & 24 deletions .github/workflows/ci-build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,25 @@ permissions:
contents: read

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: define matrix
id: set-matrix
run: |
echo "matrix=$(bash scripts/platforms-to-gh-matrix.sh)" >> $GITHUB_OUTPUT

build-binaries:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- name: linux
task: build-binaries-linux
- name: windows
task: build-binaries-windows
- name: osx
task: build-binaries-darwin
- name: osx-m1
task: build-binaries-darwin-arm64
- name: system/390
task: build-binaries-s390x
- name: arm
task: build-binaries-arm64
- name: powerpc
task: build-binaries-ppc64le
name: build binaries for ${{ matrix.platform.name }}
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: build-binaries-${{ matrix.os }}-${{ matrix.arch }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
- uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

Expand All @@ -57,11 +53,8 @@ jobs:
- name: Setup Node.js version
uses: ./.github/actions/setup-node.js

- name: Export BRANCH variable
uses: ./.github/actions/setup-branch

- name: Install tools
run: make install-ci

- name: Build binaries
run: make ${{ matrix.platform.task }}
- name: Build platform binaries
run: make build-binaries-${{ matrix.os }}-${{ matrix.arch }}
52 changes: 25 additions & 27 deletions Makefile.BuildBinaries.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Copyright (c) 2023 The Jaeger Authors.
# SPDX-License-Identifier: Apache-2.0

GOBUILD=CGO_ENABLED=0 installsuffix=cgo $(GO) build -trimpath
# This command expects $GOOS/$GOARCH env variables set to reflect the desired target platform.
GOBUILD=echo "building for $$(go env GOOS)-$$(go env GOARCH)"; \
CGO_ENABLED=0 installsuffix=cgo $(GO) build -trimpath

ifeq ($(DEBUG_BINARY),)
DISABLE_OPTIMIZATIONS =
Expand Down Expand Up @@ -29,13 +31,11 @@ jaeger-ui/packages/jaeger-ui/build/index.html:

.PHONY: rebuild-ui
rebuild-ui:
@echo "::group::rebuild-ui logs"
bash ./scripts/rebuild-ui.sh
@echo "NOTE: This target only rebuilds the UI assets inside jaeger-ui/packages/jaeger-ui/build/."
@echo "NOTE: To make them usable from query-service run 'make build-ui'."

.PHONY: build-all-in-one-linux
build-all-in-one-linux:
GOOS=linux $(MAKE) build-all-in-one
@echo "::endgroup::"

.PHONY: build-examples
build-examples:
Expand Down Expand Up @@ -101,38 +101,35 @@ build-ingester: _build-a-binary-ingester$(SUFFIX)-$(GOOS)-$(GOARCH)
build-remote-storage: BIN_NAME = remote-storage
build-remote-storage: _build-a-binary-remote-storage$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-binaries-linux
build-binaries-linux: build-binaries-amd64

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

# helper targets defined in Makefile.Windows.mk
.PHONY: build-binaries-windows
build-binaries-windows:
# helper sysp targets are defined in Makefile.Windows.mk
.PHONY: build-binaries-windows-amd64
build-binaries-windows-amd64:
$(MAKE) _build-syso
GOOS=windows GOARCH=amd64 $(MAKE) _build-platform-binaries
$(MAKE) _clean-syso

.PHONY: build-binaries-darwin
build-binaries-darwin:
.PHONY: build-binaries-darwin-amd64
build-binaries-darwin-amd64:
GOOS=darwin GOARCH=amd64 $(MAKE) _build-platform-binaries

.PHONY: build-binaries-darwin-arm64
build-binaries-darwin-arm64:
GOOS=darwin GOARCH=arm64 $(MAKE) _build-platform-binaries

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

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

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

# build all binaries for one specific platform GOOS/GOARCH
Expand All @@ -156,6 +153,7 @@ _build-platform-binaries: \

# build binaries that support DEBUG release, for one specific platform GOOS/GOARCH
.PHONY: _build-platform-binaries-debug
_build-platform-binaries-debug:
_build-platform-binaries-debug: \
build-agent \
build-collector \
Expand All @@ -167,10 +165,10 @@ _build-platform-binaries-debug: \

.PHONY: build-all-platforms
build-all-platforms: \
build-binaries-linux \
build-binaries-windows \
build-binaries-darwin \
build-binaries-linux-amd64 \
build-binaries-windows-amd64 \
build-binaries-darwin-amd64 \
build-binaries-darwin-arm64 \
build-binaries-s390x \
build-binaries-arm64 \
build-binaries-ppc64le
build-binaries-linux-s390x \
build-binaries-linux-arm64 \
build-binaries-linux-ppc64le
6 changes: 3 additions & 3 deletions Makefile.Crossdock.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ build-crossdock-ui-placeholder:
$(MAKE) build-ui

.PHONY: build-crossdock
build-crossdock: build-crossdock-ui-placeholder build-binaries-linux build-crossdock-linux docker-images-cassandra crossdock-docker-images-jaeger-backend
build-crossdock: build-crossdock-ui-placeholder build-binaries-linux-$(GOARCH) build-crossdock-binary docker-images-cassandra crossdock-docker-images-jaeger-backend
docker build -t $(DOCKER_NAMESPACE)/test-driver:${DOCKER_TAG} --build-arg TARGETARCH=$(GOARCH) crossdock/
@echo "Finished building test-driver ==============" ; \

Expand All @@ -28,11 +28,11 @@ build-and-run-crossdock: build-crossdock
make crossdock

.PHONY: build-crossdock-fresh
build-crossdock-fresh: build-crossdock-linux
build-crossdock-fresh: build-crossdock-binary
make crossdock-fresh

.PHONY: crossdock-docker-images-jaeger-backend
crossdock-docker-images-jaeger-backend: PLATFORMS=linux/$(shell go env GOARCH)
crossdock-docker-images-jaeger-backend: PLATFORMS=linux/$(GOARCH)
crossdock-docker-images-jaeger-backend: create-baseimg create-fake-debugimg
for component in "jaeger-agent" "jaeger-collector" "jaeger-query" "jaeger-ingester" "all-in-one" ; do \
regex="jaeger-(.*)"; \
Expand Down
1 change: 0 additions & 1 deletion scripts/build-all-in-one-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ run_integration_test() {

# Loop through each platform (separated by commas)
for platform in $(echo "$platforms" | tr ',' ' '); do
# Extract the architecture from the platform string
arch=${platform##*/} # Remove everything before the last slash
make "build-${BINARY}" GOOS=linux GOARCH="${arch}"
done
Expand Down
3 changes: 1 addition & 2 deletions scripts/build-upload-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ set -x

# Loop through each platform (separated by commas)
for platform in $(echo "$platforms" | tr ',' ' '); do
# Extract the architecture from the platform string
arch=${platform##*/} # Remove everything before the last slash
make "build-binaries-$arch"
make "build-binaries-linux-${arch}"
done

if [[ "${add_debugger}" == "N" ]]; then
Expand Down
1 change: 0 additions & 1 deletion scripts/cassandra-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ check_arg() {
setup_cassandra() {
local compose_file=$1
docker compose -f "$compose_file" up -d
echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}"
}

dump_logs() {
Expand Down
1 change: 0 additions & 1 deletion scripts/es-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ check_arg() {
setup_db() {
local compose_file=$1
docker compose -f "${compose_file}" up -d
echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}"
}

# check if the storage is up and running
Expand Down
2 changes: 0 additions & 2 deletions scripts/kafka-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
set -euf -o pipefail

compose_file="docker-compose/kafka-integration-test/docker-compose.yml"
echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}"

jaeger_version=""
manage_kafka="true"
success="false"
Expand Down
2 changes: 1 addition & 1 deletion scripts/package-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ mkdir deploy

# Loop through each platform (separated by commas)
for platform in $(echo "$platforms" | tr ',' ' '); do
os="${platform%%/*}" # Remove everything after the slash
os=${platform%%/*} # Remove everything after the slash
arch=${platform##*/} # Remove everything before the last slash
if [[ "$os" == "windows" ]]; then
package tar "${os}-${arch}" .exe
Expand Down
21 changes: 21 additions & 0 deletions scripts/platforms-to-gh-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#
# Copyright (c) 2024 The Jaeger Authors.
# SPDX-License-Identifier: Apache-2.0

set -euf -o pipefail

echo -n '{ "include": [ '
first="true"
for pair in $(make echo-platforms | tr ',' ' '); do
os=$(echo "$pair" | cut -d '/' -f 1)
arch=$(echo "$pair" | cut -d '/' -f 2)
if [[ "$first" == "true" ]]; then
first="false"
else
echo -n ' ,'
fi
echo -n "{ \"os\": \"$os\", \"arch\": \"$arch\" }"
done

echo "]}"
Loading