Skip to content

Commit ba4fa50

Browse files
committed
[DOC-13702]: Write documentation for the Release Note Generator
Adding example page.
1 parent f23fa14 commit ba4fa50

File tree

7 files changed

+503
-1
lines changed

7 files changed

+503
-1
lines changed
1.08 MB
Loading
1.16 MB
Loading
1.14 MB
Loading

home/modules/contribute/nav.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,10 @@
3737
** xref:generate-rest-api.adoc[]
3838
** xref:extensions.adoc[]
3939
40+
* Release Note Generator
41+
** xref:release-note-generator/design-guide.adoc[Release Note Generator Design Guide]
42+
** xref:release-note-generator/adding-a-new-product.adoc[Adding a New Product]
43+
4044
4145
//* Additional Resources (Pending)
46+
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
= Adding a New Product
2+
:description: Demonstrates how to add a new product to the Release Note Generator.
3+
:page-pagination: prev
4+
:page-topic-type: howto
5+
6+
[abstract]
7+
{description}
8+
9+
== Prerequisites
10+
This guide is intended for technical writers and developers who are familiar with the Release Note Generator. If you are new to the tool, please refer to the link:https://confluence.issues.couchbase.com/wiki/spaces/DOCS/pages/3338961232/Other+Tools[installation and use of the Release Note Generator] guide for more information.
11+
Before you begin, make sure that you have the release note generator installed and running.
12+
13+
You should also familiarize yourself with the xref:./design-guide.adoc[].
14+
15+
You will also need a code editor or an IDE for editing the YAML configuration file.
16+
17+
You should also have a terminal application running.
18+
19+
== Overview
20+
21+
The Release Note Generator has been designed so that it can be extended to support new Couchbase products without having to
22+
alter the Python script itself. Adding a new product involves two steps:
23+
24+
. Add the new product release set to `cb_release_notes_config.yaml`.
25+
. Create a new Jinja template for rendering the AsciiDoc file for your new release note.
26+
27+
To demonstrate this process, we're going to create a new release note configuration for the Sync Gateway product.
28+
29+
NOTE: You should run the following commands from the directory where your Release Notes Generator is installed.
30+
31+
=== Step {counter: step}: Make a copy of your `cb_release_notes_config.yaml` file.
32+
33+
You can make a copy of the file using the following terminal command:
34+
35+
[source, shell]
36+
----
37+
cp cb_release_notes_config.yaml cb_release_notes_config.yaml.spare
38+
----
39+
40+
=== Step {counter: step}: Name your release product
41+
42+
Edit the original `cb_release_notes_config.yaml` file
43+
and add the new `name` item underneath the `release_settings` section:
44+
45+
[source, yaml]
46+
----
47+
release_settings:
48+
- name: "Sync Gateway"
49+
----
50+
51+
=== Step {counter: step}: Define your parameters
52+
53+
The user will need to supply parameters that need to be fed to the script.
54+
These can vary depending on what's going to appear on the release note,
55+
and what the JQL will need to gather the tickets.
56+
The most common parameters are:
57+
58+
[horizontal]
59+
60+
Release number::
61+
The label that our JQL will use to find the release tag.
62+
63+
Release date::
64+
This will appear in the release note heading.
65+
66+
File path::
67+
This is a mandatory item needed for each release set.
68+
It supplies the name of the AsciiDoc file that the script generates.
69+
70+
Other parameters that the SQL will need, (such as the project name), are fixed values
71+
and don't need to be parameterized.
72+
73+
[source, yaml]
74+
----
75+
release_settings:
76+
- name: "Sync Gateway"
77+
fields:
78+
- name: release_number
79+
type: text
80+
message: 'Enter the release number:'
81+
- name: release_date
82+
type: text
83+
message: 'Enter the release date (Month Year):'
84+
- name: file_path
85+
type: file
86+
message: 'Enter the file path for the release notes:'
87+
----
88+
89+
=== Step {counter: step}: Define your JQL statement
90+
91+
Now, you add the URL and the JQL statements used to retrieve the Jira tickets that match your parameters:
92+
93+
[source, yaml]
94+
----
95+
release_settings:
96+
- name: "Sync Gateway"
97+
fields:
98+
- name: release_number
99+
type: text
100+
message: 'Enter the release number:'
101+
- name: release_date
102+
type: text
103+
message: 'Enter the release date (Month Year):'
104+
- name: file_path
105+
type: file
106+
message: 'Enter the file path for the release notes:'
107+
url: https://jira.issues.couchbase.com
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")
142+
AND (fixVersion = {{release_number}} OR labels IN (known_issue))
143+
ORDER BY key ASC
144+
template: sync-gateway.jinja2
145+
----
146+
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)