From 9291433b7180d9a99e50aa58dfa33fdc6ee21da1 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 14 Sep 2024 15:04:48 -0400 Subject: [PATCH] fix Signed-off-by: Yuri Shkuro --- .github/workflows/ci-docker-all-in-one.yml | 13 +------ .github/workflows/ci-release.yml | 8 ++-- scripts/build-all-in-one-image.sh | 44 ++++++++++++++++------ scripts/compute-version.sh | 2 +- 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci-docker-all-in-one.yml b/.github/workflows/ci-docker-all-in-one.yml index 257210678c3..52ceb0939b5 100644 --- a/.github/workflows/ci-docker-all-in-one.yml +++ b/.github/workflows/ci-docker-all-in-one.yml @@ -57,22 +57,11 @@ jobs: ;; esac - - name: Customize the build based on v1/v2 version - run: | - if [[ "${{ matrix.jaeger_version }}" == "v1" ]]; then - echo "HEALTHCHECK_V2=false" >> $GITHUB_ENV - echo "JAEGER_BINARY=all-in-one" >> $GITHUB_ENV - elif [[ "${{ matrix.jaeger_version }}" == "v2" ]]; then - echo "HEALTHCHECK_V2=true" >> $GITHUB_ENV - echo "JAEGER_BINARY=jaeger" >> $GITHUB_ENV - fi - - name: Build, test, and publish all-in-one image run: | bash scripts/build-all-in-one-image.sh \ ${{ env.BUILD_FLAGS }} \ - -b ${{ env.JAEGER_BINARY }} + "${{ matrix.jaeger_version }}" env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} - HEALTHCHECK_V2: ${{ env.HEALTHCHECK_V2 }} diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 87bf4d7f264..3261b764ca3 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -143,8 +143,8 @@ jobs: run: | BRANCH=$(make echo-v1) \ bash scripts/build-all-in-one-image.sh \ - -b all-in-one \ - ${{ steps.params.outputs.docker_flags }} + ${{ steps.params.outputs.docker_flags }} \ + v1 env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} @@ -153,8 +153,8 @@ jobs: run: | BRANCH=$(make echo-v2) \ bash scripts/build-all-in-one-image.sh \ - -b jaeger \ - ${{ steps.params.outputs.docker_flags }} + ${{ steps.params.outputs.docker_flags }} \ + v2 env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} diff --git a/scripts/build-all-in-one-image.sh b/scripts/build-all-in-one-image.sh index d82e3f0e6c8..7a8edf9cb38 100755 --- a/scripts/build-all-in-one-image.sh +++ b/scripts/build-all-in-one-image.sh @@ -6,26 +6,22 @@ set -euf -o pipefail print_help() { - echo "Usage: $0 [-b binary] [-D] [-h] [-l] [-o] [-p platforms]" - echo "-b: Which binary to build: 'all-in-one' (default) or 'jaeger' (v2)" - echo "-D: Disable building of images with debugger" - 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 "Usage: $0 [-b binary] [-D] [-h] [-l] [-o] [-p platforms] " + echo " -D: Disable building of images with debugger" + 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 " jaeger_version: major version, v1 | v2" exit 1 } add_debugger='Y' platforms="$(make echo-linux-platforms)" FLAGS=() -BINARY='all-in-one' -while getopts "b:Dhlop:" opt; do +while getopts "Dhlop:" opt; do case "${opt}" in - b) - BINARY=${OPTARG} - ;; D) add_debugger='N' ;; @@ -45,6 +41,30 @@ while getopts "b:Dhlop:" opt; do esac done +# remove flags, leave only positional args +shift $((OPTIND - 1)) + +if [[ $# -eq 0 ]]; then + echo "Jaeger major version is required as argument" + print_help +fi + +case $1 in + v1) + JAEGER_MAJOR=v1 + BINARY='all-in-one' + export HEALTHCHECK_V2=false + ;; + v2) + JAEGER_MAJOR=v2 + BINARY='jaeger' + export HEALTHCHECK_V2=true + ;; + *) + echo "Jaeger major version is required as argument" + print_help +esac + set -x # Set default GOARCH variable to the host GOARCH, the target architecture can diff --git a/scripts/compute-version.sh b/scripts/compute-version.sh index 75f759abdce..a4f7f4d56de 100755 --- a/scripts/compute-version.sh +++ b/scripts/compute-version.sh @@ -9,7 +9,7 @@ set -euf -o pipefail SED=${SED:-sed} usage() { - echo "Usage: $0 -v -s " + echo "Usage: $0 [-s] [-v] " echo " -s split semver into 4 parts: semver major minor patch" echo " -v verbose" echo " jaeger_version: major version, v1 | v2"