Add a CI_COMMIT_MESSAGE predefined variable
This commit is contained in:
parent
bdc20840aa
commit
698a0c4798
3 changed files with 16 additions and 2 deletions
|
@ -284,6 +284,14 @@ module Ci
|
|||
commit.try(:title)
|
||||
end
|
||||
|
||||
def git_commit_full_title
|
||||
commit.try(:full_title)
|
||||
end
|
||||
|
||||
def git_commit_description
|
||||
commit.try(:description)
|
||||
end
|
||||
|
||||
def short_sha
|
||||
Ci::Pipeline.truncate_sha(sha)
|
||||
end
|
||||
|
@ -491,6 +499,9 @@ module Ci
|
|||
.append(key: 'CI_PIPELINE_ID', value: id.to_s)
|
||||
.append(key: 'CI_CONFIG_PATH', value: ci_yaml_file_path)
|
||||
.append(key: 'CI_PIPELINE_SOURCE', value: source.to_s)
|
||||
.append(key: 'CI_COMMIT_MESSAGE', value: git_commit_message)
|
||||
.append(key: 'CI_COMMIT_TITLE', value: git_commit_full_title)
|
||||
.append(key: 'CI_COMMIT_DESCRIPTION', value: git_commit_description)
|
||||
end
|
||||
|
||||
def queued_duration
|
||||
|
|
|
@ -1518,7 +1518,10 @@ describe Ci::Build do
|
|||
{ key: 'CI_PROJECT_VISIBILITY', value: 'private', public: true },
|
||||
{ key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true },
|
||||
{ key: 'CI_CONFIG_PATH', value: pipeline.ci_yaml_file_path, public: true },
|
||||
{ key: 'CI_PIPELINE_SOURCE', value: pipeline.source, public: true }
|
||||
{ key: 'CI_PIPELINE_SOURCE', value: pipeline.source, public: true },
|
||||
{ key: 'CI_COMMIT_MESSAGE', value: pipeline.git_commit_message, public: true },
|
||||
{ key: 'CI_COMMIT_TITLE', value: pipeline.git_commit_title, public: true },
|
||||
{ key: 'CI_COMMIT_DESCRIPTION', value: pipeline.git_commit_description, public: true }
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ describe Ci::Pipeline, :mailer do
|
|||
it 'includes all predefined variables in a valid order' do
|
||||
keys = subject.map { |variable| variable[:key] }
|
||||
|
||||
expect(keys).to eq %w[CI_PIPELINE_ID CI_CONFIG_PATH CI_PIPELINE_SOURCE]
|
||||
expect(keys).to eq %w[CI_PIPELINE_ID CI_CONFIG_PATH CI_PIPELINE_SOURCE CI_COMMIT_MESSAGE CI_COMMIT_TITLE CI_COMMIT_DESCRIPTION]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue