Skip to content

Commit

Permalink
[jaeger-v2] Add HotROD integration test for jaeger-v2 (#6138)
Browse files Browse the repository at this point in the history
## 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 <saumyabshah90@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
Saumya40-codes and yurishkuro authored Oct 30, 2024
1 parent c5f34d9 commit 2d74619
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci-docker-hotrod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
31 changes: 26 additions & 5 deletions scripts/build-hotrod-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d74619

Please sign in to comment.