diff --git a/artifactory/utils/commandsummary/utils.go b/artifactory/utils/commandsummary/utils.go index f9e51b3ec..cf7e7675e 100644 --- a/artifactory/utils/commandsummary/utils.go +++ b/artifactory/utils/commandsummary/utils.go @@ -67,6 +67,10 @@ func addGitHubTrackingToUrl(urlStr string, section summarySection) (string, erro // Get the query parameters and add the GitHub tracking parameters queryParams := parsedUrl.Query() + // Tracking source + queryParams.Set("s", "1") + // Tracking metric + queryParams.Set("m", "3") queryParams.Set("gh_job_id", githubWorkflow) queryParams.Set("gh_section", string(section)) parsedUrl.RawQuery = queryParams.Encode() diff --git a/artifactory/utils/commandsummary/utils_test.go b/artifactory/utils/commandsummary/utils_test.go index 5473df4d0..62dc669ac 100644 --- a/artifactory/utils/commandsummary/utils_test.go +++ b/artifactory/utils/commandsummary/utils_test.go @@ -19,9 +19,9 @@ func TestGenerateArtifactUrl(t *testing.T) { majorVersion int expected string }{ - {"artifactory 7 without project", "", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true&gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section"}, - {"artifactory 7 with project", "proj", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true&gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section"}, - {"artifactory 6 without project", "", 6, "https://myplatform.com/artifactory/webapp/?gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section#/artifacts/browse/tree/General/repo/path/file"}, + {"artifactory 7 without project", "", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true&gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section&m=3&s=1"}, + {"artifactory 7 with project", "proj", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true&gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section&m=3&s=1"}, + {"artifactory 6 without project", "", 6, "https://myplatform.com/artifactory/webapp/?gh_job_id=JFrog+CLI+Core+Tests&gh_section=test-section&m=3&s=1#/artifacts/browse/tree/General/repo/path/file"}, } StaticMarkdownConfig.setPlatformUrl(testPlatformUrl) for _, testCase := range cases { @@ -71,7 +71,7 @@ func TestAddGitHubTrackingToUrl(t *testing.T) { "https://example.com/path", buildInfoSection, "workflow123", - "https://example.com/path?gh_job_id=workflow123&gh_section=buildInfo", + "https://example.com/path?gh_job_id=workflow123&gh_section=buildInfo&m=3&s=1", false, }, { @@ -87,7 +87,7 @@ func TestAddGitHubTrackingToUrl(t *testing.T) { "https://example.com/path?existing_param=value", packagesSection, "workflow123", - "https://example.com/path?existing_param=value&gh_job_id=workflow123&gh_section=packages", + "https://example.com/path?existing_param=value&gh_job_id=workflow123&gh_section=packages&m=3&s=1", false, }, { @@ -95,7 +95,15 @@ func TestAddGitHubTrackingToUrl(t *testing.T) { "https://example.com/path", artifactsSection, "workflow with spaces & special?characters", - "https://example.com/path?gh_job_id=workflow+with+spaces+%26+special%3Fcharacters&gh_section=artifacts", + "https://example.com/path?gh_job_id=workflow+with+spaces+%26+special%3Fcharacters&gh_section=artifacts&m=3&s=1", + false, + }, + { + "URL with spaces", + "https://example.com/path?existing_param=value", + packagesSection, + "workflow space", + "https://example.com/path?existing_param=value&gh_job_id=workflow+space&gh_section=packages&m=3&s=1", false, }, } diff --git a/artifactory/utils/testdata/command_summaries/extended/build-info-table.md b/artifactory/utils/testdata/command_summaries/extended/build-info-table.md index 5d0bb212c..9dba95552 100644 --- a/artifactory/utils/testdata/command_summaries/extended/build-info-table.md +++ b/artifactory/utils/testdata/command_summaries/extended/build-info-table.md @@ -1,7 +1,7 @@ -| Build Info| Security Violations| Security Issues| -|:---------|:------------|:------------| -| [buildName 123](http://myJFrogPlatform/builds/buildName/123?gh_job_id=JFrog+CLI+Core+Tests&gh_section=buildInfo) | Not scanned| Not scanned| +| Build Info | Security Violations | Security Issues | +| :--------- | :------------ | :------------ | +| [buildName 123](http://myJFrogPlatform/builds/buildName/123?gh_job_id=JFrog+CLI+Core+Tests&gh_section=buildInfo&m=3&s=1) | Not scanned | Not scanned | diff --git a/artifactory/utils/testdata/command_summaries/extended/docker-image-module.md b/artifactory/utils/testdata/command_summaries/extended/docker-image-module.md index 2300c23c0..7e57d9f5e 100644 --- a/artifactory/utils/testdata/command_summaries/extended/docker-image-module.md +++ b/artifactory/utils/testdata/command_summaries/extended/docker-image-module.md @@ -10,4 +10,4 @@ | Artifacts | Security Violations | Security Issues | | :------------ | :--------------------- | :------------------ | -|
📦 docker-local
└── 📁 image2
└── 📁 sha256:552c
└── sha256__aae9

| Not scanned | Not scanned | +|
📦 docker-local
└── 📁 image2
└── 📁 sha256:552c
└── sha256__aae9

| Not scanned | Not scanned | diff --git a/artifactory/utils/testdata/command_summaries/extended/generic-module.md b/artifactory/utils/testdata/command_summaries/extended/generic-module.md index 33e1fe0f1..c8d6e0aff 100644 --- a/artifactory/utils/testdata/command_summaries/extended/generic-module.md +++ b/artifactory/utils/testdata/command_summaries/extended/generic-module.md @@ -11,7 +11,7 @@
📦 generic-local
 └── 📁 path
     └── 📁 to
-        └── artifact2
+        └── artifact2
 
 
diff --git a/artifactory/utils/testdata/command_summaries/extended/maven-module.md b/artifactory/utils/testdata/command_summaries/extended/maven-module.md index c1454b39c..05eb108f6 100644 --- a/artifactory/utils/testdata/command_summaries/extended/maven-module.md +++ b/artifactory/utils/testdata/command_summaries/extended/maven-module.md @@ -11,7 +11,7 @@
📦 libs-release
 └── 📁 path
     └── 📁 to
-        └── artifact1
+        └── artifact1
 
 
diff --git a/artifactory/utils/testdata/command_summaries/extended/maven-nested-module.md b/artifactory/utils/testdata/command_summaries/extended/maven-nested-module.md index 5e6d5b90c..178250a80 100644 --- a/artifactory/utils/testdata/command_summaries/extended/maven-nested-module.md +++ b/artifactory/utils/testdata/command_summaries/extended/maven-nested-module.md @@ -12,7 +12,7 @@ 📦 libs-release └── 📁 path └── 📁 to - └── artifact2 + └── artifact2 @@ -22,7 +22,7 @@ 📦 libs-release └── 📁 path └── 📁 to - └── artifact3 + └── artifact3 diff --git a/artifactory/utils/testdata/command_summaries/extended/multiarch-docker-image.md b/artifactory/utils/testdata/command_summaries/extended/multiarch-docker-image.md index 5dfc53802..f3df8aea3 100644 --- a/artifactory/utils/testdata/command_summaries/extended/multiarch-docker-image.md +++ b/artifactory/utils/testdata/command_summaries/extended/multiarch-docker-image.md @@ -10,4 +10,4 @@ | Artifacts | Security Violations | Security Issues | | :------------ | :--------------------- | :------------------ | -|
linux/amd64/multiarch-image:1 (🐸 View)
📦 docker-local
└── 📁 multiarch-image
├── 📁 sha256:552c
│ └── sha256
└── sha256

| Not scanned | Not scanned | +|
linux/amd64/multiarch-image:1 (🐸 View)
📦 docker-local
└── 📁 multiarch-image
├── 📁 sha256:552c
│ └── sha256
└── sha256

| Not scanned | Not scanned |