From beb04a5ca562e899ca6afa2abe312109525b8184 Mon Sep 17 00:00:00 2001 From: Andrey Marchenko Date: Tue, 15 Aug 2023 17:00:39 +0200 Subject: [PATCH] Update CI Visibility spec --- lib/datadog/ci/ext/environment.rb | 45 +++- spec/datadog/ci/ext/fixtures/ci/buddy.json | 30 +++ .../datadog/ci/ext/fixtures/ci/buildkite.json | 34 +++ .../datadog/ci/ext/fixtures/ci/codefresh.json | 162 +++++++++++++ spec/datadog/ci/ext/fixtures/ci/gitlab.json | 219 +++++++----------- spec/datadog/ci/ext/fixtures/ci/jenkins.json | 23 ++ 6 files changed, 375 insertions(+), 138 deletions(-) create mode 100644 spec/datadog/ci/ext/fixtures/ci/codefresh.json diff --git a/lib/datadog/ci/ext/environment.rb b/lib/datadog/ci/ext/environment.rb index 9b86cbcb..22c7796a 100644 --- a/lib/datadog/ci/ext/environment.rb +++ b/lib/datadog/ci/ext/environment.rb @@ -19,6 +19,8 @@ module Environment TAG_PROVIDER_NAME = "ci.provider.name" TAG_STAGE_NAME = "ci.stage.name" TAG_WORKSPACE_PATH = "ci.workspace_path" + TAG_NODE_LABELS = 'ci.node.labels' + TAG_NODE_NAME = 'ci.node.name' TAG_CI_ENV_VARS = "_dd.ci.env_vars" PROVIDERS = [ @@ -33,7 +35,8 @@ module Environment ["JENKINS_URL", :extract_jenkins], ["TEAMCITY_VERSION", :extract_teamcity], ["TRAVIS", :extract_travis], - ["BITRISE_BUILD_SLUG", :extract_bitrise] + ["BITRISE_BUILD_SLUG", :extract_bitrise], + ["CF_BUILD_ID", :extract_codefresh] ].freeze module_function @@ -168,7 +171,7 @@ def extract_bitbucket(env) Core::Git::Ext::TAG_REPOSITORY_URL => env["BITBUCKET_GIT_SSH_ORIGIN"], Core::Git::Ext::TAG_TAG => env["BITBUCKET_TAG"], TAG_JOB_URL => url, - TAG_PIPELINE_ID => env["BITBUCKET_PIPELINE_UUID"] ? env["BITBUCKET_PIPELINE_UUID"].tr("{}", "") : nil, + TAG_PIPELINE_ID => env["BITBUCKET_PIPELINE_UUID"] && env["BITBUCKET_PIPELINE_UUID"].tr("{}", ""), TAG_PIPELINE_NAME => env["BITBUCKET_REPO_FULL_NAME"], TAG_PIPELINE_NUMBER => env["BITBUCKET_BUILD_NUMBER"], TAG_PIPELINE_URL => url, @@ -196,7 +199,7 @@ def extract_buddy(env) end def extract_buildkite(env) - { + tags = { Core::Git::Ext::TAG_BRANCH => env["BUILDKITE_BRANCH"], Core::Git::Ext::TAG_COMMIT_SHA => env["BUILDKITE_COMMIT"], Core::Git::Ext::TAG_REPOSITORY_URL => env["BUILDKITE_REPO"], @@ -216,6 +219,15 @@ def extract_buildkite(env) "BUILDKITE_JOB_ID" => env["BUILDKITE_JOB_ID"] }.to_json } + + extra_tags = env + .select { |key| key.start_with?("BUILDKITE_AGENT_META_DATA_") } + .map { |key, value| "#{key.to_s.sub("BUILDKITE_AGENT_META_DATA_", "").downcase}:#{value}" } + .sort_by(&:length) + + tags[TAG_NODE_LABELS] = extra_tags.to_json unless extra_tags.empty? + + tags end def extract_circle_ci(env) @@ -274,7 +286,6 @@ def extract_github_actions(env) def extract_gitlab(env) commit_author_name, commit_author_email = extract_name_email(env["CI_COMMIT_AUTHOR"]) - url = env["CI_PIPELINE_URL"] { Core::Git::Ext::TAG_BRANCH => env["CI_COMMIT_REF_NAME"], Core::Git::Ext::TAG_COMMIT_SHA => env["CI_COMMIT_SHA"], @@ -289,9 +300,11 @@ def extract_gitlab(env) TAG_PIPELINE_ID => env["CI_PIPELINE_ID"], TAG_PIPELINE_NAME => env["CI_PROJECT_PATH"], TAG_PIPELINE_NUMBER => env["CI_PIPELINE_IID"], - TAG_PIPELINE_URL => url && url.gsub(%r{/-/pipelines/}, "/pipelines/"), + TAG_PIPELINE_URL => env["CI_PIPELINE_URL"], TAG_PROVIDER_NAME => "gitlab", TAG_WORKSPACE_PATH => env["CI_PROJECT_DIR"], + TAG_NODE_LABELS => env["CI_RUNNER_TAGS"], + TAG_NODE_NAME => env["CI_RUNNER_ID"], Core::Git::Ext::TAG_COMMIT_MESSAGE => env["CI_COMMIT_MESSAGE"], TAG_CI_ENV_VARS => { "CI_PROJECT_URL" => env["CI_PROJECT_URL"], @@ -308,6 +321,9 @@ def extract_jenkins(env) name = name.gsub("/#{normalize_ref(branch)}", "") if branch name = name.split("/").reject { |v| v.nil? || v.include?("=") }.join("/") end + + node_labels = env["NODE_LABELS"] && env["NODE_LABELS"].split.to_json + { Core::Git::Ext::TAG_BRANCH => branch, Core::Git::Ext::TAG_COMMIT_SHA => env["GIT_COMMIT"], @@ -319,6 +335,8 @@ def extract_jenkins(env) TAG_PIPELINE_URL => env["BUILD_URL"], TAG_PROVIDER_NAME => "jenkins", TAG_WORKSPACE_PATH => env["WORKSPACE"], + TAG_NODE_LABELS => node_labels, + TAG_NODE_NAME => env["NODE_NAME"], TAG_CI_ENV_VARS => { "DD_CUSTOM_TRACE_ID" => env["DD_CUSTOM_TRACE_ID"] }.to_json @@ -380,6 +398,23 @@ def extract_bitrise(env) } end + def extract_codefresh(env) + branch, tag = branch_or_tag(env["CF_BRANCH"]) + + { + TAG_PROVIDER_NAME => "codefresh", + TAG_PIPELINE_ID => env["CF_BUILD_ID"], + TAG_PIPELINE_NAME => env["CF_PIPELINE_NAME"], + TAG_PIPELINE_URL => env["CF_BUILD_URL"], + TAG_JOB_NAME => env["CF_STEP_NAME"], + Core::Git::Ext::TAG_BRANCH => branch, + Core::Git::Ext::TAG_TAG => tag, + TAG_CI_ENV_VARS => { + "CF_BUILD_ID" => env["CF_BUILD_ID"], + }.to_json + } + end + def extract_user_defined_git(env) { Core::Git::Ext::TAG_REPOSITORY_URL => env[Core::Git::Ext::ENV_REPOSITORY_URL], diff --git a/spec/datadog/ci/ext/fixtures/ci/buddy.json b/spec/datadog/ci/ext/fixtures/ci/buddy.json index 933647ab..57f34d10 100644 --- a/spec/datadog/ci/ext/fixtures/ci/buddy.json +++ b/spec/datadog/ci/ext/fixtures/ci/buddy.json @@ -29,6 +29,36 @@ "git.tag": "v1.0" } ], + [ + { + "BUDDY": "true", + "BUDDY_EXECUTION_BRANCH": "my-name-is-rotag/fix-original-bug", + "BUDDY_EXECUTION_ID": "buddy-execution-id", + "BUDDY_EXECUTION_REVISION": "e5e13f8b7f8d5c6096a0501dc09b48eef05fea96", + "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" + }, + { + "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": "my-name-is-rotag/fix-original-bug", + "git.commit.committer.email": "mikebenson@buddy.works", + "git.commit.committer.name": "Mike Benson", + "git.commit.message": "Create buddy.yml", + "git.commit.sha": "e5e13f8b7f8d5c6096a0501dc09b48eef05fea96", + "git.repository_url": "https://github.com/buddyworks/my-project", + "git.tag": "v1.0" + } + ], [ { "BUDDY": "true", diff --git a/spec/datadog/ci/ext/fixtures/ci/buildkite.json b/spec/datadog/ci/ext/fixtures/ci/buildkite.json index 5c005d8c..f70b0590 100644 --- a/spec/datadog/ci/ext/fixtures/ci/buildkite.json +++ b/spec/datadog/ci/ext/fixtures/ci/buildkite.json @@ -703,5 +703,39 @@ "git.commit.sha": "buildkite-git-commit", "git.repository_url": "https://github.com/DataDog/dogweb.git" } + ], + [ + { + "BUILDKITE": "true", + "BUILDKITE_AGENT_ID": "1a222222-e999-3636-8ddd-802222222222", + "BUILDKITE_AGENT_META_DATA_MYOTHERTAG": "my-other-value", + "BUILDKITE_AGENT_META_DATA_MYTAG": "my-value", + "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": "buildkite-build-url", + "BUILDKITE_COMMIT": "buildkite-git-commit", + "BUILDKITE_JOB_ID": "buildkite-job-id", + "BUILDKITE_MESSAGE": "buildkite-git-commit-message", + "BUILDKITE_PIPELINE_SLUG": "buildkite-pipeline-name", + "BUILDKITE_TAG": "" + }, + { + "_dd.ci.env_vars": "{\"BUILDKITE_BUILD_ID\":\"buildkite-pipeline-id\",\"BUILDKITE_JOB_ID\":\"buildkite-job-id\"}", + "ci.job.url": "buildkite-build-url#buildkite-job-id", + "ci.node.labels": "[\"mytag:my-value\",\"myothertag:my-other-value\"]", + "ci.node.name": "1a222222-e999-3636-8ddd-802222222222", + "ci.pipeline.id": "buildkite-pipeline-id", + "ci.pipeline.name": "buildkite-pipeline-name", + "ci.pipeline.number": "buildkite-pipeline-number", + "ci.pipeline.url": "buildkite-build-url", + "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": "buildkite-git-commit" + } ] ] diff --git a/spec/datadog/ci/ext/fixtures/ci/codefresh.json b/spec/datadog/ci/ext/fixtures/ci/codefresh.json new file mode 100644 index 00000000..d719df10 --- /dev/null +++ b/spec/datadog/ci/ext/fixtures/ci/codefresh.json @@ -0,0 +1,162 @@ +[ + [ + { + "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.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" + } + ], + [ + { + "CF_BRANCH": "origin/master", + "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.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.branch": "master" + } + ], + [ + { + "CF_BRANCH": "refs/heads/feature/one", + "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.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.branch": "feature/one" + } + ], + [ + { + "CF_BRANCH": "origin/tags/0.1.0", + "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.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.tag": "0.1.0" + } + ], + [ + { + "CF_BRANCH": "refs/heads/tags/0.1.0", + "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.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.tag": "0.1.0" + } + ], + [ + { + "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_BRANCH": "user-supplied-branch", + "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": "git@github.com:DataDog/userrepo.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.branch": "user-supplied-branch", + "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": "git@github.com:DataDog/userrepo.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_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": "git@github.com:DataDog/userrepo.git", + "DD_GIT_TAG": "0.0.2" + }, + { + "_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.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": "git@github.com:DataDog/userrepo.git", + "git.tag": "0.0.2" + } + ] +] diff --git a/spec/datadog/ci/ext/fixtures/ci/gitlab.json b/spec/datadog/ci/ext/fixtures/ci/gitlab.json index 4dc28e1d..94127bc8 100644 --- a/spec/datadog/ci/ext/fixtures/ci/gitlab.json +++ b/spec/datadog/ci/ext/fixtures/ci/gitlab.json @@ -1,42 +1,4 @@ [ - [ - { - "CI_COMMIT_AUTHOR": "John Doe ", - "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", - "CI_COMMIT_REF_NAME": "origin/master", - "CI_COMMIT_SHA": "gitlab-git-commit", - "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": "gitlab-job-url", - "CI_PIPELINE_ID": "gitlab-pipeline-id", - "CI_PIPELINE_IID": "gitlab-pipeline-number", - "CI_PIPELINE_URL": "https://foo/repo/-/pipelines/1234", - "CI_PROJECT_PATH": "gitlab-pipeline-name", - "CI_PROJECT_URL": "gitlab-project-url", - "CI_REPOSITORY_URL": "sample", - "GITLAB_CI": "gitlab" - }, - { - "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"gitlab-project-url\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", - "ci.job.name": "gitlab-job-name", - "ci.job.url": "gitlab-job-url", - "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", - "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": "gitlab-git-commit", - "git.repository_url": "sample" - } - ], [ { "CI_COMMIT_AUTHOR": "John Doe ", @@ -64,7 +26,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "foo/bar", @@ -104,7 +66,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar~", @@ -144,7 +106,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/~/bar", @@ -186,7 +148,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/not-my-home/foo/bar", @@ -228,7 +190,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "~foo/bar", @@ -270,7 +232,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/not-my-home", @@ -283,84 +245,6 @@ "git.repository_url": "sample" } ], - [ - { - "CI_COMMIT_AUTHOR": "John Doe ", - "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", - "CI_COMMIT_REF_NAME": "origin/master", - "CI_COMMIT_SHA": "gitlab-git-commit", - "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": "gitlab-job-url", - "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": "gitlab-project-url", - "CI_REPOSITORY_URL": "sample", - "GITLAB_CI": "gitlab" - }, - { - "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"gitlab-project-url\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", - "ci.job.name": "gitlab-job-name", - "ci.job.url": "gitlab-job-url", - "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": "gitlab-git-commit", - "git.repository_url": "sample" - } - ], - [ - { - "CI_COMMIT_AUTHOR": "John Doe ", - "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", - "CI_COMMIT_REF_NAME": "origin/master", - "CI_COMMIT_SHA": "gitlab-git-commit", - "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": "gitlab-job-url", - "CI_PIPELINE_ID": "gitlab-pipeline-id", - "CI_PIPELINE_IID": "gitlab-pipeline-number", - "CI_PROJECT_DIR": "/foo/bar", - "CI_PROJECT_PATH": "gitlab-pipeline-name", - "CI_PROJECT_URL": "gitlab-project-url", - "CI_REPOSITORY_URL": "sample", - "GITLAB_CI": "gitlab" - }, - { - "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"gitlab-project-url\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", - "ci.job.name": "gitlab-job-name", - "ci.job.url": "gitlab-job-url", - "ci.pipeline.id": "gitlab-pipeline-id", - "ci.pipeline.name": "gitlab-pipeline-name", - "ci.pipeline.number": "gitlab-pipeline-number", - "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": "gitlab-git-commit", - "git.repository_url": "sample" - } - ], [ { "CI_COMMIT_AUTHOR": "John Doe ", @@ -388,7 +272,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -428,7 +312,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -445,6 +329,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TAG": "origin/tags/0.1.0", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", @@ -468,10 +353,11 @@ "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.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", @@ -485,6 +371,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TAG": "refs/heads/tags/0.1.0", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", @@ -508,10 +395,11 @@ "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.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", @@ -525,6 +413,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TAG": "0.1.0", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", @@ -548,10 +437,11 @@ "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.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", @@ -588,7 +478,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -628,7 +518,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -668,7 +558,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -708,7 +598,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -748,7 +638,7 @@ "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.pipeline.url": "https://foo/repo/-/pipelines/1234", "ci.provider.name": "gitlab", "ci.stage.name": "gitlab-stage-name", "ci.workspace_path": "/foo/bar", @@ -765,6 +655,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", "CI_JOB_ID": "gitlab-job-id", @@ -773,8 +664,11 @@ "CI_JOB_URL": "gitlab-job-url", "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": "gitlab-project-url", + "CI_REPOSITORY_URL": "sample", "DD_GIT_BRANCH": "user-supplied-branch", "DD_GIT_COMMIT_AUTHOR_DATE": "usersupplied-authordate", "DD_GIT_COMMIT_AUTHOR_EMAIL": "usersupplied-authoremail", @@ -794,8 +688,10 @@ "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": "user-supplied-branch", "git.commit.author.date": "usersupplied-authordate", "git.commit.author.email": "usersupplied-authoremail", @@ -812,6 +708,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", "CI_JOB_ID": "gitlab-job-id", @@ -820,8 +717,11 @@ "CI_JOB_URL": "gitlab-job-url", "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": "gitlab-project-url", + "CI_REPOSITORY_URL": "sample", "DD_GIT_COMMIT_AUTHOR_DATE": "usersupplied-authordate", "DD_GIT_COMMIT_AUTHOR_EMAIL": "usersupplied-authoremail", "DD_GIT_COMMIT_AUTHOR_NAME": "usersupplied-authorname", @@ -841,8 +741,11 @@ "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": "usersupplied-authordate", "git.commit.author.email": "usersupplied-authoremail", "git.commit.author.name": "usersupplied-authorname", @@ -859,6 +762,7 @@ { "CI_COMMIT_AUTHOR": "John Doe ", "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", "CI_COMMIT_SHA": "gitlab-git-commit", "CI_COMMIT_TIMESTAMP": "2021-07-21T11:43:07-04:00", "CI_JOB_ID": "gitlab-job-id", @@ -867,6 +771,8 @@ "CI_JOB_URL": "gitlab-job-url", "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": "gitlab-project-url", "CI_REPOSITORY_URL": "https://user:password@gitlab.com/DataDog/dogweb.git", @@ -879,8 +785,11 @@ "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", @@ -888,5 +797,49 @@ "git.commit.sha": "gitlab-git-commit", "git.repository_url": "https://gitlab.com/DataDog/dogweb.git" } + ], + [ + { + "CI_COMMIT_AUTHOR": "John Doe ", + "CI_COMMIT_MESSAGE": "gitlab-git-commit-message", + "CI_COMMIT_REF_NAME": "origin/master", + "CI_COMMIT_SHA": "gitlab-git-commit", + "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": "gitlab-job-url", + "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": "gitlab-project-url", + "CI_REPOSITORY_URL": "sample", + "CI_RUNNER_ID": "9393040", + "CI_RUNNER_TAGS": "[\"arch:arm64\",\"linux\"]", + "GITLAB_CI": "gitlab" + }, + { + "_dd.ci.env_vars": "{\"CI_PROJECT_URL\":\"gitlab-project-url\",\"CI_PIPELINE_ID\":\"gitlab-pipeline-id\",\"CI_JOB_ID\":\"gitlab-job-id\"}", + "ci.job.name": "gitlab-job-name", + "ci.job.url": "gitlab-job-url", + "ci.node.labels": "[\"arch:arm64\",\"linux\"]", + "ci.node.name": "9393040", + "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": "gitlab-git-commit", + "git.repository_url": "sample" + } ] -] +] \ No newline at end of file diff --git a/spec/datadog/ci/ext/fixtures/ci/jenkins.json b/spec/datadog/ci/ext/fixtures/ci/jenkins.json index fa1d5707..b9ff0a34 100644 --- a/spec/datadog/ci/ext/fixtures/ci/jenkins.json +++ b/spec/datadog/ci/ext/fixtures/ci/jenkins.json @@ -686,5 +686,28 @@ "git.commit.sha": "jenkins-git-commit", "git.repository_url": "https://github.com/DataDog/dogweb.git" } + ], + [ + { + "BUILD_NUMBER": "jenkins-pipeline-number", + "BUILD_TAG": "jenkins-pipeline-id", + "BUILD_URL": "jenkins-pipeline-url", + "DD_CUSTOM_TRACE_ID": "jenkins-custom-trace-id", + "GIT_COMMIT": "jenkins-git-commit", + "JENKINS_URL": "jenkins", + "JOB_URL": "jenkins-job-url", + "NODE_LABELS": "built-in linux", + "NODE_NAME": "my-node" + }, + { + "_dd.ci.env_vars": "{\"DD_CUSTOM_TRACE_ID\":\"jenkins-custom-trace-id\"}", + "ci.node.labels": "[\"built-in\",\"linux\"]", + "ci.node.name": "my-node", + "ci.pipeline.id": "jenkins-pipeline-id", + "ci.pipeline.number": "jenkins-pipeline-number", + "ci.pipeline.url": "jenkins-pipeline-url", + "ci.provider.name": "jenkins", + "git.commit.sha": "jenkins-git-commit" + } ] ]