From d2a86b682129b050a97a479c67782678e2fdeea8 Mon Sep 17 00:00:00 2001 From: Chaya Malik Date: Fri, 14 Feb 2025 12:06:07 -0500 Subject: [PATCH 1/3] limit build variant names to 100 characters --- operations/fetch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operations/fetch.go b/operations/fetch.go index b56056b85b..1d25a456df 100644 --- a/operations/fetch.go +++ b/operations/fetch.go @@ -518,7 +518,7 @@ type artifactDownload struct { func getArtifactFolderName(task *service.RestTask) string { if evergreen.IsPatchRequester(task.Requester) { - return fmt.Sprintf("artifacts-patch-%v_%v_%v", task.PatchNumber, task.BuildVariant, task.DisplayName) + return fmt.Sprintf("artifacts-patch-%v_%v_%v", task.PatchNumber, task.BuildVariant[:100], task.DisplayName) } if len(task.Revision) >= 5 { From cbcfcc07b83c12e9aba12d15f496917359672391 Mon Sep 17 00:00:00 2001 From: Chaya Malik Date: Wed, 19 Feb 2025 12:34:44 -0500 Subject: [PATCH 2/3] cr --- operations/fetch.go | 13 +++++++--- operations/fetch_test.go | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/operations/fetch.go b/operations/fetch.go index 1d25a456df..258a696707 100644 --- a/operations/fetch.go +++ b/operations/fetch.go @@ -517,14 +517,19 @@ type artifactDownload struct { } func getArtifactFolderName(task *service.RestTask) string { + bvTruncated := task.BuildVariant + if len(task.BuildVariant) > 99 { + bvTruncated = task.BuildVariant[:100] + } + if evergreen.IsPatchRequester(task.Requester) { - return fmt.Sprintf("artifacts-patch-%v_%v_%v", task.PatchNumber, task.BuildVariant[:100], task.DisplayName) + return fmt.Sprintf("artifacts-patch-%v_%v_%v", task.PatchNumber, bvTruncated, task.DisplayName) } - if len(task.Revision) >= 5 { - return fmt.Sprintf("artifacts-%v-%v_%v", task.Revision[0:6], task.BuildVariant, task.DisplayName) + if len(task.Revision) > 5 { + return fmt.Sprintf("artifacts-%v-%v_%v", task.Revision[0:6], bvTruncated, task.DisplayName) } - return fmt.Sprintf("artifacts-%v_%v", task.BuildVariant, task.DisplayName) + return fmt.Sprintf("artifacts-%v_%v", bvTruncated, task.DisplayName) } // getUrlsChannel takes a seed task, and returns a channel that streams all of the artifacts diff --git a/operations/fetch_test.go b/operations/fetch_test.go index ced9b488be..e549a3beec 100644 --- a/operations/fetch_test.go +++ b/operations/fetch_test.go @@ -1,11 +1,14 @@ package operations import ( + "fmt" "os/exec" "path/filepath" "strings" "testing" + "github.com/evergreen-ci/evergreen" + "github.com/evergreen-ci/evergreen/service" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -143,3 +146,54 @@ func TestResetGitRemoteToSSH(t *testing.T) { assert.Contains(t, string(output), "git@github.com:") assert.NotContains(t, string(output), "https:") } + +func TestGetArtifactFolderName(t *testing.T) { + testCases := map[string]struct { + task service.RestTask + expected string + }{ + "ShortBuildVariant": { + task: service.RestTask{ + BuildVariant: "variant", + Requester: evergreen.PatchVersionRequester, + PatchNumber: 123, + DisplayName: "display", + }, + expected: "artifacts-patch-123_variant_display", + }, + "LongBuildVariant": { + task: service.RestTask{ + BuildVariant: strings.Repeat("a", 200), + Requester: evergreen.PatchVersionRequester, + PatchNumber: 123, + DisplayName: "display", + }, + expected: fmt.Sprintf("artifacts-patch-123_%s_display", strings.Repeat("a", 100)), + }, + "ShortRevision": { + task: service.RestTask{ + BuildVariant: "variant", + Requester: evergreen.RepotrackerVersionRequester, + Revision: "abcde", + DisplayName: "display", + }, + expected: "artifacts-variant_display", + }, + "LongRevision": { + task: service.RestTask{ + BuildVariant: "variant", + Requester: evergreen.RepotrackerVersionRequester, + Revision: "abcde1234567", + DisplayName: "display", + }, + expected: "artifacts-abcde1-variant_display", + }, + } + + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + result := getArtifactFolderName(&tc.task) + assert.Equal(t, tc.expected, result) + }) + } +} From 149a8d183c8f448d74e280c5bfe50c388c008fcb Mon Sep 17 00:00:00 2001 From: Chaya Malik Date: Wed, 19 Feb 2025 12:39:22 -0500 Subject: [PATCH 3/3] bump cli version --- config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.go b/config.go index b3b6ac0121..705e08fcee 100644 --- a/config.go +++ b/config.go @@ -33,7 +33,7 @@ var ( // ClientVersion is the commandline version string used to control updating // the CLI. The format is the calendar date (YYYY-MM-DD). - ClientVersion = "2025-01-28" + ClientVersion = "2025-02-19" // Agent version to control agent rollover. The format is the calendar date // (YYYY-MM-DD).