From 7150b7dac350619e82e0d7d51a5dd5c75ea8f9e5 Mon Sep 17 00:00:00 2001 From: shiva kumar Date: Thu, 19 Dec 2024 12:34:07 +0530 Subject: [PATCH] unused aws instace and vpcs cleanup Signed-off-by: shiva kumar --- tests/aws_test.go | 2 -- tests/common/common.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/aws_test.go b/tests/aws_test.go index 14c9b032..3bf8444c 100644 --- a/tests/aws_test.go +++ b/tests/aws_test.go @@ -29,7 +29,6 @@ import ( "github.com/NVIDIA/holodeck/pkg/jyaml" "github.com/NVIDIA/holodeck/pkg/provider" "github.com/NVIDIA/holodeck/pkg/provisioner" - "github.com/NVIDIA/holodeck/tests/common" ) // Actual test suite @@ -58,7 +57,6 @@ var _ = Describe("AWS", func() { // Set unique name for the environment // Set env name setCfgName(&opts.cfg) - opts.cfg.Name = opts.cfg.Name + "-" + common.GenerateUID() // set cache path opts.cachePath = LogArtifactDir // set cache file diff --git a/tests/common/common.go b/tests/common/common.go index 254c0dd1..dc60c391 100644 --- a/tests/common/common.go +++ b/tests/common/common.go @@ -28,3 +28,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) +}