diff --git a/lib/datadog/ci/ext/environment/extractor.rb b/lib/datadog/ci/ext/environment/extractor.rb index 1679d801..6b173b82 100644 --- a/lib/datadog/ci/ext/environment/extractor.rb +++ b/lib/datadog/ci/ext/environment/extractor.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true +require "datadog/core/utils/url" + require_relative "../git" require_relative "../../utils/git" -require_relative "../../utils/url" require_relative "providers" module Datadog @@ -76,7 +77,7 @@ def normalize_git! @tags[Git::TAG_TAG] = Utils::Git.normalize_ref(@tags[Git::TAG_TAG]) @tags[Git::TAG_BRANCH] = Utils::Git.normalize_ref(@tags[Git::TAG_BRANCH]) - @tags[Git::TAG_REPOSITORY_URL] = Utils::Url.filter_sensitive_info( + @tags[Git::TAG_REPOSITORY_URL] = Datadog::Core::Utils::Url.filter_basic_auth( @tags[Git::TAG_REPOSITORY_URL] ) end diff --git a/lib/datadog/ci/ext/environment/providers/github_actions.rb b/lib/datadog/ci/ext/environment/providers/github_actions.rb index 4fc51493..cd805673 100644 --- a/lib/datadog/ci/ext/environment/providers/github_actions.rb +++ b/lib/datadog/ci/ext/environment/providers/github_actions.rb @@ -2,8 +2,9 @@ require "json" +require "datadog/core/utils/url" + require_relative "base" -require_relative "../../../utils/url" module Datadog module CI @@ -79,7 +80,7 @@ def ci_env_vars def github_server_url return @github_server_url if defined?(@github_server_url) - @github_server_url ||= Utils::Url.filter_sensitive_info(env["GITHUB_SERVER_URL"]) + @github_server_url ||= Datadog::Core::Utils::Url.filter_basic_auth(env["GITHUB_SERVER_URL"]) end end end diff --git a/lib/datadog/ci/utils/url.rb b/lib/datadog/ci/utils/url.rb deleted file mode 100644 index 96cf0b7e..00000000 --- a/lib/datadog/ci/utils/url.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Datadog - module CI - module Utils - module Url - def self.filter_sensitive_info(url) - return nil if url.nil? - - url.gsub(%r{((https?|ssh)://)[^/]*@}, '\1') - end - end - end - end -end diff --git a/sig/datadog/ci/utils/url.rbs b/sig/datadog/ci/utils/url.rbs deleted file mode 100644 index ded91761..00000000 --- a/sig/datadog/ci/utils/url.rbs +++ /dev/null @@ -1,9 +0,0 @@ -module Datadog - module CI - module Utils - module Url - def self.filter_sensitive_info: (String? url) -> String? - end - end - end -end diff --git a/spec/support/fixtures/ci/azurepipelines.json b/spec/support/fixtures/ci/azurepipelines.json index 594da6d1..d072c273 100644 --- a/spec/support/fixtures/ci/azurepipelines.json +++ b/spec/support/fixtures/ci/azurepipelines.json @@ -650,6 +650,64 @@ "git.tag": "0.0.2" } ], + [ + { + "BUILD_BUILDID": "azure-pipelines-build-id", + "BUILD_DEFINITIONNAME": "azure-pipelines-name", + "BUILD_REPOSITORY_URI": "https://dev.azure.com/fabrikamfiber/repo", + "BUILD_REQUESTEDFOREMAIL": "azure-pipelines-commit-author-email@datadoghq.com", + "BUILD_REQUESTEDFORID": "azure-pipelines-commit-author", + "BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix", + "SYSTEM_JOBID": "azure-pipelines-job-id", + "SYSTEM_TASKINSTANCEID": "azure-pipelines-task-id", + "SYSTEM_TEAMFOUNDATIONSERVERURI": "https://azure-pipelines-server-uri.com/", + "SYSTEM_TEAMPROJECTID": "azure-pipelines-project-id", + "TF_BUILD": "True" + }, + { + "_dd.ci.env_vars": "{\"SYSTEM_TEAMPROJECTID\":\"azure-pipelines-project-id\",\"BUILD_BUILDID\":\"azure-pipelines-build-id\",\"SYSTEM_JOBID\":\"azure-pipelines-job-id\"}", + "ci.job.url": "https://azure-pipelines-server-uri.com/azure-pipelines-project-id/_build/results?buildId=azure-pipelines-build-id&view=logs&j=azure-pipelines-job-id&t=azure-pipelines-task-id", + "ci.pipeline.id": "azure-pipelines-build-id", + "ci.pipeline.name": "azure-pipelines-name", + "ci.pipeline.number": "azure-pipelines-build-id", + "ci.pipeline.url": "https://azure-pipelines-server-uri.com/azure-pipelines-project-id/_build/results?buildId=azure-pipelines-build-id", + "ci.provider.name": "azurepipelines", + "git.commit.author.email": "azure-pipelines-commit-author-email@datadoghq.com", + "git.commit.author.name": "azure-pipelines-commit-author", + "git.commit.message": "azure-pipelines-commit-message", + "git.repository_url": "https://dev.azure.com/fabrikamfiber/repo" + } + ], + [ + { + "BUILD_BUILDID": "azure-pipelines-build-id", + "BUILD_DEFINITIONNAME": "azure-pipelines-name", + "BUILD_REPOSITORY_URI": "ssh://host.xz:54321/path/to/repo/", + "BUILD_REQUESTEDFOREMAIL": "azure-pipelines-commit-author-email@datadoghq.com", + "BUILD_REQUESTEDFORID": "azure-pipelines-commit-author", + "BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix", + "SYSTEM_JOBID": "azure-pipelines-job-id", + "SYSTEM_TASKINSTANCEID": "azure-pipelines-task-id", + "SYSTEM_TEAMFOUNDATIONSERVERURI": "https://azure-pipelines-server-uri.com/", + "SYSTEM_TEAMPROJECTID": "azure-pipelines-project-id", + "TF_BUILD": "True" + }, + { + "_dd.ci.env_vars": "{\"SYSTEM_TEAMPROJECTID\":\"azure-pipelines-project-id\",\"BUILD_BUILDID\":\"azure-pipelines-build-id\",\"SYSTEM_JOBID\":\"azure-pipelines-job-id\"}", + "ci.job.url": "https://azure-pipelines-server-uri.com/azure-pipelines-project-id/_build/results?buildId=azure-pipelines-build-id&view=logs&j=azure-pipelines-job-id&t=azure-pipelines-task-id", + "ci.pipeline.id": "azure-pipelines-build-id", + "ci.pipeline.name": "azure-pipelines-name", + "ci.pipeline.number": "azure-pipelines-build-id", + "ci.pipeline.url": "https://azure-pipelines-server-uri.com/azure-pipelines-project-id/_build/results?buildId=azure-pipelines-build-id", + "ci.provider.name": "azurepipelines", + "git.commit.author.email": "azure-pipelines-commit-author-email@datadoghq.com", + "git.commit.author.name": "azure-pipelines-commit-author", + "git.commit.message": "azure-pipelines-commit-message", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "BUILD_BUILDID": "azure-pipelines-build-id", @@ -794,7 +852,7 @@ { "BUILD_BUILDID": "azure-pipelines-build-id", "BUILD_DEFINITIONNAME": "azure-pipelines-name", - "BUILD_REPOSITORY_URI": "ssh://user@host.xz:port/path/to/repo.git/", + "BUILD_REPOSITORY_URI": "ssh://user@host.xz:54321/path/to/repo.git/", "BUILD_REQUESTEDFOREMAIL": "azure-pipelines-commit-author-email@datadoghq.com", "BUILD_REQUESTEDFORID": "azure-pipelines-commit-author", "BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message", @@ -815,14 +873,14 @@ "git.commit.author.email": "azure-pipelines-commit-author-email@datadoghq.com", "git.commit.author.name": "azure-pipelines-commit-author", "git.commit.message": "azure-pipelines-commit-message", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ { "BUILD_BUILDID": "azure-pipelines-build-id", "BUILD_DEFINITIONNAME": "azure-pipelines-name", - "BUILD_REPOSITORY_URI": "ssh://user:password@host.xz:port/path/to/repo.git/", + "BUILD_REPOSITORY_URI": "ssh://user:password@host.xz:54321/path/to/repo.git/", "BUILD_REQUESTEDFOREMAIL": "azure-pipelines-commit-author-email@datadoghq.com", "BUILD_REQUESTEDFORID": "azure-pipelines-commit-author", "BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message", @@ -843,14 +901,14 @@ "git.commit.author.email": "azure-pipelines-commit-author-email@datadoghq.com", "git.commit.author.name": "azure-pipelines-commit-author", "git.commit.message": "azure-pipelines-commit-message", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ { "BUILD_BUILDID": "azure-pipelines-build-id", "BUILD_DEFINITIONNAME": "azure-pipelines-name", - "BUILD_REPOSITORY_URI": "ssh://user:password@1.1.1.1:port/path/to/repo.git/", + "BUILD_REPOSITORY_URI": "ssh://user:password@1.1.1.1:54321/path/to/repo.git/", "BUILD_REQUESTEDFOREMAIL": "azure-pipelines-commit-author-email@datadoghq.com", "BUILD_REQUESTEDFORID": "azure-pipelines-commit-author", "BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message", @@ -871,7 +929,7 @@ "git.commit.author.email": "azure-pipelines-commit-author-email@datadoghq.com", "git.commit.author.name": "azure-pipelines-commit-author", "git.commit.message": "azure-pipelines-commit-message", - "git.repository_url": "ssh://1.1.1.1:port/path/to/repo.git/" + "git.repository_url": "ssh://1.1.1.1:54321/path/to/repo.git/" } ] ] diff --git a/spec/support/fixtures/ci/bitbucket.json b/spec/support/fixtures/ci/bitbucket.json index 72d47cdf..bbd8cd37 100644 --- a/spec/support/fixtures/ci/bitbucket.json +++ b/spec/support/fixtures/ci/bitbucket.json @@ -400,6 +400,46 @@ "git.tag": "0.0.2" } ], + [ + { + "BITBUCKET_BUILD_NUMBER": "bitbucket-build-num", + "BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BITBUCKET_GIT_HTTP_ORIGIN": "https://bitbucket.org/DataDog/dogweb", + "BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}", + "BITBUCKET_REPO_FULL_NAME": "bitbucket-repo", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix" + }, + { + "ci.job.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", + "ci.pipeline.id": "bitbucket-uuid", + "ci.pipeline.name": "bitbucket-repo", + "ci.pipeline.number": "bitbucket-build-num", + "ci.pipeline.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", + "ci.provider.name": "bitbucket", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://bitbucket.org/DataDog/dogweb" + } + ], + [ + { + "BITBUCKET_BUILD_NUMBER": "bitbucket-build-num", + "BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BITBUCKET_GIT_HTTP_ORIGIN": "ssh://host.xz:54321/path/to/repo/", + "BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}", + "BITBUCKET_REPO_FULL_NAME": "bitbucket-repo", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix" + }, + { + "ci.job.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", + "ci.pipeline.id": "bitbucket-uuid", + "ci.pipeline.name": "bitbucket-repo", + "ci.pipeline.number": "bitbucket-build-num", + "ci.pipeline.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", + "ci.provider.name": "bitbucket", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "BITBUCKET_BUILD_NUMBER": "bitbucket-build-num", @@ -518,7 +558,7 @@ { "BITBUCKET_BUILD_NUMBER": "bitbucket-build-num", "BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "BITBUCKET_GIT_HTTP_ORIGIN": "ssh://user@host.xz:port/path/to/repo.git/", + "BITBUCKET_GIT_HTTP_ORIGIN": "ssh://user@host.xz:54321/path/to/repo.git/", "BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}", "BITBUCKET_REPO_FULL_NAME": "bitbucket-repo" }, @@ -530,14 +570,14 @@ "ci.pipeline.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", "ci.provider.name": "bitbucket", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ { "BITBUCKET_BUILD_NUMBER": "bitbucket-build-num", "BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "BITBUCKET_GIT_HTTP_ORIGIN": "ssh://user:password@host.xz:port/path/to/repo.git/", + "BITBUCKET_GIT_HTTP_ORIGIN": "ssh://user:password@host.xz:54321/path/to/repo.git/", "BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}", "BITBUCKET_REPO_FULL_NAME": "bitbucket-repo" }, @@ -549,7 +589,7 @@ "ci.pipeline.url": "https://bitbucket.org/bitbucket-repo/addon/pipelines/home#!/results/bitbucket-build-num", "ci.provider.name": "bitbucket", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ] ] diff --git a/spec/support/fixtures/ci/bitrise.json b/spec/support/fixtures/ci/bitrise.json index 6f5b52cd..579ace5d 100644 --- a/spec/support/fixtures/ci/bitrise.json +++ b/spec/support/fixtures/ci/bitrise.json @@ -479,6 +479,50 @@ "git.tag": "0.0.2" } ], + [ + { + "BITRISE_BUILD_NUMBER": "bitrise-pipeline-number", + "BITRISE_BUILD_SLUG": "bitrise-pipeline-id", + "BITRISE_BUILD_URL": "https://bitrise-build-url.com//", + "BITRISE_GIT_MESSAGE": "bitrise-git-commit-message", + "BITRISE_TRIGGERED_WORKFLOW_ID": "bitrise-pipeline-name", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix", + "GIT_CLONE_COMMIT_HASH": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "GIT_REPOSITORY_URL": "https://github.com/DataDog/dogweb" + }, + { + "ci.pipeline.id": "bitrise-pipeline-id", + "ci.pipeline.name": "bitrise-pipeline-name", + "ci.pipeline.number": "bitrise-pipeline-number", + "ci.pipeline.url": "https://bitrise-build-url.com//", + "ci.provider.name": "bitrise", + "git.commit.message": "bitrise-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/DataDog/dogweb" + } + ], + [ + { + "BITRISE_BUILD_NUMBER": "bitrise-pipeline-number", + "BITRISE_BUILD_SLUG": "bitrise-pipeline-id", + "BITRISE_BUILD_URL": "https://bitrise-build-url.com//", + "BITRISE_GIT_MESSAGE": "bitrise-git-commit-message", + "BITRISE_TRIGGERED_WORKFLOW_ID": "bitrise-pipeline-name", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix", + "GIT_CLONE_COMMIT_HASH": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "GIT_REPOSITORY_URL": "ssh://host.xz:54321/path/to/repo/" + }, + { + "ci.pipeline.id": "bitrise-pipeline-id", + "ci.pipeline.name": "bitrise-pipeline-name", + "ci.pipeline.number": "bitrise-pipeline-number", + "ci.pipeline.url": "https://bitrise-build-url.com//", + "ci.provider.name": "bitrise", + "git.commit.message": "bitrise-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "BITRISE_BUILD_NUMBER": "bitrise-pipeline-number", @@ -613,7 +657,7 @@ "BITRISE_GIT_MESSAGE": "bitrise-git-commit-message", "BITRISE_TRIGGERED_WORKFLOW_ID": "bitrise-pipeline-name", "GIT_CLONE_COMMIT_HASH": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "GIT_REPOSITORY_URL": "ssh://user@host.xz:port/path/to/repo.git/" + "GIT_REPOSITORY_URL": "ssh://user@host.xz:54321/path/to/repo.git/" }, { "ci.pipeline.id": "bitrise-pipeline-id", @@ -623,7 +667,7 @@ "ci.provider.name": "bitrise", "git.commit.message": "bitrise-git-commit-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ @@ -634,7 +678,7 @@ "BITRISE_GIT_MESSAGE": "bitrise-git-commit-message", "BITRISE_TRIGGERED_WORKFLOW_ID": "bitrise-pipeline-name", "GIT_CLONE_COMMIT_HASH": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "GIT_REPOSITORY_URL": "ssh://user:password@host.xz:port/path/to/repo.git/" + "GIT_REPOSITORY_URL": "ssh://user:password@host.xz:54321/path/to/repo.git/" }, { "ci.pipeline.id": "bitrise-pipeline-id", @@ -644,7 +688,7 @@ "ci.provider.name": "bitrise", "git.commit.message": "bitrise-git-commit-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ] ] diff --git a/spec/support/fixtures/ci/buddy.json b/spec/support/fixtures/ci/buddy.json index 007cc196..9c64a199 100644 --- a/spec/support/fixtures/ci/buddy.json +++ b/spec/support/fixtures/ci/buddy.json @@ -178,6 +178,68 @@ "git.tag": "v1.0" } ], + [ + { + "BUDDY": "true", + "BUDDY_EXECUTION_BRANCH": "master", + "BUDDY_EXECUTION_ID": "buddy-execution-id", + "BUDDY_EXECUTION_REVISION": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BUDDY_EXECUTION_REVISION_COMMITTER_EMAIL": "mikebenson@buddy.works", + "BUDDY_EXECUTION_REVISION_COMMITTER_NAME": "Mike Benson", + "BUDDY_EXECUTION_REVISION_MESSAGE": "Create buddy.yml", + "BUDDY_EXECUTION_TAG": "v1.0", + "BUDDY_EXECUTION_URL": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", + "BUDDY_PIPELINE_ID": "456", + "BUDDY_PIPELINE_NAME": "Deploy to Production", + "BUDDY_SCM_URL": "https://github.com/buddyworks/my-project", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix" + }, + { + "ci.pipeline.id": "456/buddy-execution-id", + "ci.pipeline.name": "Deploy to Production", + "ci.pipeline.number": "buddy-execution-id", + "ci.pipeline.url": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", + "ci.provider.name": "buddy", + "git.branch": "master", + "git.commit.committer.email": "mikebenson@buddy.works", + "git.commit.committer.name": "Mike Benson", + "git.commit.message": "Create buddy.yml", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/buddyworks/my-project", + "git.tag": "v1.0" + } + ], + [ + { + "BUDDY": "true", + "BUDDY_EXECUTION_BRANCH": "master", + "BUDDY_EXECUTION_ID": "buddy-execution-id", + "BUDDY_EXECUTION_REVISION": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BUDDY_EXECUTION_REVISION_COMMITTER_EMAIL": "mikebenson@buddy.works", + "BUDDY_EXECUTION_REVISION_COMMITTER_NAME": "Mike Benson", + "BUDDY_EXECUTION_REVISION_MESSAGE": "Create buddy.yml", + "BUDDY_EXECUTION_TAG": "v1.0", + "BUDDY_EXECUTION_URL": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", + "BUDDY_PIPELINE_ID": "456", + "BUDDY_PIPELINE_NAME": "Deploy to Production", + "BUDDY_SCM_URL": "ssh://host.xz:54321/path/to/repo/", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix" + }, + { + "ci.pipeline.id": "456/buddy-execution-id", + "ci.pipeline.name": "Deploy to Production", + "ci.pipeline.number": "buddy-execution-id", + "ci.pipeline.url": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", + "ci.provider.name": "buddy", + "git.branch": "master", + "git.commit.committer.email": "mikebenson@buddy.works", + "git.commit.committer.name": "Mike Benson", + "git.commit.message": "Create buddy.yml", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/", + "git.tag": "v1.0" + } + ], [ { "BUDDY": "true", @@ -371,7 +433,7 @@ "BUDDY_EXECUTION_URL": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", "BUDDY_PIPELINE_ID": "456", "BUDDY_PIPELINE_NAME": "Deploy to Production", - "BUDDY_SCM_URL": "ssh://user@host.xz:port/path/to/repo.git/" + "BUDDY_SCM_URL": "ssh://user@host.xz:54321/path/to/repo.git/" }, { "ci.pipeline.id": "456/buddy-execution-id", @@ -384,7 +446,7 @@ "git.commit.committer.name": "Mike Benson", "git.commit.message": "Create buddy.yml", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/", + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/", "git.tag": "v1.0" } ], @@ -401,7 +463,7 @@ "BUDDY_EXECUTION_URL": "https://app.buddy.works/myworkspace/my-project/pipelines/pipeline/456/execution/5d9dc42c422f5a268b389d08", "BUDDY_PIPELINE_ID": "456", "BUDDY_PIPELINE_NAME": "Deploy to Production", - "BUDDY_SCM_URL": "ssh://user:password@host.xz:port/path/to/repo.git/" + "BUDDY_SCM_URL": "ssh://user:password@host.xz:54321/path/to/repo.git/" }, { "ci.pipeline.id": "456/buddy-execution-id", @@ -414,7 +476,7 @@ "git.commit.committer.name": "Mike Benson", "git.commit.message": "Create buddy.yml", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/", + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/", "git.tag": "v1.0" } ] diff --git a/spec/support/fixtures/ci/buildkite.json b/spec/support/fixtures/ci/buildkite.json index 421904b2..86ff170d 100644 --- a/spec/support/fixtures/ci/buildkite.json +++ b/spec/support/fixtures/ci/buildkite.json @@ -673,6 +673,70 @@ "git.tag": "0.0.2" } ], + [ + { + "BUILDKITE": "true", + "BUILDKITE_BRANCH": "", + "BUILDKITE_BUILD_AUTHOR": "buildkite-git-commit-author-name", + "BUILDKITE_BUILD_AUTHOR_EMAIL": "buildkite-git-commit-author-email@datadoghq.com", + "BUILDKITE_BUILD_ID": "buildkite-pipeline-id", + "BUILDKITE_BUILD_NUMBER": "buildkite-pipeline-number", + "BUILDKITE_BUILD_URL": "https://buildkite-build-url.com", + "BUILDKITE_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BUILDKITE_JOB_ID": "buildkite-job-id", + "BUILDKITE_MESSAGE": "buildkite-git-commit-message", + "BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name", + "BUILDKITE_REPO": "https://github.com/DataDog/dogweb", + "BUILDKITE_TAG": "", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix" + }, + { + "_dd.ci.env_vars": "{\"BUILDKITE_BUILD_ID\":\"buildkite-pipeline-id\",\"BUILDKITE_JOB_ID\":\"buildkite-job-id\"}", + "ci.job.url": "https://buildkite-build-url.com#buildkite-job-id", + "ci.pipeline.id": "buildkite-pipeline-id", + "ci.pipeline.name": "buildkite-pipeline-name", + "ci.pipeline.number": "buildkite-pipeline-number", + "ci.pipeline.url": "https://buildkite-build-url.com", + "ci.provider.name": "buildkite", + "git.commit.author.email": "buildkite-git-commit-author-email@datadoghq.com", + "git.commit.author.name": "buildkite-git-commit-author-name", + "git.commit.message": "buildkite-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/DataDog/dogweb" + } + ], + [ + { + "BUILDKITE": "true", + "BUILDKITE_BRANCH": "", + "BUILDKITE_BUILD_AUTHOR": "buildkite-git-commit-author-name", + "BUILDKITE_BUILD_AUTHOR_EMAIL": "buildkite-git-commit-author-email@datadoghq.com", + "BUILDKITE_BUILD_ID": "buildkite-pipeline-id", + "BUILDKITE_BUILD_NUMBER": "buildkite-pipeline-number", + "BUILDKITE_BUILD_URL": "https://buildkite-build-url.com", + "BUILDKITE_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "BUILDKITE_JOB_ID": "buildkite-job-id", + "BUILDKITE_MESSAGE": "buildkite-git-commit-message", + "BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name", + "BUILDKITE_REPO": "ssh://host.xz:54321/path/to/repo/", + "BUILDKITE_TAG": "", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix" + }, + { + "_dd.ci.env_vars": "{\"BUILDKITE_BUILD_ID\":\"buildkite-pipeline-id\",\"BUILDKITE_JOB_ID\":\"buildkite-job-id\"}", + "ci.job.url": "https://buildkite-build-url.com#buildkite-job-id", + "ci.pipeline.id": "buildkite-pipeline-id", + "ci.pipeline.name": "buildkite-pipeline-name", + "ci.pipeline.number": "buildkite-pipeline-number", + "ci.pipeline.url": "https://buildkite-build-url.com", + "ci.provider.name": "buildkite", + "git.commit.author.email": "buildkite-git-commit-author-email@datadoghq.com", + "git.commit.author.name": "buildkite-git-commit-author-name", + "git.commit.message": "buildkite-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "BUILDKITE": "true", @@ -872,7 +936,7 @@ "BUILDKITE_JOB_ID": "buildkite-job-id", "BUILDKITE_MESSAGE": "buildkite-git-commit-message", "BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name", - "BUILDKITE_REPO": "ssh://user@host.xz:port/path/to/repo.git/", + "BUILDKITE_REPO": "ssh://user@host.xz:54321/path/to/repo.git/", "BUILDKITE_TAG": "" }, { @@ -887,7 +951,7 @@ "git.commit.author.name": "buildkite-git-commit-author-name", "git.commit.message": "buildkite-git-commit-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ @@ -903,7 +967,7 @@ "BUILDKITE_JOB_ID": "buildkite-job-id", "BUILDKITE_MESSAGE": "buildkite-git-commit-message", "BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name", - "BUILDKITE_REPO": "ssh://user:password@host.xz:port/path/to/repo.git/", + "BUILDKITE_REPO": "ssh://user:password@host.xz:54321/path/to/repo.git/", "BUILDKITE_TAG": "" }, { @@ -918,7 +982,7 @@ "git.commit.author.name": "buildkite-git-commit-author-name", "git.commit.message": "buildkite-git-commit-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ diff --git a/spec/support/fixtures/ci/circleci.json b/spec/support/fixtures/ci/circleci.json index b9065be3..2a697af3 100644 --- a/spec/support/fixtures/ci/circleci.json +++ b/spec/support/fixtures/ci/circleci.json @@ -519,6 +519,54 @@ "git.tag": "0.0.2" } ], + [ + { + "CIRCLECI": "circleCI", + "CIRCLE_BUILD_NUM": "circleci-pipeline-number", + "CIRCLE_BUILD_URL": "https://circleci-build-url.com/", + "CIRCLE_JOB": "circleci-job-name", + "CIRCLE_PROJECT_REPONAME": "circleci-pipeline-name", + "CIRCLE_REPOSITORY_URL": "https://github.com/DataDog/dogweb", + "CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "CIRCLE_WORKFLOW_ID": "circleci-pipeline-id", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix" + }, + { + "_dd.ci.env_vars": "{\"CIRCLE_WORKFLOW_ID\":\"circleci-pipeline-id\",\"CIRCLE_BUILD_NUM\":\"circleci-pipeline-number\"}", + "ci.job.name": "circleci-job-name", + "ci.job.url": "https://circleci-build-url.com/", + "ci.pipeline.id": "circleci-pipeline-id", + "ci.pipeline.name": "circleci-pipeline-name", + "ci.pipeline.url": "https://app.circleci.com/pipelines/workflows/circleci-pipeline-id", + "ci.provider.name": "circleci", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/DataDog/dogweb" + } + ], + [ + { + "CIRCLECI": "circleCI", + "CIRCLE_BUILD_NUM": "circleci-pipeline-number", + "CIRCLE_BUILD_URL": "https://circleci-build-url.com/", + "CIRCLE_JOB": "circleci-job-name", + "CIRCLE_PROJECT_REPONAME": "circleci-pipeline-name", + "CIRCLE_REPOSITORY_URL": "ssh://host.xz:54321/path/to/repo/", + "CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "CIRCLE_WORKFLOW_ID": "circleci-pipeline-id", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix" + }, + { + "_dd.ci.env_vars": "{\"CIRCLE_WORKFLOW_ID\":\"circleci-pipeline-id\",\"CIRCLE_BUILD_NUM\":\"circleci-pipeline-number\"}", + "ci.job.name": "circleci-job-name", + "ci.job.url": "https://circleci-build-url.com/", + "ci.pipeline.id": "circleci-pipeline-id", + "ci.pipeline.name": "circleci-pipeline-name", + "ci.pipeline.url": "https://app.circleci.com/pipelines/workflows/circleci-pipeline-id", + "ci.provider.name": "circleci", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "CIRCLECI": "circleCI", @@ -664,7 +712,7 @@ "CIRCLE_BUILD_URL": "https://circleci-build-url.com/", "CIRCLE_JOB": "circleci-job-name", "CIRCLE_PROJECT_REPONAME": "circleci-pipeline-name", - "CIRCLE_REPOSITORY_URL": "ssh://user@host.xz:port/path/to/repo.git/", + "CIRCLE_REPOSITORY_URL": "ssh://user@host.xz:54321/path/to/repo.git/", "CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", "CIRCLE_WORKFLOW_ID": "circleci-pipeline-id" }, @@ -677,7 +725,7 @@ "ci.pipeline.url": "https://app.circleci.com/pipelines/workflows/circleci-pipeline-id", "ci.provider.name": "circleci", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ @@ -687,7 +735,7 @@ "CIRCLE_BUILD_URL": "https://circleci-build-url.com/", "CIRCLE_JOB": "circleci-job-name", "CIRCLE_PROJECT_REPONAME": "circleci-pipeline-name", - "CIRCLE_REPOSITORY_URL": "ssh://user:password@host.xz:port/path/to/repo.git/", + "CIRCLE_REPOSITORY_URL": "ssh://user:password@host.xz:54321/path/to/repo.git/", "CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", "CIRCLE_WORKFLOW_ID": "circleci-pipeline-id" }, @@ -700,7 +748,7 @@ "ci.pipeline.url": "https://app.circleci.com/pipelines/workflows/circleci-pipeline-id", "ci.provider.name": "circleci", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ] ] diff --git a/spec/support/fixtures/ci/codefresh.json b/spec/support/fixtures/ci/codefresh.json index 7b1367b4..d719df10 100644 --- a/spec/support/fixtures/ci/codefresh.json +++ b/spec/support/fixtures/ci/codefresh.json @@ -158,167 +158,5 @@ "git.repository_url": "git@github.com:DataDog/userrepo.git", "git.tag": "0.0.2" } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@github.com/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://github.com/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user@github.com/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://github.com/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@github.com:1234/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://github.com:1234/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://1.1.1.1/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://1.1.1.1/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1:1234/DataDog/dogweb.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://1.1.1.1:1234/DataDog/dogweb.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1:1234/DataDog/dogweb_with_@_yeah.git" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "https://1.1.1.1:1234/DataDog/dogweb_with_@_yeah.git" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "ssh://user@host.xz:port/path/to/repo.git/" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" - } - ], - [ - { - "CF_BUILD_ID": "6410367cee516146a4c4c66e", - "CF_BUILD_URL": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "CF_PIPELINE_NAME": "My simple project/Example Java Project Pipeline", - "CF_STEP_NAME": "mah-job-name", - "DD_GIT_REPOSITORY_URL": "ssh://user:password@host.xz:port/path/to/repo.git/" - }, - { - "_dd.ci.env_vars": "{\"CF_BUILD_ID\":\"6410367cee516146a4c4c66e\"}", - "ci.job.name": "mah-job-name", - "ci.pipeline.id": "6410367cee516146a4c4c66e", - "ci.pipeline.name": "My simple project/Example Java Project Pipeline", - "ci.pipeline.url": "https://g.codefresh.io/build/6410367cee516146a4c4c66e", - "ci.provider.name": "codefresh", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" - } ] ] diff --git a/spec/support/fixtures/ci/gitlab.json b/spec/support/fixtures/ci/gitlab.json index 400d99c9..24882c1e 100644 --- a/spec/support/fixtures/ci/gitlab.json +++ b/spec/support/fixtures/ci/gitlab.json @@ -451,6 +451,88 @@ "git.tag": "0.1.0" } ], + [ + { + "CI_COMMIT_AUTHOR": "John Doe ", + "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", + "CI_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", + "CI_JOB_ID": "gitlab-job-id", + "CI_JOB_NAME": "gitlab-job-name", + "CI_JOB_STAGE": "gitlab-stage-name", + "CI_JOB_URL": "https://gitlab.com/job", + "CI_PIPELINE_ID": "gitlab-pipeline-id", + "CI_PIPELINE_IID": "gitlab-pipeline-number", + "CI_PIPELINE_URL": "https://foo/repo/-/pipelines/1234", + "CI_PROJECT_DIR": "/foo/bar", + "CI_PROJECT_PATH": "gitlab-pipeline-name", + "CI_PROJECT_URL": "https://gitlab.com/repo", + "CI_REPOSITORY_URL": "http://hostname.com/repo", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix", + "GITLAB_CI": "gitlab" + }, + { + "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"https://gitlab.com/repo\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", + "ci.job.name": "gitlab-job-name", + "ci.job.url": "https://gitlab.com/job", + "ci.pipeline.id": "gitlab-pipeline-id", + "ci.pipeline.name": "gitlab-pipeline-name", + "ci.pipeline.number": "gitlab-pipeline-number", + "ci.pipeline.url": "https://foo/repo/-/pipelines/1234", + "ci.provider.name": "gitlab", + "ci.stage.name": "gitlab-stage-name", + "ci.workspace_path": "/foo/bar", + "git.branch": "master", + "git.commit.author.date": "2021-07-21T11:43:07-04:00", + "git.commit.author.email": "john@doe.com", + "git.commit.author.name": "John Doe", + "git.commit.message": "gitlab-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "http://hostname.com/repo" + } + ], + [ + { + "CI_COMMIT_AUTHOR": "John Doe ", + "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", + "CI_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", + "CI_JOB_ID": "gitlab-job-id", + "CI_JOB_NAME": "gitlab-job-name", + "CI_JOB_STAGE": "gitlab-stage-name", + "CI_JOB_URL": "https://gitlab.com/job", + "CI_PIPELINE_ID": "gitlab-pipeline-id", + "CI_PIPELINE_IID": "gitlab-pipeline-number", + "CI_PIPELINE_URL": "https://foo/repo/-/pipelines/1234", + "CI_PROJECT_DIR": "/foo/bar", + "CI_PROJECT_PATH": "gitlab-pipeline-name", + "CI_PROJECT_URL": "https://gitlab.com/repo", + "CI_REPOSITORY_URL": "ssh://host.xz:54321/path/to/repo/", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix", + "GITLAB_CI": "gitlab" + }, + { + "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"https://gitlab.com/repo\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", + "ci.job.name": "gitlab-job-name", + "ci.job.url": "https://gitlab.com/job", + "ci.pipeline.id": "gitlab-pipeline-id", + "ci.pipeline.name": "gitlab-pipeline-name", + "ci.pipeline.number": "gitlab-pipeline-number", + "ci.pipeline.url": "https://foo/repo/-/pipelines/1234", + "ci.provider.name": "gitlab", + "ci.stage.name": "gitlab-stage-name", + "ci.workspace_path": "/foo/bar", + "git.branch": "master", + "git.commit.author.date": "2021-07-21T11:43:07-04:00", + "git.commit.author.email": "john@doe.com", + "git.commit.author.name": "John Doe", + "git.commit.message": "gitlab-git-commit-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "CI_COMMIT_AUTHOR": "John Doe ", diff --git a/spec/support/fixtures/ci/jenkins.json b/spec/support/fixtures/ci/jenkins.json index f87cdbd2..38d44874 100644 --- a/spec/support/fixtures/ci/jenkins.json +++ b/spec/support/fixtures/ci/jenkins.json @@ -666,6 +666,50 @@ "git.tag": "0.0.2" } ], + [ + { + "BUILD_NUMBER": "jenkins-pipeline-number", + "BUILD_TAG": "jenkins-pipeline-id", + "BUILD_URL": "https://jenkins.com/pipeline", + "DD_CUSTOM_TRACE_ID": "jenkins-custom-trace-id", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix", + "GIT_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "GIT_URL_1": "https://github.com/DataDog/dogweb", + "JENKINS_URL": "jenkins", + "JOB_URL": "https://jenkins.com/job" + }, + { + "_dd.ci.env_vars": "{\"DD_CUSTOM_TRACE_ID\":\"jenkins-custom-trace-id\"}", + "ci.pipeline.id": "jenkins-pipeline-id", + "ci.pipeline.number": "jenkins-pipeline-number", + "ci.pipeline.url": "https://jenkins.com/pipeline", + "ci.provider.name": "jenkins", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/DataDog/dogweb" + } + ], + [ + { + "BUILD_NUMBER": "jenkins-pipeline-number", + "BUILD_TAG": "jenkins-pipeline-id", + "BUILD_URL": "https://jenkins.com/pipeline", + "DD_CUSTOM_TRACE_ID": "jenkins-custom-trace-id", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix", + "GIT_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "GIT_URL_1": "ssh://host.xz:54321/path/to/repo/", + "JENKINS_URL": "jenkins", + "JOB_URL": "https://jenkins.com/job" + }, + { + "_dd.ci.env_vars": "{\"DD_CUSTOM_TRACE_ID\":\"jenkins-custom-trace-id\"}", + "ci.pipeline.id": "jenkins-pipeline-id", + "ci.pipeline.number": "jenkins-pipeline-number", + "ci.pipeline.url": "https://jenkins.com/pipeline", + "ci.provider.name": "jenkins", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "BUILD_NUMBER": "jenkins-pipeline-number", @@ -799,7 +843,7 @@ "BUILD_URL": "https://jenkins.com/pipeline", "DD_CUSTOM_TRACE_ID": "jenkins-custom-trace-id", "GIT_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "GIT_URL_1": "ssh://user@host.xz:port/path/to/repo.git/", + "GIT_URL_1": "ssh://user@host.xz:54321/path/to/repo.git/", "JENKINS_URL": "jenkins", "JOB_URL": "https://jenkins.com/job" }, @@ -810,7 +854,7 @@ "ci.pipeline.url": "https://jenkins.com/pipeline", "ci.provider.name": "jenkins", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ @@ -820,7 +864,7 @@ "BUILD_URL": "https://jenkins.com/pipeline", "DD_CUSTOM_TRACE_ID": "jenkins-custom-trace-id", "GIT_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "GIT_URL_1": "ssh://user:password@host.xz:port/path/to/repo.git/", + "GIT_URL_1": "ssh://user:password@host.xz:54321/path/to/repo.git/", "JENKINS_URL": "jenkins", "JOB_URL": "https://jenkins.com/job" }, @@ -831,7 +875,7 @@ "ci.pipeline.url": "https://jenkins.com/pipeline", "ci.provider.name": "jenkins", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ diff --git a/spec/support/fixtures/ci/teamcity.json b/spec/support/fixtures/ci/teamcity.json index 037887c4..086c1c16 100644 --- a/spec/support/fixtures/ci/teamcity.json +++ b/spec/support/fixtures/ci/teamcity.json @@ -74,117 +74,5 @@ "git.repository_url": "git@github.com:DataDog/userrepo.git", "git.tag": "0.0.2" } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user:password@github.com/DataDog/dogweb.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://github.com/DataDog/dogweb.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user@github.com/DataDog/dogweb.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://github.com/DataDog/dogweb.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user:password@github.com:1234/DataDog/dogweb.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://github.com:1234/DataDog/dogweb.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1/DataDog/dogweb.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://1.1.1.1/DataDog/dogweb.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1:1234/DataDog/dogweb.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://1.1.1.1:1234/DataDog/dogweb.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "https://user:password@1.1.1.1:1234/DataDog/dogweb_with_@_yeah.git", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "https://1.1.1.1:1234/DataDog/dogweb_with_@_yeah.git" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "ssh://user@host.xz:port/path/to/repo.git/", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" - } - ], - [ - { - "BUILD_URL": "https://teamcity.com/repo", - "DD_GIT_REPOSITORY_URL": "ssh://user:password@host.xz:port/path/to/repo.git/", - "TEAMCITY_BUILDCONF_NAME": "Test 1", - "TEAMCITY_VERSION": "2022.10 (build 116751)" - }, - { - "ci.job.name": "Test 1", - "ci.job.url": "https://teamcity.com/repo", - "ci.provider.name": "teamcity", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" - } ] ] diff --git a/spec/support/fixtures/ci/usersupplied.json b/spec/support/fixtures/ci/usersupplied.json index 464c4158..f07f4e37 100644 --- a/spec/support/fixtures/ci/usersupplied.json +++ b/spec/support/fixtures/ci/usersupplied.json @@ -155,6 +155,56 @@ "git.tag": "0.0.2" } ], + [ + { + "DD_GIT_COMMIT_AUTHOR_DATE": "usersupplied-authordate", + "DD_GIT_COMMIT_AUTHOR_EMAIL": "usersupplied-authoremail", + "DD_GIT_COMMIT_AUTHOR_NAME": "usersupplied-authorname", + "DD_GIT_COMMIT_COMMITTER_DATE": "usersupplied-comitterdate", + "DD_GIT_COMMIT_COMMITTER_EMAIL": "usersupplied-comitteremail", + "DD_GIT_COMMIT_COMMITTER_NAME": "usersupplied-comittername", + "DD_GIT_COMMIT_MESSAGE": "usersupplied-message", + "DD_GIT_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "DD_GIT_REPOSITORY_URL": "https://github.com/DataDog/dogweb", + "DD_TEST_CASE_NAME": "http-repository-url-no-git-suffix" + }, + { + "git.commit.author.date": "usersupplied-authordate", + "git.commit.author.email": "usersupplied-authoremail", + "git.commit.author.name": "usersupplied-authorname", + "git.commit.committer.date": "usersupplied-comitterdate", + "git.commit.committer.email": "usersupplied-comitteremail", + "git.commit.committer.name": "usersupplied-comittername", + "git.commit.message": "usersupplied-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "https://github.com/DataDog/dogweb" + } + ], + [ + { + "DD_GIT_COMMIT_AUTHOR_DATE": "usersupplied-authordate", + "DD_GIT_COMMIT_AUTHOR_EMAIL": "usersupplied-authoremail", + "DD_GIT_COMMIT_AUTHOR_NAME": "usersupplied-authorname", + "DD_GIT_COMMIT_COMMITTER_DATE": "usersupplied-comitterdate", + "DD_GIT_COMMIT_COMMITTER_EMAIL": "usersupplied-comitteremail", + "DD_GIT_COMMIT_COMMITTER_NAME": "usersupplied-comittername", + "DD_GIT_COMMIT_MESSAGE": "usersupplied-message", + "DD_GIT_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "DD_GIT_REPOSITORY_URL": "ssh://host.xz:54321/path/to/repo/", + "DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix" + }, + { + "git.commit.author.date": "usersupplied-authordate", + "git.commit.author.email": "usersupplied-authoremail", + "git.commit.author.name": "usersupplied-authorname", + "git.commit.committer.date": "usersupplied-comitterdate", + "git.commit.committer.email": "usersupplied-comitteremail", + "git.commit.committer.name": "usersupplied-comittername", + "git.commit.message": "usersupplied-message", + "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", + "git.repository_url": "ssh://host.xz:54321/path/to/repo/" + } + ], [ { "DD_GIT_COMMIT_AUTHOR_DATE": "usersupplied-authordate", @@ -309,7 +359,7 @@ "DD_GIT_COMMIT_COMMITTER_NAME": "usersupplied-comittername", "DD_GIT_COMMIT_MESSAGE": "usersupplied-message", "DD_GIT_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "DD_GIT_REPOSITORY_URL": "ssh://user@host.xz:port/path/to/repo.git/" + "DD_GIT_REPOSITORY_URL": "ssh://user@host.xz:54321/path/to/repo.git/" }, { "git.commit.author.date": "usersupplied-authordate", @@ -320,7 +370,7 @@ "git.commit.committer.name": "usersupplied-comittername", "git.commit.message": "usersupplied-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ], [ @@ -333,7 +383,7 @@ "DD_GIT_COMMIT_COMMITTER_NAME": "usersupplied-comittername", "DD_GIT_COMMIT_MESSAGE": "usersupplied-message", "DD_GIT_COMMIT_SHA": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "DD_GIT_REPOSITORY_URL": "ssh://user:password@host.xz:port/path/to/repo.git/" + "DD_GIT_REPOSITORY_URL": "ssh://user:password@host.xz:54321/path/to/repo.git/" }, { "git.commit.author.date": "usersupplied-authordate", @@ -344,7 +394,7 @@ "git.commit.committer.name": "usersupplied-comittername", "git.commit.message": "usersupplied-message", "git.commit.sha": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123", - "git.repository_url": "ssh://host.xz:port/path/to/repo.git/" + "git.repository_url": "ssh://host.xz:54321/path/to/repo.git/" } ] ] diff --git a/vendor/rbs/ddtrace/0/datadog/core/utils/url.rbs b/vendor/rbs/ddtrace/0/datadog/core/utils/url.rbs new file mode 100644 index 00000000..51b651c6 --- /dev/null +++ b/vendor/rbs/ddtrace/0/datadog/core/utils/url.rbs @@ -0,0 +1,9 @@ +module Datadog + module Core + module Utils + module Url + def self?.filter_basic_auth: (::String? url) -> ::String? + end + end + end +end