From 2d7461984ad651f8caf27e7d2a640c52b0e05272 Mon Sep 17 00:00:00 2001 From: Saumya Shah <115284013+Saumya40-codes@users.noreply.github.com> Date: Thu, 31 Oct 2024 01:49:00 +0530 Subject: [PATCH] [jaeger-v2] Add HotROD integration test for jaeger-v2 (#6138) ## Which problem is this PR solving? - Resolves #6137 ## Description of the changes - Currently in `.github/workflows/ci-docker-hotrod.yml`, we are only testing internally via `.scripts/build-hotrod-image.sh` for `examples/hotrod/docker-compose.yml` while `examples/hotrod/docker-compose-v2.yml` isnt getting covered - For this, in `.github/workflows/ci-docker-hotrod.yml` we are passing `-b` flag to specify the jaeger binary (`all-in-one` or `jaeger`) ## How was this change tested? - For the flags and normal bash scirpt code i tested it manually in seperate bash file so that atleast ensures the basic code test ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Saumya Shah Co-authored-by: Yuri Shkuro --- .github/workflows/ci-docker-hotrod.yml | 7 +++++- scripts/build-hotrod-image.sh | 31 +++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-docker-hotrod.yml b/.github/workflows/ci-docker-hotrod.yml index ea171657ce7..0a3351784fb 100644 --- a/.github/workflows/ci-docker-hotrod.yml +++ b/.github/workflows/ci-docker-hotrod.yml @@ -18,6 +18,11 @@ permissions: jobs: hotrod: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + jaeger-version: [v1, v2] + steps: - uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: @@ -53,7 +58,7 @@ jobs: esac - name: Build, test, and publish hotrod image - run: bash scripts/build-hotrod-image.sh ${{ env.BUILD_FLAGS }} + run: bash scripts/build-hotrod-image.sh ${{ env.BUILD_FLAGS }} -v ${{ matrix.jaeger-version }} env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} diff --git a/scripts/build-hotrod-image.sh b/scripts/build-hotrod-image.sh index e2296886752..3a1fe3e7184 100755 --- a/scripts/build-hotrod-image.sh +++ b/scripts/build-hotrod-image.sh @@ -6,21 +6,24 @@ set -euf -o pipefail print_help() { - echo "Usage: $0 [-h] [-l] [-o] [-p platforms]" + echo "Usage: $0 [-h] [-l] [-o] [-p platforms] [-v jaeger_version]" 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 "-v: Jaeger version to use for hotrod image (v1 or v2, default: v1)" exit 1 } docker_compose_file="./examples/hotrod/docker-compose.yml" platforms="$(make echo-linux-platforms)" current_platform="$(go env GOOS)/$(go env GOARCH)" +jaeger_version="v1" +binary="all-in-one" FLAGS=() success="false" -while getopts "hlop:" opt; do +while getopts "hlop:v:" opt; do case "${opt}" in l) # in the local-only mode the images will only be pushed to local registry @@ -32,12 +35,30 @@ while getopts "hlop:" opt; do p) platforms=${OPTARG} ;; + v) + jaeger_version=${OPTARG} + ;; *) print_help ;; esac done +case "$jaeger_version" in + v1) + docker_compose_file="./examples/hotrod/docker-compose.yml" + binary="all-in-one" + ;; + v2) + docker_compose_file="./examples/hotrod/docker-compose-v2.yml" + binary="jaeger" + ;; + *) + echo "Invalid Jaeger version provided: $jaeger_version" + print_help + ;; +esac + set -x dump_logs() { @@ -73,9 +94,9 @@ done # so we do not pass flags like -b and -t. bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${current_platform}" -# Build all-in-one image locally (-l) for integration test -make build-all-in-one -bash scripts/build-upload-a-docker-image.sh -l -b -c all-in-one -d cmd/all-in-one -p "${current_platform}" -t release +# Build all-in-one (for v1) or jaeger (for v2) image locally (-l) for integration test +make build-${binary} +bash scripts/build-upload-a-docker-image.sh -l -b -c "${binary}" -d cmd/"${binary}" -p "${current_platform}" -t release echo '::group:: docker compose' JAEGER_VERSION=$GITHUB_SHA REGISTRY="localhost:5000/" docker compose -f "$docker_compose_file" up -d