Commit bfee33bf authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'single-codebase-changelogs' into 'master'

Fix changelog generation for the single codebase

Closes #32040

See merge request gitlab-org/gitlab!16826
parents 016b4f81 9e163787
...@@ -15,7 +15,8 @@ Options = Struct.new( ...@@ -15,7 +15,8 @@ Options = Struct.new(
:force, :force,
:merge_request, :merge_request,
:title, :title,
:type :type,
:ee
) )
INVALID_TYPE = -1 INVALID_TYPE = -1
...@@ -85,6 +86,10 @@ class ChangelogOptionParser ...@@ -85,6 +86,10 @@ class ChangelogOptionParser
options.type = parse_type(value) options.type = parse_type(value)
end 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 opts.on('-h', '--help', 'Print help message') do
$stdout.puts opts $stdout.puts opts
raise Done.new raise Done.new
...@@ -249,7 +254,7 @@ class ChangelogEntry ...@@ -249,7 +254,7 @@ class ChangelogEntry
end end
def ee? def ee?
@ee ||= File.exist?(File.expand_path('../CHANGELOG-EE.md', __dir__)) options.ee
end end
def branch_name def branch_name
......
...@@ -12,6 +12,12 @@ You can create one with: ...@@ -12,6 +12,12 @@ You can create one with:
bin/changelog -m %<mr_iid>s "%<mr_title>s" 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. Note: Merge requests with %<labels>s do not trigger this check.
MSG MSG
......
...@@ -102,6 +102,13 @@ Its simplest usage is to provide the value for `title`: ...@@ -102,6 +102,13 @@ Its simplest usage is to provide the value for `title`:
bin/changelog 'Hey DZ, I added a feature to GitLab!' 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): At this point the script would ask you to select the category of the change (mapped to the `type` field in the entry):
```text ```text
...@@ -131,9 +138,6 @@ author: ...@@ -131,9 +138,6 @@ author:
type: type:
``` ```
If you're working on the GitLab EE repository, the entry will be added to
`ee/changelogs/unreleased/` instead.
### Arguments ### Arguments
| Argument | Shorthand | Purpose | | Argument | Shorthand | Purpose |
......
...@@ -69,6 +69,14 @@ describe 'bin/changelog' do ...@@ -69,6 +69,14 @@ describe 'bin/changelog' do
end end
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 it 'parses -h' do
expect do expect do
expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout
......
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