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