diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 21:09:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 21:09:23 +0000 |
commit | 32fd4cd5e2134511936899d6bcc4aaf18b9be6fd (patch) | |
tree | 10378ceffed52dd0e160a0d9bcf3c5ab72c18958 /app/models/ci/build.rb | |
parent | 951616a26a61e880860ad862c1d45a8e3762b4bc (diff) | |
download | gitlab-ce-32fd4cd5e2134511936899d6bcc4aaf18b9be6fd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index d61f0bbfb10..f79a5682963 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -531,6 +531,7 @@ module Ci .concat(persisted_variables) .concat(scoped_variables) .concat(job_variables) + .concat(environment_changed_page_variables) .concat(persisted_environment_variables) .to_runner_variables end @@ -569,6 +570,15 @@ module Ci end end + def environment_changed_page_variables + Gitlab::Ci::Variables::Collection.new.tap do |variables| + break variables unless environment_status + + variables.append(key: 'CI_MERGE_REQUEST_CHANGED_PAGE_PATHS', value: environment_status.changed_paths.join(',')) + variables.append(key: 'CI_MERGE_REQUEST_CHANGED_PAGE_URLS', value: environment_status.changed_urls.join(',')) + end + end + def deploy_token_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| break variables unless gitlab_deploy_token @@ -970,6 +980,14 @@ module Ci options&.dig(:environment, :url) || persisted_environment&.external_url end + def environment_status + strong_memoize(:environment_status) do + if has_environment? && merge_request + EnvironmentStatus.new(project, persisted_environment, merge_request, pipeline.sha) + end + end + end + # The format of the retry option changed in GitLab 11.5: Before it was # integer only, after it is a hash. New builds are created with the new # format, but builds created before GitLab 11.5 and saved in database still |