Sha256: 6e03a1bea60affb2e8ce9512b85c4ee713c80ef6cebb70fa7ec93853945d2388
Contents?: true
Size: 1.82 KB
Versions: 11
Compression:
Stored size: 1.82 KB
Contents
# frozen_string_literal: true require "json" require_relative "base" require_relative "../../../utils/git" module Datadog module CI module Ext module Environment module Providers # Jenkins: https://www.jenkins.io/ # Environment variables docs: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables class Jenkins < Base def self.handles?(env) env.key?("JENKINS_URL") end def provider_name Provider::JENKINS end def pipeline_id env["BUILD_TAG"] end def pipeline_name if (name = env["JOB_NAME"]) name = name.gsub("/#{Datadog::CI::Utils::Git.normalize_ref(git_branch)}", "") if git_branch name = name.split("/").reject { |v| v.nil? || v.include?("=") }.join("/") end name end def pipeline_number env["BUILD_NUMBER"] end def pipeline_url env["BUILD_URL"] end def workspace_path env["WORKSPACE"] end def node_name env["NODE_NAME"] end def node_labels env["NODE_LABELS"] && env["NODE_LABELS"].split.to_json end def git_repository_url env["GIT_URL"] || env["GIT_URL_1"] end def git_commit_sha env["GIT_COMMIT"] end def git_branch_or_tag env["GIT_BRANCH"] end def ci_env_vars { "DD_CUSTOM_TRACE_ID" => env["DD_CUSTOM_TRACE_ID"] }.to_json end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems