diff --git a/bin/changelog b/bin/changelog index ec068d0650751e2f81b98557212ecd74f4619d2a..45b6295e3311543a0c814d41ca143708fd51e83f 100755 --- a/bin/changelog +++ b/bin/changelog @@ -15,7 +15,8 @@ Options = Struct.new( :force, :merge_request, :title, - :type + :type, + :ee ) INVALID_TYPE = -1 @@ -85,6 +86,10 @@ class ChangelogOptionParser options.type = parse_type(value) end + opts.on('-e', '--ee', 'Generate a changelog entry for GitLab EE') do |value| + options.ee = value + end + opts.on('-h', '--help', 'Print help message') do $stdout.puts opts raise Done.new @@ -249,7 +254,7 @@ class ChangelogEntry end def ee? - @ee ||= File.exist?(File.expand_path('../CHANGELOG-EE.md', __dir__)) + options.ee end def branch_name diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 2d1ca64a9e89233aac449e558fe9bef996d52704..f83dc55696483554ce47b7db29ae12b9e78b58db 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -12,6 +12,12 @@ You can create one with: bin/changelog -m %<mr_iid>s "%<mr_title>s" ``` +If you want to create a changelog entry for GitLab EE, run the following instead: + +``` +bin/changelog --ee -m %<mr_iid>s "%<mr_title>s" +``` + Note: Merge requests with %<labels>s do not trigger this check. MSG diff --git a/doc/development/changelog.md b/doc/development/changelog.md index 5667f58b0c3ea2730d04e3531291a614f0dd1997..afc18885a80275bc949165d9482f62059407ed1e 100644 --- a/doc/development/changelog.md +++ b/doc/development/changelog.md @@ -102,6 +102,13 @@ Its simplest usage is to provide the value for `title`: bin/changelog 'Hey DZ, I added a feature to GitLab!' ``` +If you want to generate a changelog entry for GitLab EE, you will need to pass +the `--ee` option: + +```text +bin/changelog --ee 'Hey DZ, I added a feature to GitLab!' +``` + At this point the script would ask you to select the category of the change (mapped to the `type` field in the entry): ```text @@ -131,9 +138,6 @@ author: type: ``` -If you're working on the GitLab EE repository, the entry will be added to -`ee/changelogs/unreleased/` instead. - ### Arguments | Argument | Shorthand | Purpose | diff --git a/ee/changelogs/unreleased-ee/9613-ldap-sync-check-parent-group-member.yml b/ee/changelogs/unreleased/9613-ldap-sync-check-parent-group-member.yml similarity index 100% rename from ee/changelogs/unreleased-ee/9613-ldap-sync-check-parent-group-member.yml rename to ee/changelogs/unreleased/9613-ldap-sync-check-parent-group-member.yml diff --git a/spec/bin/changelog_spec.rb b/spec/bin/changelog_spec.rb index c3a5abf2b7acb4ddb3684075bed2a89dd6dd1303..ce7f7648c0caf9d18612f5e06204078a49e77d01 100644 --- a/spec/bin/changelog_spec.rb +++ b/spec/bin/changelog_spec.rb @@ -69,6 +69,14 @@ describe 'bin/changelog' do end end + it 'parses --ee and -e' do + %w[--ee -e].each do |flag| + options = described_class.parse(%W[foo #{flag} security]) + + expect(options.ee).to eq true + end + end + it 'parses -h' do expect do expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout