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

[jaeger-v2] Add HotROD integration test for jaeger-v2 #6138

Merged
11 changes: 10 additions & 1 deletion .github/workflows/ci-docker-hotrod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ permissions:
jobs:
hotrod:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode:
- name: v1
binary: all-in-one
- name: v2
binary: jaeger
Saumya40-codes marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
Expand Down Expand Up @@ -53,7 +62,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 }} -b ${{ matrix.mode.binary }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
29 changes: 24 additions & 5 deletions scripts/build-hotrod-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
set -euf -o pipefail

print_help() {
echo "Usage: $0 [-h] [-l] [-o] [-p platforms]"
echo "Usage: $0 [-h] [-l] [-o] [-p platforms] [-b binary]"
Saumya40-codes marked this conversation as resolved.
Show resolved Hide resolved
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 "-b: Which binary to build: 'all-in-one' (v1) (default) or 'jaeger' (v2)"
exit 1
}

docker_compose_file="./examples/hotrod/docker-compose.yml"
platforms="$(make echo-linux-platforms)"
current_platform="$(go env GOOS)/$(go env GOARCH)"
BINARY="all-in-one"
FLAGS=()
success="false"

while getopts "hlop:" opt; do
while getopts "hlop:b:" opt; do
case "${opt}" in
l)
# in the local-only mode the images will only be pushed to local registry
Expand All @@ -32,12 +34,22 @@ while getopts "hlop:" opt; do
p)
platforms=${OPTARG}
;;
b)
BINARY=${OPTARG}
;;
*)
print_help
;;
esac
done

if [[ "$BINARY" != "all-in-one" && "$BINARY" != "jaeger" ]]; then
echo "Invalid binary type provided: $BINARY"
print_help
elif [[ "$BINARY" == "jaeger" ]]; then
docker_compose_file="./examples/hotrod/docker-compose-v2.yml"
fi

set -x

dump_logs() {
Expand Down Expand Up @@ -73,9 +85,16 @@ 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
if [[ "$BINARY" == "all-in-one" ]]; then
# Build all-in-one image for v1
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
else
# Build jaeger image for v2
make build-jaeger
Saumya40-codes marked this conversation as resolved.
Show resolved Hide resolved
bash scripts/build-upload-a-docker-image.sh -l -b -c jaeger -d cmd/jaeger -p "${current_platform}" -t release
fi

echo '::group:: docker compose'
JAEGER_VERSION=$GITHUB_SHA REGISTRY="localhost:5000/" docker compose -f "$docker_compose_file" up -d
Expand Down
Loading