Skip to content

Commit

Permalink
Write to $MINT_LINKS (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrebeaucamp authored Jul 23, 2024
1 parent c7086f9 commit 79c413a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"

"github.com/mattn/go-shellwords"
Expand Down Expand Up @@ -655,6 +656,21 @@ func (s Service) reportTestResults(
}
}

mintLinksPath := os.Getenv("MINT_LINKS")
if reportingConfiguration.Provider.ProviderName == "mint" && mintLinksPath != "" {
backlinkPath := filepath.Join(mintLinksPath, "View Captain results")
backlinkURL := fmt.Sprintf(
"https://%v/captain/deep_link/test_suite_summaries/%v/%v/%v",
reportingConfiguration.CloudHost,
reportingConfiguration.SuiteID,
reportingConfiguration.Provider.BranchName,
reportingConfiguration.Provider.CommitSha,
)
if err := os.WriteFile(backlinkPath, []byte(backlinkURL), 0o600); err != nil {
s.Log.Warnf("Could not populate backlink in Mint")
}
}

if _, ok := s.API.(local.Client); ok && !cfg.UpdateStoredResults {
return nil, nil
}
Expand Down

0 comments on commit 79c413a

Please sign in to comment.