Skip to content

Commit 09bb21a

Browse files
committed
[DOC-13702]: Write documentation for the Release Note Generator
Documented the Release Note Generator, including setup, configuration, and usage guides.
1 parent f23fa14 commit 09bb21a

File tree

8 files changed

+673
-6
lines changed

8 files changed

+673
-6
lines changed
1.08 MB
Loading
1.13 MB
Loading
1.16 MB
Loading

home/modules/contribute/nav.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,11 @@
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+
** xref:release-note-generator/generate_ai_summaries.adoc[Generate AI Summaries]
44+
4045
4146
//* Additional Resources (Pending)
47+
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
= Adding a New Product
2+
:description: Demonstrates how to add a new product to the Release Note Generator.
3+
:page-pagination: full
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+
28+
== Adding a new product
29+
30+
To demonstrate this process, we're going to create a test release note configuration for Couchbase Server.
31+
(There are already two existing configurations for this product, so this one can be safely deleted later).
32+
33+
NOTE: You should run the following commands from the directory where your Release Notes Generator is installed.
34+
35+
=== Step {counter: step}: Make a copy of your `cb_release_notes_config.yaml` file.
36+
37+
You can make a copy of the file using the following terminal command:
38+
39+
[source, shell]
40+
----
41+
cp cb_release_notes_config.yaml cb_release_notes_config.yaml.spare
42+
----
43+
44+
=== Step {counter: step}: Name your release product
45+
46+
Edit the original `cb_release_notes_config.yaml` file
47+
and add the new `name` item underneath the `release_settings` section:
48+
49+
[source, yaml]
50+
----
51+
release_settings:
52+
- name: "Docs Server (test)"
53+
----
54+
55+
=== Step {counter: step}: Define your parameters
56+
57+
The user will need to supply parameters that need to be fed to the script.
58+
These can vary depending on what's going to appear on the release note,
59+
and what the JQL will need to gather the tickets.
60+
The most common parameters are:
61+
62+
[horizontal]
63+
64+
Release date::
65+
This will appear in the release note heading.
66+
67+
68+
Release number::
69+
The label that our JQL will use to find the release tag.
70+
71+
File path::
72+
This is a mandatory item needed for each release set.
73+
It supplies the name of the AsciiDoc file that the script generates.
74+
75+
Other parameters that the SQL will need, (such as the project name), are fixed values
76+
and don't need to be parameterized.
77+
78+
[source, yaml]
79+
.Add the input parameters
80+
----
81+
release_settings:
82+
- name: "Docs Server (test)"
83+
fields:
84+
- name: release_date
85+
type: text
86+
message: 'Enter the release date (Month Year):'
87+
- name: release_number
88+
type: text
89+
message: 'Enter the release label:'
90+
- name: file_path
91+
type: file
92+
message: 'Enter the file path for the release notes:'
93+
----
94+
95+
=== Step {counter: step}: Define your JQL statement
96+
97+
Now, you add the URL and the JQL statements used to retrieve the Jira tickets that match your parameters:
98+
99+
[source, yaml]
100+
.Adding the JQL statement
101+
----
102+
- name: "Docs Server (test)"
103+
fields:
104+
- name: release_date
105+
type: text
106+
message: 'Enter the release date (Month Year):'
107+
- name: release_number
108+
type: text
109+
message: 'Enter the release label:'
110+
- name: release_text
111+
type: text
112+
message: 'Enter the release number for the title line:'
113+
- name: file_path
114+
type: file
115+
message: 'Enter the file path for the release notes:'
116+
url: https://jira.issues.couchbase.com
117+
jql: project = "Couchbase Server" # <.>
118+
AND type IN (Epic, Bug, Improvement, Task, "Technical Task")
119+
AND fixVersion in ({{release_number}}) # <.>
120+
AND labels IN (releasenote,releasenotecomplete)
121+
ORDER BY key ASC # <.>
122+
----
123+
<.> Note that the JQL statement restricts the query to tickets belonging to the Couchbase Server project,
124+
and also ensures that the ticket is either a Bug or a New Feature.
125+
<.> We supply the `release_number` parameter to the JQL statement so that we only pick up tickets from the specified release.
126+
<.> The `ORDER BY key` clause ensures that the tickets are returned in ascending order based on their Jira key.
127+
This is important to ensure that the tickets are passed to the template in the correct order.
128+
129+
[#define-release-note-field]
130+
=== Step {counter: step}: Define the release note field.
131+
132+
The script needs to know which field in a Jira ticket holds the release note description.
133+
The script uses this to ensure that the ticket's release note description field has been filled in.
134+
If the field hasn't been filled in,
135+
the script can optionally use AI to generate a release note summary from the
136+
ticket and comments.
137+
For most of the Couchbase projects, this was added some time after the Jira system was set up,
138+
so the new field was added as a custom field called `customfield_11402`.
139+
140+
[source,yaml, subs="+quotes"]
141+
.Define the `release_notes_field`
142+
----
143+
- name: "Docs Server (test)"
144+
fields:
145+
- name: release_date
146+
type: text
147+
message: 'Enter the release date (Month Year):'
148+
- name: release_number
149+
type: text
150+
message: 'Enter the release label:'
151+
- name: release_text
152+
type: text
153+
message: 'Enter the release number for the title line:'
154+
- name: file_path
155+
type: file
156+
message: 'Enter the file path for the release notes:'
157+
url: https://jira.issues.couchbase.com
158+
jql: project = "Couchbase Server"
159+
AND type IN (Epic, Bug, Improvement, Task, "Technical Task")
160+
AND fixVersion in ({{release_number}})
161+
AND labels IN (releasenote,releasenotecomplete)
162+
ORDER BY key ASC
163+
#release_note_field: 'customfield_11402'#
164+
----
165+
166+
Any item from the `fields` list can be designated as a `release_note_field` (e.g. the ticket's `summary` field).
167+
Alternatively, if the project doesn't have a release note field, then set `release_note_field` to `None`.
168+
169+
.Retrieving JIRA field names
170+
****
171+
The field names for Jira often differ from the names displayed on the ticket's page.
172+
173+
The easiest way to get the field names is to
174+
use the `CURL` and `jq` commands to retrieve an existing ticket with a public security level:
175+
176+
[source,shell, subs="+quotes"]
177+
----
178+
curl -X GET --location "https://jira.issues.couchbase.com/rest/api/2/issue/CBG-4977" \
179+
-H "Authorization: Basic #<insert your JIRA token here>#" \
180+
-H "Content-Type: application/json" | jq
181+
----
182+
183+
This will render the complete ticket (including field names) to the standard output.
184+
****
185+
186+
187+
188+
[#define-your-jinja-template]
189+
=== Step {counter: step}: Define your JINJA template
190+
191+
Before creating the rendering template, you need to add it's location to your release set.
192+
You can share templates between release sets.
193+
194+
[source,yaml]
195+
.Define the Jinja template
196+
----
197+
- name: "Docs Server (test)"
198+
fields:
199+
- name: release_date
200+
type: text
201+
message: 'Enter the release date (Month Year):'
202+
- name: release_number
203+
type: text
204+
message: 'Enter the release label:'
205+
- name: release_text
206+
type: text
207+
message: 'Enter the release number for the title line:'
208+
- name: file_path
209+
type: file
210+
message: 'Enter the file path for the release notes:'
211+
url: https://jira.issues.couchbase.com
212+
jql: project = "Couchbase Server"
213+
AND type IN (Epic, Bug, Improvement, Task, "Technical Task")
214+
AND fixVersion in ({{release_number}})
215+
AND labels IN (releasenote,releasenotecomplete)
216+
AND ("Release Notes[Labels]" NOT IN (suppress-{{release_number}}) OR "Release Notes[Labels]" IS EMPTY)
217+
AND summary !~ "System Test" AND resolution not in (Declined, "Won't Fix")
218+
AND reporter not in (membersOf(couchbase-qe-team))
219+
ORDER BY key ASC
220+
release_note_field: 'customfield_11402'
221+
template: docs-server-test.jinja2
222+
----
223+
224+
=== Step {counter: step}: Create your JINJA template
225+
226+
The templates reside in the `templates` directory, as defined near the top of the configuration file.
227+
Use your editor to create a new template file in this directory. The file should be called `docs-server-test.jinja2`,
228+
as defined in the release set configuration. (<<define-your-jinja-template>>)
229+
230+
Copy the template below into your file, then save the file.
231+
232+
[source, text]
233+
.Create the Jinja template
234+
----
235+
{%- macro generate_issue_table(filtered_issues, title, suffix) %} <1>
236+
237+
{% if filtered_issues | length > 0 -%}
238+
239+
{{- "[#dlist-fixed-issues-" ~ user_settings.fields.release_number | replace_dots('') ~ "-" ~ suffix ~ "]\n"}}
240+
{{- "=== " ~ title }}
241+
242+
{% for issue in filtered_issues %} <2>
243+
244+
{{- "*" ~ url_with_jira(user_settings.release_set.url, issue.key) ~ "*::"}} <3>
245+
246+
{{- issue.raw['fields'][user_settings.release_set.release_note_field] }} <4>
247+
248+
{% endfor %}
249+
250+
{%- endif %}
251+
252+
{%- endmacro %}
253+
254+
255+
[#release-{{ user_settings.fields.release_number | replace_dots('') }}]
256+
== Release {{ user_settings.fields.release_number }} ({{ user_settings.fields.release_date }})
257+
258+
Couchbase Server {{ user_settings.fields.release_number }} was released in {{ user_settings.fields.release_date }}.
259+
This maintenance release contains fixes to issues.
260+
261+
{{ "[#dlist-fixed-issues-" ~ user_settings.fields.release_number | replace_dots('') ~ "]"}}
262+
== Fixed Issues
263+
264+
{% include "docs-server-components.jinja2" %}
265+
266+
----
267+
268+
We won't cover the breadth of what you can do with JINJA templates,
269+
but we will highlight some of the features used in this example:
270+
271+
<1> We can define reusable macros that can be called from anywhere within the template.
272+
<2> We can define a `for … endfor` loop to iterate over the list of issues passed to the template.
273+
<3> We can access all the fields of an issue using the dot notation.
274+
<4> Use the parameter `user_settings.release_set.release_note_field` to access the release not description from the ticket.
275+
to filter issues based on field values.
276+
277+
=== Step {counter: step}: Run the Release Note Generator
278+
279+
From the terminal screen, run the application using the following command:
280+
281+
[source, shell]
282+
----
283+
./cb-release-note
284+
----
285+
286+
.Running the generator with the new release set
287+
image::release-note-generator/docs-server-test-example.png[Running the Release Note Generator]
288+
289+

0 commit comments

Comments
 (0)