Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: AnmolxSingh <anmol7344@gmail.com>
  • Loading branch information
AnmolxSingh committed Feb 19, 2025
1 parent c202218 commit 2eb815e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci-lint-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
egress-policy: audit # TODO: change to 'egress-policy: block' after a couple of runs

- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: recursive

- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
Expand Down Expand Up @@ -116,6 +118,9 @@ jobs:
- name: Run unit tests for scripts
run: |
SHUNIT2=.tools/shunit2 bash scripts/utils/run-tests.sh
- name: Check jaeger-idl versions
run: make lint-jaeger-idl-version

binary-size-check:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ lint-goleak:
lint-go: $(LINT)
$(LINT) -v run

.PHONY: lint-jaeger-idl-version
lint-jaeger-idl-version:
@echo Checking jaeger-idl version consistency between go.mod and submodule...
./scripts/lint/check-jaeger-idl-version.sh

# Update the existing lint target to depend on the new check
lint: lint-jaeger-idl-version

.PHONY: run-all-in-one
run-all-in-one: build-ui
go run ./cmd/all-in-one --log-level debug
Expand Down
51 changes: 51 additions & 0 deletions scripts/lint/check-jaeger-idl-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail

# Fetch the version from go.mod, stripping any '+incompatible' suffix
GO_MOD_VERSION=$(grep 'github.com/jaegertracing/jaeger-idl' go.mod | awk '{print $2}' | sed 's/+incompatible//')

if [ -z "$GO_MOD_VERSION" ]; then
echo "Error: jaeger-idl version not found in go.mod"
exit 1
fi

# Check submodule directory exists
if [ ! -d "idl" ]; then
echo "Error: 'idl' submodule directory not found. Initialize submodules first."
exit 1
fi

cd idl

# Ensure tags are fetched to find the latest semver tag
git fetch --tags --quiet

# Get the latest semver tag at the current submodule commit
SUBMODULE_TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort --version-sort | tail -n1)

if [ -z "$SUBMODULE_TAG" ]; then
echo "No semver tag found at HEAD. Attempting to find the latest tag..."

# Find the latest tag and check it out
LATEST_TAG=$(git tag | sort --version-sort | tail -n1)

if [ -n "$LATEST_TAG" ]; then
echo "Checking out latest tag: $LATEST_TAG"
git checkout "$LATEST_TAG"
SUBMODULE_TAG="$LATEST_TAG"
else
echo "Error: No valid semver tag found for jaeger-idl submodule"
exit 1
fi
fi

cd ..

# Compare versions
if [ "$GO_MOD_VERSION" != "$SUBMODULE_TAG" ]; then
echo "Error: Version mismatch between go.mod ($GO_MOD_VERSION) and jaeger-idl submodule ($SUBMODULE_TAG)"
exit 1
fi

echo "Versions are in sync: go.mod ($GO_MOD_VERSION) and submodule ($SUBMODULE_TAG)"
exit 0

0 comments on commit 2eb815e

Please sign in to comment.