From e352586bb672d98abc400d5f04f3dead779bdb3f Mon Sep 17 00:00:00 2001 From: shiva kumar Date: Thu, 19 Dec 2024 13:54:55 +0530 Subject: [PATCH] Rename e2e job names to ci- for consistency Signed-off-by: shiva kumar --- tests/aws_test.go | 2 +- tests/common/common.go | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/aws_test.go b/tests/aws_test.go index 541c5d7d..81cb6df7 100644 --- a/tests/aws_test.go +++ b/tests/aws_test.go @@ -56,7 +56,7 @@ var _ = Describe("AWS", func() { Expect(err).ToNot(HaveOccurred()) // Set unique name for the environment - opts.cfg.Name = opts.cfg.Name + "-" + common.GenerateUID() + common.SetCfgName(&opts.cfg) // set cache path opts.cachePath = LogArtifactDir // set cache file diff --git a/tests/common/common.go b/tests/common/common.go index 254c0dd1..973476c3 100644 --- a/tests/common/common.go +++ b/tests/common/common.go @@ -16,7 +16,13 @@ package common -import "math/rand" +import ( + "fmt" + "math/rand" + "os" + + "github.com/NVIDIA/holodeck/api/holodeck/v1alpha1" +) func GenerateUID() string { const charset = "abcdefghijklmnopqrstuvwxyz0123456789" @@ -28,3 +34,16 @@ func GenerateUID() string { return string(b) } + +func SetCfgName(cfg *v1alpha1.Environment) { + sha := os.Getenv("GITHUB_SHA") + attempt := os.Getenv("GITHUB_RUN_ATTEMPT") + // short sha + if len(sha) > 8 { + sha = sha[:8] + } + // uid is unique for each run + uid := GenerateUID() + + cfg.Name = fmt.Sprintf("ci%s-%s-%s", attempt, sha, uid) +}