From 70b8a12769615f047c6f4951cf56a08cc3155950 Mon Sep 17 00:00:00 2001 From: Andrii Liashenko Date: Wed, 10 Jul 2024 11:38:31 +0200 Subject: [PATCH] [CI VIsibility] Fix the source path for windows (#2778) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dario Castañé --- .../integrations/gotesting/testing_test.go | 15 +++++++++------ internal/civisibility/utils/environmentTags.go | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/civisibility/integrations/gotesting/testing_test.go b/internal/civisibility/integrations/gotesting/testing_test.go index a2b7ac1f1b..e45e62d15d 100644 --- a/internal/civisibility/integrations/gotesting/testing_test.go +++ b/internal/civisibility/integrations/gotesting/testing_test.go @@ -329,12 +329,15 @@ func assertCommon(assert *assert.Assertions, span mocktracer.Span) { assert.Contains(spanTags, constants.RuntimeName) assert.Contains(spanTags, constants.GitRepositoryURL) assert.Contains(spanTags, constants.GitCommitSHA) - assert.Contains(spanTags, constants.GitCommitMessage) - assert.Contains(spanTags, constants.GitCommitAuthorEmail) - assert.Contains(spanTags, constants.GitCommitAuthorDate) - assert.Contains(spanTags, constants.GitCommitCommitterEmail) - assert.Contains(spanTags, constants.GitCommitCommitterDate) - assert.Contains(spanTags, constants.GitCommitCommitterName) + // GitHub CI does not provide commit details + if spanTags[constants.CIProviderName] != "github" { + assert.Contains(spanTags, constants.GitCommitMessage) + assert.Contains(spanTags, constants.GitCommitAuthorEmail) + assert.Contains(spanTags, constants.GitCommitAuthorDate) + assert.Contains(spanTags, constants.GitCommitCommitterEmail) + assert.Contains(spanTags, constants.GitCommitCommitterDate) + assert.Contains(spanTags, constants.GitCommitCommitterName) + } assert.Contains(spanTags, constants.CIWorkspacePath) } diff --git a/internal/civisibility/utils/environmentTags.go b/internal/civisibility/utils/environmentTags.go index 989ef7ef06..0b64b8be86 100644 --- a/internal/civisibility/utils/environmentTags.go +++ b/internal/civisibility/utils/environmentTags.go @@ -53,7 +53,7 @@ func GetRelativePathFromCITagsSourceRoot(path string) string { if v, ok := tags[constants.CIWorkspacePath]; ok { relPath, err := filepath.Rel(v, path) if err == nil { - return relPath + return filepath.ToSlash(relPath) } }