From b2458f6bb8693b3ed0d1b7d22a61f7914a7c9d6a Mon Sep 17 00:00:00 2001 From: dillanb-hashi Date: Mon, 20 Apr 2026 11:18:37 -0700 Subject: [PATCH] chore(e2e): Fix worker version e2e-docker-base-with-worker-version to account for 1.0 release (#6588) * chore(e2e): Fix worker version e2e-docker-base-with-worker-version to account for 1.0 release --- .github/workflows/enos-run.yml | 36 ++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/enos-run.yml b/.github/workflows/enos-run.yml index c046a631d..fa0e7cc2d 100644 --- a/.github/workflows/enos-run.yml +++ b/.github/workflows/enos-run.yml @@ -100,6 +100,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: ${{ contains(matrix.filter, 'e2e_docker_base_with_worker_version') && '0' || '1' }} + fetch-tags: ${{ contains(matrix.filter, 'e2e_docker_base_with_worker_version') && 'true' || 'false' }} - name: Determine Go version id: get-go-version # We use .go-version as our source of truth for current Go @@ -265,12 +268,37 @@ jobs: enos scenario check --chdir ./enos ${{ matrix.filter }} && \ enos scenario exec --chdir ./enos ${{ matrix.filter }} --cmd "version" - name: Determine boundary version to test against previous worker version - # Get the Boundary version number and decrement the minor version by 1 + # Resolve the worker version from the previous release line. if: contains(matrix.filter, 'e2e_docker_base_with_worker_version') run: | - version_num=$(./enos/support/boundary/boundary version | awk -F'[. ]' '/Version Number/ {print $(NF-1)}') - export ENOS_VAR_worker_version="$((version_num - 1))" - echo "ENOS_VAR_worker_version=0.$ENOS_VAR_worker_version" >> "$GITHUB_ENV" + current_version_raw=$(./enos/support/boundary/boundary version | awk '/Version Number/ {print $3}') + current_version="${current_version_raw%%[-+]*}" + + if ! [[ "$current_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Unable to parse Boundary version: $current_version_raw" >&2 + exit 1 + fi + + IFS='.' read -r current_major current_minor _ <<< "$current_version" + + all_semver_tags=$(git tag -l | sed 's/^v//' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || true) + + previous_version="" + if [ "$current_minor" -gt 0 ]; then + target_minor=$((current_minor - 1)) + previous_version=$(echo "$all_semver_tags" | grep -E "^${current_major}\.${target_minor}\.[0-9]+$" | sort -V | tail -n1 || true) + fi + if [ -z "$previous_version" ] && [ "$current_major" -gt 0 ]; then + target_major=$((current_major - 1)) + previous_version=$(echo "$all_semver_tags" | grep -E "^${target_major}\.[0-9]+\.[0-9]+$" | sort -V | tail -n1 || true) + fi + + if [ -z "$previous_version" ]; then + echo "No previous release line found for current version $current_version" >&2 + exit 1 + fi + + echo "ENOS_VAR_worker_version=$previous_version" >> "$GITHUB_ENV" - name: Run Enos scenario id: run # Continue once and retry