From 878432c2ca10d6bb4f55fa9069d1d80b606b8cf5 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Thu, 25 Jul 2024 17:40:50 +0200 Subject: [PATCH] ci(build): extract version from cargo-metadata Avoids this issue ``` Error: Cannot downgrade from 24.7.0 to 0.0.0-pr602 ``` --- .github/workflows/build.yml | 8 ++++++-- scripts/run-tests | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c779094d..3670e009 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -345,7 +345,9 @@ jobs: bin: cargo-set-version - name: Update version if PR if: ${{ github.event_name == 'pull_request' }} - run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }} + run: | + VERSION=$(cargo metadata --format-version=1 | jq -r '.workspace_members[] | match("operator@(.*)$").captures[0].string') + cargo set-version --offline --workspace "${VERSION}-pr${{ github.event.pull_request.number }}" # Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the # default value in the makefile if called from this action, but not otherwise (i.e. when called locally). @@ -410,7 +412,9 @@ jobs: bin: cargo-set-version - name: Update version if PR if: ${{ github.event_name == 'pull_request' }} - run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }} + run: | + VERSION=$(cargo metadata --format-version=1 | jq -r '.workspace_members[] | match("operator@(.*)$").captures[0].string') + cargo set-version --offline --workspace "${VERSION}-pr${{ github.event.pull_request.number }}" - name: Build manifest list run: | # Creating manifest list diff --git a/scripts/run-tests b/scripts/run-tests index c331043b..61392c4e 100755 --- a/scripts/run-tests +++ b/scripts/run-tests @@ -31,9 +31,9 @@ Examples: ./scripts/run-tests --parallel 4 -2. Install operators but for Airflow use version "0.0.0-pr123" instead of "0.0.0-dev" and run all tests as above: +2. Install operators but for Airflow use version "0.0.0-dev-pr123" instead of "0.0.0-dev" and run all tests as above: - ./scripts/run-tests --operator airflow=0.0.0-pr123 --parallel 4 + ./scripts/run-tests --operator airflow=0.0.0-dev-pr123 --parallel 4 3. Do not install any operators, run the smoke test suite and keep namespace: