Loading app/models/blob_viewer/gitlab_ci_yml.rb +4 −4 Original line number Diff line number Diff line Loading @@ -8,16 +8,16 @@ class GitlabCiYml < Base self.file_types = %i(gitlab_ci) self.binary = false def validation_message def validation_message(project, sha) return @validation_message if defined?(@validation_message) prepare! @validation_message = Gitlab::Ci::YamlProcessor.validation_message(blob.data) @validation_message = Gitlab::Ci::YamlProcessor.validation_message(blob.data, { project: project, sha: sha }) end def valid? validation_message.blank? def valid?(project, sha) validation_message(project, sha).blank? end end end app/models/ci/pipeline.rb +5 −1 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ def config_processor return @config_processor if defined?(@config_processor) @config_processor ||= begin Gitlab::Ci::YamlProcessor.new(ci_yaml_file) initialize_yaml_processor rescue Gitlab::Ci::YamlProcessor::ValidationError, Psych::SyntaxError => e self.yaml_errors = e.message nil Loading @@ -416,6 +416,10 @@ def config_processor end end def initialize_yaml_processor Gitlab::Ci::YamlProcessor.new(ci_yaml_file) end def ci_yaml_file_path if project.ci_config_path.blank? '.gitlab-ci.yml' Loading app/models/repository.rb +8 −8 Original line number Diff line number Diff line Loading @@ -1061,6 +1061,14 @@ def rebase(user, merge_request) remote_branch: merge_request.target_branch) end def blob_data_at(sha, path) blob = blob_at(sha, path) return unless blob blob.load_all_data! blob.data end private # TODO Generice finder, later split this on finders by Ref or Oid Loading @@ -1075,14 +1083,6 @@ def find_commit(oid_or_ref) ::Commit.new(commit, @project) if commit end def blob_data_at(sha, path) blob = blob_at(sha, path) return unless blob blob.load_all_data! blob.data end def cache # TODO: should we use UUIDs here? We could move repositories without clearing this cache @cache ||= RepositoryCache.new(full_path, @project.id) Loading app/views/projects/blob/viewers/_gitlab_ci_yml.html.haml +2 −2 Original line number Diff line number Diff line - if viewer.valid? - if viewer.valid?(@project, @commit.sha) = icon('check fw') This GitLab CI configuration is valid. - else = icon('warning fw') This GitLab CI configuration is invalid: = viewer.validation_message = viewer.validation_message(@project, @commit.sha) = link_to 'Learn more', help_page_path('ci/yaml/README') changelogs/unreleased-ee/20868-include-external-files-in-gitlab-ci-yml.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line --- title: Dry up CI/CD gitlab-ci.yml configuration by allowing inclusion of external files merge_request: 4262 author: type: added Loading
app/models/blob_viewer/gitlab_ci_yml.rb +4 −4 Original line number Diff line number Diff line Loading @@ -8,16 +8,16 @@ class GitlabCiYml < Base self.file_types = %i(gitlab_ci) self.binary = false def validation_message def validation_message(project, sha) return @validation_message if defined?(@validation_message) prepare! @validation_message = Gitlab::Ci::YamlProcessor.validation_message(blob.data) @validation_message = Gitlab::Ci::YamlProcessor.validation_message(blob.data, { project: project, sha: sha }) end def valid? validation_message.blank? def valid?(project, sha) validation_message(project, sha).blank? end end end
app/models/ci/pipeline.rb +5 −1 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ def config_processor return @config_processor if defined?(@config_processor) @config_processor ||= begin Gitlab::Ci::YamlProcessor.new(ci_yaml_file) initialize_yaml_processor rescue Gitlab::Ci::YamlProcessor::ValidationError, Psych::SyntaxError => e self.yaml_errors = e.message nil Loading @@ -416,6 +416,10 @@ def config_processor end end def initialize_yaml_processor Gitlab::Ci::YamlProcessor.new(ci_yaml_file) end def ci_yaml_file_path if project.ci_config_path.blank? '.gitlab-ci.yml' Loading
app/models/repository.rb +8 −8 Original line number Diff line number Diff line Loading @@ -1061,6 +1061,14 @@ def rebase(user, merge_request) remote_branch: merge_request.target_branch) end def blob_data_at(sha, path) blob = blob_at(sha, path) return unless blob blob.load_all_data! blob.data end private # TODO Generice finder, later split this on finders by Ref or Oid Loading @@ -1075,14 +1083,6 @@ def find_commit(oid_or_ref) ::Commit.new(commit, @project) if commit end def blob_data_at(sha, path) blob = blob_at(sha, path) return unless blob blob.load_all_data! blob.data end def cache # TODO: should we use UUIDs here? We could move repositories without clearing this cache @cache ||= RepositoryCache.new(full_path, @project.id) Loading
app/views/projects/blob/viewers/_gitlab_ci_yml.html.haml +2 −2 Original line number Diff line number Diff line - if viewer.valid? - if viewer.valid?(@project, @commit.sha) = icon('check fw') This GitLab CI configuration is valid. - else = icon('warning fw') This GitLab CI configuration is invalid: = viewer.validation_message = viewer.validation_message(@project, @commit.sha) = link_to 'Learn more', help_page_path('ci/yaml/README')
changelogs/unreleased-ee/20868-include-external-files-in-gitlab-ci-yml.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line --- title: Dry up CI/CD gitlab-ci.yml configuration by allowing inclusion of external files merge_request: 4262 author: type: added