Skip to content

Commit

Permalink
[test optimization] Add support for Drone CI (#5304)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariovido authored and sabrenner committed Feb 24, 2025
1 parent b970992 commit 969b28a
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 52 deletions.
32 changes: 32 additions & 0 deletions packages/dd-trace/src/plugins/util/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,38 @@ module.exports = {
}
}

if (env.DRONE && env.CI) {
const {
DRONE_BUILD_NUMBER,
DRONE_BUILD_LINK,
DRONE_STEP_NAME,
DRONE_STAGE_NAME,
DRONE_WORKSPACE,
DRONE_GIT_HTTP_URL,
DRONE_COMMIT_SHA,
DRONE_BRANCH,
DRONE_TAG,
DRONE_COMMIT_AUTHOR_NAME,
DRONE_COMMIT_AUTHOR_EMAIL,
DRONE_COMMIT_MESSAGE
} = env
tags = {
[CI_PROVIDER_NAME]: 'drone',
[CI_PIPELINE_NUMBER]: DRONE_BUILD_NUMBER,
[CI_PIPELINE_URL]: DRONE_BUILD_LINK,
[CI_JOB_NAME]: DRONE_STEP_NAME,
[CI_STAGE_NAME]: DRONE_STAGE_NAME,
[CI_WORKSPACE_PATH]: DRONE_WORKSPACE,
[GIT_REPOSITORY_URL]: DRONE_GIT_HTTP_URL,
[GIT_COMMIT_SHA]: DRONE_COMMIT_SHA,
[GIT_BRANCH]: DRONE_BRANCH,
[GIT_TAG]: DRONE_TAG,
[GIT_COMMIT_AUTHOR_NAME]: DRONE_COMMIT_AUTHOR_NAME,
[GIT_COMMIT_AUTHOR_EMAIL]: DRONE_COMMIT_AUTHOR_EMAIL,
[GIT_COMMIT_MESSAGE]: DRONE_COMMIT_MESSAGE
}
}

normalizeTag(tags, CI_WORKSPACE_PATH, resolveTilde)
normalizeTag(tags, GIT_REPOSITORY_URL, filterSensitiveInfoFromRepository)
normalizeTag(tags, GIT_BRANCH, normalizeRef)
Expand Down
16 changes: 8 additions & 8 deletions packages/dd-trace/test/plugins/util/ci-env/azurepipelines.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@
{
"BUILD_BUILDID": "azure-pipelines-build-id",
"BUILD_DEFINITIONNAME": "azure-pipelines-name",
"BUILD_REPOSITORY_URI": "ssh://host.xz:port/path/to/repo/",
"BUILD_REPOSITORY_URI": "ssh://host.xz:54321/path/to/repo/",
"BUILD_REQUESTEDFOREMAIL": "[email protected]",
"BUILD_REQUESTEDFORID": "azure-pipelines-commit-author",
"BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message",
Expand All @@ -705,7 +705,7 @@
"git.commit.author.email": "[email protected]",
"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.repository_url": "ssh://host.xz:54321/path/to/repo/"
}
],
[
Expand Down Expand Up @@ -852,7 +852,7 @@
{
"BUILD_BUILDID": "azure-pipelines-build-id",
"BUILD_DEFINITIONNAME": "azure-pipelines-name",
"BUILD_REPOSITORY_URI": "ssh://[email protected]:port/path/to/repo.git/",
"BUILD_REPOSITORY_URI": "ssh://[email protected]:54321/path/to/repo.git/",
"BUILD_REQUESTEDFOREMAIL": "[email protected]",
"BUILD_REQUESTEDFORID": "azure-pipelines-commit-author",
"BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message",
Expand All @@ -873,14 +873,14 @@
"git.commit.author.email": "[email protected]",
"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:[email protected]:port/path/to/repo.git/",
"BUILD_REPOSITORY_URI": "ssh://user:[email protected]:54321/path/to/repo.git/",
"BUILD_REQUESTEDFOREMAIL": "[email protected]",
"BUILD_REQUESTEDFORID": "azure-pipelines-commit-author",
"BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message",
Expand All @@ -901,14 +901,14 @@
"git.commit.author.email": "[email protected]",
"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:[email protected]:port/path/to/repo.git/",
"BUILD_REPOSITORY_URI": "ssh://user:[email protected]:54321/path/to/repo.git/",
"BUILD_REQUESTEDFOREMAIL": "[email protected]",
"BUILD_REQUESTEDFORID": "azure-pipelines-commit-author",
"BUILD_SOURCEVERSIONMESSAGE": "azure-pipelines-commit-message",
Expand All @@ -929,7 +929,7 @@
"git.commit.author.email": "[email protected]",
"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/"
}
]
]
12 changes: 6 additions & 6 deletions packages/dd-trace/test/plugins/util/ci-env/bitbucket.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
{
"BITBUCKET_BUILD_NUMBER": "bitbucket-build-num",
"BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123",
"BITBUCKET_GIT_HTTP_ORIGIN": "ssh://host.xz:port/path/to/repo/",
"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"
Expand All @@ -437,7 +437,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.repository_url": "ssh://host.xz:54321/path/to/repo/"
}
],
[
Expand Down Expand Up @@ -558,7 +558,7 @@
{
"BITBUCKET_BUILD_NUMBER": "bitbucket-build-num",
"BITBUCKET_COMMIT": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123",
"BITBUCKET_GIT_HTTP_ORIGIN": "ssh://[email protected]:port/path/to/repo.git/",
"BITBUCKET_GIT_HTTP_ORIGIN": "ssh://[email protected]:54321/path/to/repo.git/",
"BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}",
"BITBUCKET_REPO_FULL_NAME": "bitbucket-repo"
},
Expand All @@ -570,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:[email protected]:port/path/to/repo.git/",
"BITBUCKET_GIT_HTTP_ORIGIN": "ssh://user:[email protected]:54321/path/to/repo.git/",
"BITBUCKET_PIPELINE_UUID": "{bitbucket-uuid}",
"BITBUCKET_REPO_FULL_NAME": "bitbucket-repo"
},
Expand All @@ -589,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/"
}
]
]
12 changes: 6 additions & 6 deletions packages/dd-trace/test/plugins/util/ci-env/bitrise.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
"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:port/path/to/repo/"
"GIT_REPOSITORY_URL": "ssh://host.xz:54321/path/to/repo/"
},
{
"ci.pipeline.id": "bitrise-pipeline-id",
Expand All @@ -520,7 +520,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.repository_url": "ssh://host.xz:54321/path/to/repo/"
}
],
[
Expand Down Expand Up @@ -657,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://[email protected]:port/path/to/repo.git/"
"GIT_REPOSITORY_URL": "ssh://[email protected]:54321/path/to/repo.git/"
},
{
"ci.pipeline.id": "bitrise-pipeline-id",
Expand All @@ -667,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/"
}
],
[
Expand All @@ -678,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:[email protected]:port/path/to/repo.git/"
"GIT_REPOSITORY_URL": "ssh://user:[email protected]:54321/path/to/repo.git/"
},
{
"ci.pipeline.id": "bitrise-pipeline-id",
Expand All @@ -688,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/"
}
]
]
12 changes: 6 additions & 6 deletions packages/dd-trace/test/plugins/util/ci-env/buddy.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,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://host.xz:port/path/to/repo/",
"BUDDY_SCM_URL": "ssh://host.xz:54321/path/to/repo/",
"DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix"
},
{
Expand All @@ -236,7 +236,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.repository_url": "ssh://host.xz:54321/path/to/repo/",
"git.tag": "v1.0"
}
],
Expand Down Expand Up @@ -433,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://[email protected]:port/path/to/repo.git/"
"BUDDY_SCM_URL": "ssh://[email protected]:54321/path/to/repo.git/"
},
{
"ci.pipeline.id": "456/buddy-execution-id",
Expand All @@ -446,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"
}
],
Expand All @@ -463,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:[email protected]:port/path/to/repo.git/"
"BUDDY_SCM_URL": "ssh://user:[email protected]:54321/path/to/repo.git/"
},
{
"ci.pipeline.id": "456/buddy-execution-id",
Expand All @@ -476,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"
}
]
Expand Down
12 changes: 6 additions & 6 deletions packages/dd-trace/test/plugins/util/ci-env/buildkite.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
"BUILDKITE_JOB_ID": "buildkite-job-id",
"BUILDKITE_MESSAGE": "buildkite-git-commit-message",
"BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name",
"BUILDKITE_REPO": "ssh://host.xz:port/path/to/repo/",
"BUILDKITE_REPO": "ssh://host.xz:54321/path/to/repo/",
"BUILDKITE_TAG": "",
"DD_TEST_CASE_NAME": "ssh-repository-url-no-git-suffix"
},
Expand All @@ -734,7 +734,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.repository_url": "ssh://host.xz:54321/path/to/repo/"
}
],
[
Expand Down Expand Up @@ -936,7 +936,7 @@
"BUILDKITE_JOB_ID": "buildkite-job-id",
"BUILDKITE_MESSAGE": "buildkite-git-commit-message",
"BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name",
"BUILDKITE_REPO": "ssh://[email protected]:port/path/to/repo.git/",
"BUILDKITE_REPO": "ssh://[email protected]:54321/path/to/repo.git/",
"BUILDKITE_TAG": ""
},
{
Expand All @@ -951,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/"
}
],
[
Expand All @@ -967,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:[email protected]:port/path/to/repo.git/",
"BUILDKITE_REPO": "ssh://user:[email protected]:54321/path/to/repo.git/",
"BUILDKITE_TAG": ""
},
{
Expand All @@ -982,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/"
}
],
[
Expand Down
12 changes: 6 additions & 6 deletions packages/dd-trace/test/plugins/util/ci-env/circleci.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
"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:port/path/to/repo/",
"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"
Expand All @@ -564,7 +564,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.repository_url": "ssh://host.xz:54321/path/to/repo/"
}
],
[
Expand Down Expand Up @@ -712,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://[email protected]:port/path/to/repo.git/",
"CIRCLE_REPOSITORY_URL": "ssh://[email protected]:54321/path/to/repo.git/",
"CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123",
"CIRCLE_WORKFLOW_ID": "circleci-pipeline-id"
},
Expand All @@ -725,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/"
}
],
[
Expand All @@ -735,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:[email protected]:port/path/to/repo.git/",
"CIRCLE_REPOSITORY_URL": "ssh://user:[email protected]:54321/path/to/repo.git/",
"CIRCLE_SHA1": "b9f0fb3fdbb94c9d24b2c75b49663122a529e123",
"CIRCLE_WORKFLOW_ID": "circleci-pipeline-id"
},
Expand All @@ -748,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/"
}
]
]
Loading

0 comments on commit 969b28a

Please sign in to comment.