-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca3b200
commit c7a2845
Showing
5 changed files
with
106 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../extractor" | ||
|
||
module Datadog | ||
module CI | ||
module Ext | ||
module Environment | ||
module Providers | ||
# Codefresh: https://codefresh.io/ | ||
# Environment variables docs: https://codefresh.io/docs/docs/pipelines/variables/#export-variables-to-all-steps-with-cf_export | ||
class Codefresh < Extractor | ||
private | ||
|
||
# overridden methods | ||
def provider_name | ||
"codefresh" | ||
end | ||
|
||
def job_name | ||
env["CF_STEP_NAME"] | ||
end | ||
|
||
def pipeline_id | ||
env["CF_BUILD_ID"] | ||
end | ||
|
||
def pipeline_name | ||
env["CF_PIPELINE_NAME"] | ||
end | ||
|
||
def pipeline_url | ||
env["CF_BUILD_URL"] | ||
end | ||
|
||
def git_branch | ||
return @branch if defined?(@branch) | ||
|
||
set_branch_and_tag | ||
@branch | ||
end | ||
|
||
def git_tag | ||
return @tag if defined?(@tag) | ||
|
||
set_branch_and_tag | ||
@tag | ||
end | ||
|
||
def ci_env_vars | ||
{ | ||
"CF_BUILD_ID" => env["CF_BUILD_ID"] | ||
}.to_json | ||
end | ||
|
||
# codefresh-specific methods | ||
def set_branch_and_tag | ||
@branch, @tag = branch_or_tag(env["CF_BRANCH"]) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Datadog | ||
module CI | ||
module Ext | ||
module Environment | ||
module Providers | ||
class Codefresh < Extractor | ||
private | ||
def provider_name: () -> "codefresh" | ||
|
||
def job_name: () -> String? | ||
|
||
def pipeline_id: () -> String? | ||
|
||
def pipeline_name: () -> String? | ||
|
||
def pipeline_url: () -> String? | ||
|
||
def git_branch: () -> String? | ||
|
||
def git_tag: () -> String? | ||
|
||
def ci_env_vars: () -> String | ||
|
||
def set_branch_and_tag: () -> [String?, String?] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |