From e08ed38be863837faa1c45ae72d70c2865a9eba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Fri, 12 Jul 2024 08:26:36 +0200 Subject: [PATCH] ci: fix relative paths for verify e2e test (#3249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use absolute paths to avoid issues with bazel run changing working directory * Fix error message in attestationconfig cli --------- Signed-off-by: Daniel Weiße --- .github/actions/e2e_verify/action.yml | 9 ++++++++- internal/api/attestationconfigapi/cli/compare.go | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/actions/e2e_verify/action.yml b/.github/actions/e2e_verify/action.yml index 6b0bcf885b..22b86e8931 100644 --- a/.github/actions/e2e_verify/action.yml +++ b/.github/actions/e2e_verify/action.yml @@ -96,7 +96,14 @@ runs: run: | reports=attestation-report-*.json - report=$(bazel run //internal/api/attestationconfigapi/cli -- compare ${{ inputs.attestationVariant }} ${reports}) + # bazel run changes the working directory + # convert the relative paths to absolute paths to avoid issues + absolute_reports="" + for report in ${reports}; do + absolute_reports="${absolute_reports} $(realpath "${report}")" + done + + report=$(bazel run //internal/api/attestationconfigapi/cli -- compare ${{ inputs.attestationVariant }} ${absolute_reports}) path=$(realpath "${report}") cat "${path}" diff --git a/internal/api/attestationconfigapi/cli/compare.go b/internal/api/attestationconfigapi/cli/compare.go index 49988fefbb..9921ab76e9 100644 --- a/internal/api/attestationconfigapi/cli/compare.go +++ b/internal/api/attestationconfigapi/cli/compare.go @@ -66,13 +66,13 @@ func compareVersions(attestationVariant variant.Variant, files []string, fs file lowestVersion := files[0] lowestReport, err := readReport(files[0], fs) if err != nil { - return "", fmt.Errorf("reading tdx report: %w", err) + return "", fmt.Errorf("reading report: %w", err) } for _, file := range files[1:] { report, err := readReport(file, fs) if err != nil { - return "", fmt.Errorf("reading tdx report: %w", err) + return "", fmt.Errorf("reading report: %w", err) } if client.IsInputNewerThanOtherVersion(attestationVariant, lowestReport, report) {