Commit 656b9eb8 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'ci_danger' into 'master'

Adds a first pass at a ci config danger rule

See merge request gitlab-org/gitlab!75292
parents 60fa93af 6886287a
# frozen_string_literal: true
all_changed_files = helper.all_changed_files
def get_ci_config_files(files)
files.select do |file|
file.include?('gitlab/ci/config/entry')
end
end
schema_path = 'app/assets/javascripts/editor/schema/ci.json'
has_schema_update = all_changed_files.include?(schema_path)
return if has_schema_update
ci_config_files = get_ci_config_files(all_changed_files)
return if ci_config_files.empty?
file_list = "- #{ci_config_files.map { |path| "`#{path}`" }.join("\n- ")}"
warn "This merge request changed CI config files but did not update the schema. Please consider updating [the schema](#{schema_path}) to reflect these changes:\n#{file_list}"
......@@ -284,7 +284,7 @@ RSpec.describe Tooling::Danger::ProjectHelper do
describe '.local_warning_message' do
it 'returns an informational message with rules that can run' do
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changelog, database, documentation, duplicate_yarn_dependencies, eslint, gitaly, pajamas, pipeline, prettier, product_intelligence, utility_css, vue_shared_documentation')
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changelog, ci_config, database, documentation, duplicate_yarn_dependencies, eslint, gitaly, pajamas, pipeline, prettier, product_intelligence, utility_css, vue_shared_documentation')
end
end
......
......@@ -5,6 +5,7 @@ module Tooling
module ProjectHelper
LOCAL_RULES ||= %w[
changelog
ci_config
database
documentation
duplicate_yarn_dependencies
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment