Skip to content

Commit 93043ef

Browse files
committed
[DOC-13702]: Write documentation for the Release Note Generator
Adding example page.
1 parent 75765d2 commit 93043ef

File tree

1 file changed

+112
-1
lines changed

1 file changed

+112
-1
lines changed

home/modules/contribute/pages/release-note-generator/adding-a-new-product.adoc

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,119 @@ release_settings:
105105
type: file
106106
message: 'Enter the file path for the release notes:'
107107
url: https://jira.issues.couchbase.com
108-
jql: project = CBG AND issuetype in (Bug, "New Feature", Epic, Improvement)
108+
jql: project = CBG AND issuetype in (Bug, "New Feature") #<.>
109+
AND (fixVersion = {{release_number}} OR labels IN (known_issue)) #<.>
110+
ORDER BY key ASC #<.>
111+
----
112+
113+
<.> Note that the JQL statement restricts the query to tickets belonging to the Sync Gateway project,
114+
and also ensures that the ticket is either a Bug or a New Feature.
115+
<.> We supply the `release_number` parameter to the JQL statement so that we only pick up tickets from the specified release.
116+
<.> The `ORDER BY key` clause ensures that the tickets are returned in ascending order based on their Jira key.
117+
This is important to ensure that the tickets are passed to the template in the correct order.
118+
119+
[#define-your-jinja-template]
120+
=== Step {counter: step}: Define your JINJA template
121+
122+
Before creating the rendering template, you need to add it's location to your release set.
123+
You can share templates between release sets.
124+
125+
[source,yaml]
126+
.The completed release set
127+
----
128+
release_settings:
129+
- name: "Sync Gateway"
130+
fields:
131+
- name: release_number
132+
type: text
133+
message: 'Enter the release number:'
134+
- name: release_date
135+
type: text
136+
message: 'Enter the release date (Month Year):'
137+
- name: file_path
138+
type: file
139+
message: 'Enter the file path for the release notes:'
140+
url: https://jira.issues.couchbase.com
141+
jql: project = CBG AND issuetype in (Bug, "New Feature")
109142
AND (fixVersion = {{release_number}} OR labels IN (known_issue))
110143
ORDER BY key ASC
144+
template: sync-gateway.jinja2
111145
----
112146

147+
Step {counter: step}: Create your JINJA template
148+
149+
The templates reside in the `templates` directory, as defined near the top of the configuration file.
150+
Use your editor to create a new template file in this directory. The file should be called `sync-gateway.jinja2`,
151+
as defined in the release set configuration. (<<define-your-jinja-template>>)
152+
153+
Copy the template below into your file, then save the file.
154+
155+
[source]
156+
----
157+
158+
{% macro generate_issue_list(issues) %} <1>
159+
160+
{% if issues | length %}
161+
{% for issue in issues %} <2>
162+
163+
* {{ user_settings.release_set.url }}/browse/{{ issue.key }}[++{{ issue.key }} {{ issue.fields.summary }}++] <3>
164+
{% endfor %}
165+
{% else %}
166+
None for this release.
167+
{% endif %}
168+
169+
{% endmacro %} <1>
170+
171+
{% set improvements = issues | selectattr('fields.issuetype.name', 'in', 'New Feature,Epic,Improvement') <4>
172+
| selectattr('fields.status.name', 'in','Resolved, Closed')
173+
| selectattr('fields.resolution.name', 'in','Fixed, Done')
174+
| rejectattr('fields.labels', 'contains', 'known_issue') | list %}
175+
176+
{% set bugs = issues | selectattr('fields.issuetype.name', 'in', 'Bug')
177+
| selectattr('fields.resolution.name', 'in','Fixed')
178+
| rejectattr('fields.labels', 'contains', 'known_issue') | list %}
179+
180+
{% set known_issues = issues | selectattr('fields.labels', 'contains', 'known_issue')
181+
| rejectattr('fields.status.name', 'in','Resolved, Closed') | list %}
182+
183+
== {{ user_settings.fields.release_number }} -- {{ user_settings.fields.release_date }}
184+
185+
[#maint-{{user_settings.fields.release_number | replace_dots('-') }}]
186+
187+
=== Enhancements
188+
{{ generate_issue_list(improvements) }} <1>
189+
190+
=== Issues and Resolutions
191+
192+
==== Fixed Issues
193+
194+
{{ generate_issue_list(bugs) }} <1>
195+
196+
==== Known Issues
197+
198+
{{ generate_issue_list(known_issues) }} <1
199+
200+
----
201+
202+
We won't cover the breadth of what you can do with JINJA templates,
203+
but we will highlight some of the features used in this example:
204+
205+
<1> We can define reusable macros that can be called from anywhere within the template.
206+
<2> We can define a `for … endfor` loop to iterate over the list of issues passed to the template.
207+
<3> We can access all the fields of an issue using the dot notation.
208+
<4> We can filter the issue list even further by using the built-in `selectattr` function
209+
to filter issues based on field values.
210+
211+
=== Step {counter: step}: Run the Release Note Generator
212+
213+
From the terminal screen, run the application using the following command:
214+
215+
[source, shell]
216+
----
217+
./cb-release-note
218+
----
219+
220+
.Running the generator with the new Sync Gateway release set
221+
image::release-note-generator/sync-gateway-example.png[Running the Release Note Generator]
222+
223+

0 commit comments

Comments
 (0)