Skip to content
Open
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
5 changes: 1 addition & 4 deletions .github/workflows/ci-docker-hotrod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ jobs:
fail-fast: false
matrix:
runtime: [docker, k8s]
jaeger-version: [v1, v2]
exclude:
- runtime: k8s
jaeger-version: v1
jaeger-version: [v2]

steps:
- uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci-e2e-spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
fail-fast: false
matrix:
mode:
- name: v1
binary: all-in-one
metricstore: prometheus
- name: v2
binary: jaeger
metricstore: prometheus
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-lint-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
go-version: 1.25.x

- name: Print Jaeger version for no reason
run: make echo-v1 echo-v2
run: make echo-version

- run: make install-test-tools

Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,10 @@ jobs:
# Many scripts depend on BRANCH variable. We do not want to
# use ./.github/actions/setup-branch here because it may set
# BRANCH=main when the workflow is triggered manually.
#
# TODO this currently utilizes 1.x version tag, which is ok for v1
# binaries, but for tools/utils we may need to change in the future.
run: |
BRANCH=$(make echo-v1)
BRANCH=$(make echo-version)
echo Validate that the latest tag ${BRANCH} is in semver format
echo ${BRANCH} | grep -E '^v[0-9]+.[0-9]+.[0-9]+$'
echo ${BRANCH} | grep -E '^v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern has unescaped dots which will match any character instead of literal dots. This will incorrectly validate malformed version strings like v2a0b0 as valid semver.

Fix:

echo ${BRANCH} | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'

The dots need to be escaped as \. to match literal dot characters in version strings.

Suggested change
echo ${BRANCH} | grep -E '^v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?$'
echo ${BRANCH} | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV}

- name: Configure GPG Key
Expand Down Expand Up @@ -139,22 +136,10 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}

- name: Build, test, and publish all-in-one v1 image
run: |
BRANCH=$(make echo-v1) \
bash scripts/build/build-all-in-one-image.sh \
${{ steps.params.outputs.docker_flags }} \
v1
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}

- name: Build, test, and publish v2 image
- name: Build, test, and publish jaeger image
run: |
BRANCH=$(make echo-v2) \
bash scripts/build/build-all-in-one-image.sh \
${{ steps.params.outputs.docker_flags }} \
v2
${{ steps.params.outputs.docker_flags }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
Expand Down Expand Up @@ -182,6 +167,5 @@ jobs:
with:
file: jaeger-SBOM.spdx.json
overwrite: ${{ inputs.overwrite }}
# TODO this will only work for 1.x artifacts
tag: ${{ env.BRANCH }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,9 @@ include scripts/makefiles/Windows.mk
.PHONY: test-and-lint
test-and-lint: test fmt lint

.PHONY: echo-v1
echo-v1:
@echo "$(GIT_CLOSEST_TAG_V1)"

.PHONY: echo-v2
echo-v2:
@echo "$(GIT_CLOSEST_TAG_V2)"
.PHONY: echo-version
echo-version:
@echo "$(GIT_CLOSEST_TAG)"

.PHONY: echo-platforms
echo-platforms:
Expand Down
27 changes: 5 additions & 22 deletions scripts/build/build-all-in-one-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
set -euf -o pipefail

print_help() {
echo "Usage: $0 [-b binary] [-D] [-h] [-l] [-o] [-p platforms] <jaeger_version>"
echo "Usage: $0 [-D] [-h] [-l] [-o] [-p platforms]"
echo " -D: Disable building of images with debugger"
echo " -h: Print help"
echo " -l: Enable local-only mode that only pushes images to local registry"
echo " -o: overwrite image in the target remote repository even if the semver tag already exists"
echo " -p: Comma-separated list of platforms to build for (default: all supported)"
echo " jaeger_version: major version, v1 | v2"
exit 1
}

add_debugger='Y'
platforms="$(make echo-linux-platforms)"
FLAGS=()
BINARY="jaeger"

# this script doesn't use BRANCH and GITHUB_SHA itself, but its dependency scripts do.
export BRANCH=${BRANCH?'env var is required'}
Expand Down Expand Up @@ -48,26 +48,9 @@ done
# remove flags, leave only positional args
shift $((OPTIND - 1))

if [[ $# -eq 0 ]]; then
echo "Jaeger major version is required as argument"
print_help
fi

case $1 in
v1)
BINARY='all-in-one'
sampling_port=14268
export HEALTHCHECK_V2=false
;;
v2)
BINARY='jaeger'
sampling_port=5778
export HEALTHCHECK_V2=true
;;
*)
echo "Jaeger major version is required as argument"
print_help
esac
# Only build the jaeger binary
sampling_port=5778
export HEALTHCHECK_V2=true

set -x

Expand Down
49 changes: 33 additions & 16 deletions scripts/build/build-upload-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,39 @@ if [[ "${add_debugger}" == "N" ]]; then
fi
make "$baseimg_target" LINUX_PLATFORMS="$platforms"

# build/upload raw and debug images of Jaeger backend components
for component in collector query ingester remote-storage
do
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c "jaeger-${component}" -d "cmd/${component}" -p "${platforms}" -t release
# do not need debug image built for PRs
if [[ "${add_debugger}" == "Y" ]]; then
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c "jaeger-${component}-debug" -d "cmd/${component}" -t debug
# Helper function to build and upload docker images
# Args: component_name, source_dir, [use_base_image], [build_debug]
build_image() {
local component=$1
local dir=$2
local use_base_image=${3:-false}
local build_debug=${4:-false}

local base_flags=()
if [[ "$use_base_image" == "true" ]]; then
base_flags=(-b)
fi
done

bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c jaeger-es-index-cleaner -d cmd/es-index-cleaner -p "${platforms}" -t release
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -b -c jaeger-es-rollover -d cmd/es-rollover -p "${platforms}" -t release
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -c jaeger-cassandra-schema -d internal/storage/v1/cassandra/ -p "${platforms}"
local target_flags=()
if [[ "$use_base_image" == "true" ]]; then
target_flags=(-t release)
fi

# build/upload images for jaeger-tracegen and jaeger-anonymizer
for component in tracegen anonymizer
do
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" -c "jaeger-${component}" -d "cmd/${component}" -p "${platforms}"
done
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" "${base_flags[@]}" -c "$component" -d "$dir" -p "${platforms}" "${target_flags[@]}"

if [[ "$build_debug" == "true" ]] && [[ "${add_debugger}" == "Y" ]]; then
bash scripts/build/build-upload-a-docker-image.sh "${FLAGS[@]}" "${base_flags[@]}" -c "${component}-debug" -d "$dir" -t debug
fi
}

# Build images with special handling for debug images
build_image jaeger-remote-storage cmd/remote-storage true true

# Build utility images
build_image jaeger-es-index-cleaner cmd/es-index-cleaner true false
build_image jaeger-es-rollover cmd/es-rollover true false
build_image jaeger-cassandra-schema internal/storage/v1/cassandra/ false false

# Build tool images
build_image jaeger-tracegen cmd/tracegen false false
build_image jaeger-anonymizer cmd/anonymizer false false
37 changes: 11 additions & 26 deletions scripts/build/package-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,11 @@ while getopts "hk:p:" opt; do
esac
done

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

cp "./cmd/all-in-one/all-in-one-${PLATFORM}" "${PACKAGE_STAGING_DIR}/jaeger-all-in-one${FILE_EXTENSION}"
cp "./cmd/query/query-${PLATFORM}" "${PACKAGE_STAGING_DIR}/jaeger-query${FILE_EXTENSION}"
cp "./cmd/collector/collector-${PLATFORM}" "${PACKAGE_STAGING_DIR}/jaeger-collector${FILE_EXTENSION}"
cp "./cmd/ingester/ingester-${PLATFORM}" "${PACKAGE_STAGING_DIR}/jaeger-ingester${FILE_EXTENSION}"
cp "./examples/hotrod/hotrod-${PLATFORM}" "${PACKAGE_STAGING_DIR}/example-hotrod${FILE_EXTENSION}"
}
# copying the source files

function stage-platform-files-v2 {
function stage-platform-files {
local -r PLATFORM=$1
local -r PACKAGE_STAGING_DIR=$2
local -r FILE_EXTENSION=${3:-}
Expand Down Expand Up @@ -76,21 +65,19 @@ function package {
local -r COMPRESSION=$1
local -r PLATFORM=$2
local -r FILE_EXTENSION=${3:-}
local -r PACKAGE_NAME_V1=jaeger-${VERSION_V1}-$PLATFORM
local -r PACKAGE_NAME_V2=jaeger-${VERSION_V2}-$PLATFORM
local -r TOOLS_PACKAGE_NAME=jaeger-tools-${VERSION_V1}-$PLATFORM
local -r PACKAGE_NAME=jaeger-${VERSION}-$PLATFORM
local -r TOOLS_PACKAGE_NAME=jaeger-tools-${VERSION}-$PLATFORM

echo "Packaging binaries for $PLATFORM"

PACKAGES=("$PACKAGE_NAME_V1" "$PACKAGE_NAME_V2" "$TOOLS_PACKAGE_NAME")
PACKAGES=("$PACKAGE_NAME" "$TOOLS_PACKAGE_NAME")
for d in "${PACKAGES[@]}"; do
if [ -d "$d" ]; then
rm -vrf "$d"
fi
mkdir "$d"
done
stage-platform-files-v1 "$PLATFORM" "$PACKAGE_NAME_V1" "$FILE_EXTENSION"
stage-platform-files-v2 "$PLATFORM" "$PACKAGE_NAME_V2" "$FILE_EXTENSION"
stage-platform-files "$PLATFORM" "$PACKAGE_NAME" "$FILE_EXTENSION"
stage-tool-platform-files "$PLATFORM" "$TOOLS_PACKAGE_NAME" "$FILE_EXTENSION"
# Create a checksum file for all the files being packaged in the archive. Sorted by filename.
for d in "${PACKAGES[@]}"; do
Expand All @@ -116,10 +103,9 @@ function package {
done
}

VERSION_V1="$(make echo-v1 | perl -lne 'print $1 if /^v(\d+.\d+.\d+)$/' )"
VERSION_V2="$(make echo-v2 | perl -lne 'print $1 if /^v(\d+.\d+.\d+(-rc\d+)?)$/' )"
echo "Working on versions: $VERSION_V1 and $VERSION_V2"
if [ -z "$VERSION_V1" ] || [ -z "$VERSION_V2" ]; then
VERSION="$(make echo-version | perl -lne 'print $1 if /^v(\d+.\d+.\d+(-rc\d+)?)$/' )"
echo "Working on version: $VERSION"
if [ -z "$VERSION" ]; then
# We want to halt if for some reason the version string is empty as this is an obvious error case
>&2 echo 'Failed to detect a version string'
exit 1
Expand All @@ -145,8 +131,7 @@ done
find deploy \( ! -name '*sha256sum.txt' \) -type f -exec shasum -b -a 256 {} \; \
| sed -r 's#(\w+\s+\*?)deploy/(.*)#\1\2#' \
| sort -k2 \
| tee "./deploy/jaeger-${VERSION_V1}.sha256sum.txt" \
| tee "./deploy/jaeger-${VERSION_V2}.sha256sum.txt"
| tee "./deploy/jaeger-${VERSION}.sha256sum.txt"

# Use gpg to sign the (g)zip files (excluding checksum files) into .asc files.
if [[ "${gpg_key_id}" == "skip" ]]; then
Expand Down
28 changes: 2 additions & 26 deletions scripts/makefiles/BuildBinaries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ _build-a-binary-%:

.PHONY: build-jaeger
build-jaeger: BIN_NAME = jaeger
build-jaeger: BUILD_INFO = $(BUILD_INFO_V2)
build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
@ set -euf -o pipefail ; \
echo "Checking version of built binary" ; \
Expand All @@ -79,7 +78,7 @@ build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
if [ "$(GOOS)" == "$$REAL_GOOS" ] && [ "$(GOARCH)" == "$$REAL_GOARCH" ]; then \
./cmd/jaeger/jaeger-$(GOOS)-$(GOARCH) version 2>/dev/null ; \
echo "" ; \
want=$(GIT_CLOSEST_TAG_V2) ; \
want=$(GIT_CLOSEST_TAG) ; \
have=$$(./cmd/jaeger/jaeger-$(GOOS)-$(GOARCH) version 2>/dev/null | jq -r .gitVersion) ; \
if [ "$$want" == "$$have" ]; then \
echo "🟢 versions match: want=$$want, have=$$have" ; \
Expand All @@ -93,21 +92,6 @@ build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
fi


.PHONY: build-all-in-one
build-all-in-one: BIN_NAME = all-in-one
build-all-in-one: build-ui _build-a-binary-all-in-one$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-query
build-query: BIN_NAME = query
build-query: build-ui _build-a-binary-query$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-collector
build-collector: BIN_NAME = collector
build-collector: _build-a-binary-collector$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-ingester
build-ingester: BIN_NAME = ingester
build-ingester: _build-a-binary-ingester$(SUFFIX)-$(GOOS)-$(GOARCH)

.PHONY: build-remote-storage
build-remote-storage: BIN_NAME = remote-storage
Expand Down Expand Up @@ -148,10 +132,6 @@ build-binaries-linux-ppc64le:
.PHONY: _build-platform-binaries
_build-platform-binaries: \
build-jaeger \
build-all-in-one \
build-collector \
build-query \
build-ingester \
build-remote-storage \
build-examples \
build-tracegen \
Expand All @@ -167,11 +147,7 @@ _build-platform-binaries: \
_build-platform-binaries-debug:
_build-platform-binaries-debug: \
build-jaeger \
build-collector \
build-query \
build-ingester \
build-remote-storage \
build-all-in-one
build-remote-storage

.PHONY: build-all-platforms
build-all-platforms:
Expand Down
9 changes: 3 additions & 6 deletions scripts/makefiles/BuildInfo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ GIT_SHA=$(shell git rev-parse HEAD)
DATE=$(shell TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%dT%H:%M:%SZ' --format="%cd")
# Defer evaluation of semver tags until actually needed, using trick from StackOverflow:
# https://stackoverflow.com/questions/44114466/how-to-declare-a-deferred-variable-that-is-computed-only-once-for-all
GIT_CLOSEST_TAG_V1 = $(eval GIT_CLOSEST_TAG_V1 := $(shell scripts/utils/compute-version.sh v1))$(GIT_CLOSEST_TAG_V1)
GIT_CLOSEST_TAG_V2 = $(eval GIT_CLOSEST_TAG_V2 := $(shell scripts/utils/compute-version.sh v2))$(GIT_CLOSEST_TAG_V2)
GIT_CLOSEST_TAG = $(eval GIT_CLOSEST_TAG := $(shell scripts/utils/compute-version.sh))$(GIT_CLOSEST_TAG)

# args: (1) - name, (2) - value
define buildinfo
$(JAEGER_IMPORT_PATH)/internal/version.$(1)=$(2)
endef
# args (1) - V1|V2
define buildinfoflags
-ldflags "-X $(call buildinfo,commitSHA,$(GIT_SHA)) -X $(call buildinfo,latestVersion,$(GIT_CLOSEST_TAG_$(1))) -X $(call buildinfo,date,$(DATE))"
-ldflags "-X $(call buildinfo,commitSHA,$(GIT_SHA)) -X $(call buildinfo,latestVersion,$(GIT_CLOSEST_TAG)) -X $(call buildinfo,date,$(DATE))"
endef
BUILD_INFO=$(call buildinfoflags,V1)
BUILD_INFO_V2=$(call buildinfoflags,V2)
BUILD_INFO=$(call buildinfoflags)
9 changes: 2 additions & 7 deletions scripts/makefiles/Windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,16 @@ endef

.PHONY: _build-syso
_build-syso: $(GOVERSIONINFO)
$(eval SEMVER_ALL := $(shell scripts/utils/compute-version.sh -s v1))
$(eval SEMVER_ALL := $(shell scripts/utils/compute-version.sh -s))
$(eval SEMVER_MAJOR := $(word 2, $(SEMVER_ALL)))
$(eval SEMVER_MINOR := $(word 3, $(SEMVER_ALL)))
$(eval SEMVER_PATCH := $(word 4, $(SEMVER_ALL)))
$(call _build_syso_macro,Jaeger Collector,cmd/collector)
$(call _build_syso_macro,Jaeger Query,cmd/query)
$(call _build_syso_macro,Jaeger Ingester,cmd/ingester)
$(call _build_syso_macro,Jaeger,cmd/jaeger)
$(call _build_syso_macro,Jaeger Remote Storage,cmd/remote-storage)
$(call _build_syso_macro,Jaeger All-In-One,cmd/all-in-one)
$(call _build_syso_macro,Jaeger Tracegen,cmd/tracegen)
$(call _build_syso_macro,Jaeger Anonymizer,cmd/anonymizer)
$(call _build_syso_macro,Jaeger ES-Index-Cleaner,cmd/es-index-cleaner)
$(call _build_syso_macro,Jaeger ES-Rollover,cmd/es-rollover)
# TODO in the future this should be in v2
$(call _build_syso_macro,Jaeger V2,cmd/jaeger)

.PHONY: _clean-syso
_clean-syso:
Expand Down
Loading
Loading