Skip to content

Commit c673d6c

Browse files
committed
Update release note generator example to use Couchbase Server
Revised the documentation for the release note generator to replace example configuration for "Sync Gateway" with "Docs Server (test)" for Couchbase Server. Updated Jinja template and adjusted input parameters, fields, and examples accordingly.
1 parent c84b317 commit c673d6c

3 files changed

Lines changed: 76 additions & 68 deletions

File tree

1.13 MB
Loading
Binary file not shown.

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

Lines changed: 76 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ alter the Python script itself. Adding a new product involves two steps:
2727

2828
== Adding a new product
2929

30-
To demonstrate this process, we're going to create a new release note configuration for the Sync Gateway product.
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).
3132

3233
NOTE: You should run the following commands from the directory where your Release Notes Generator is installed.
3334

@@ -48,7 +49,7 @@ and add the new `name` item underneath the `release_settings` section:
4849
[source, yaml]
4950
----
5051
release_settings:
51-
- name: "Sync Gateway"
52+
- name: "Docs Server (test)"
5253
----
5354

5455
=== Step {counter: step}: Define your parameters
@@ -60,12 +61,13 @@ The most common parameters are:
6061

6162
[horizontal]
6263

63-
Release number::
64-
The label that our JQL will use to find the release tag.
65-
6664
Release date::
6765
This will appear in the release note heading.
6866

67+
68+
Release number::
69+
The label that our JQL will use to find the release tag.
70+
6971
File path::
7072
This is a mandatory item needed for each release set.
7173
It supplies the name of the AsciiDoc file that the script generates.
@@ -74,16 +76,17 @@ Other parameters that the SQL will need, (such as the project name), are fixed v
7476
and don't need to be parameterized.
7577

7678
[source, yaml]
79+
.Add the input parameters
7780
----
7881
release_settings:
79-
- name: "Sync Gateway"
82+
- name: "Docs Server (test)"
8083
fields:
81-
- name: release_number
82-
type: text
83-
message: 'Enter the release number:'
8484
- name: release_date
8585
type: text
8686
message: 'Enter the release date (Month Year):'
87+
- name: release_number
88+
type: text
89+
message: 'Enter the release label:'
8790
- name: file_path
8891
type: file
8992
message: 'Enter the file path for the release notes:'
@@ -96,25 +99,28 @@ Now, you add the URL and the JQL statements used to retrieve the Jira tickets th
9699
[source, yaml]
97100
.Adding the JQL statement
98101
----
99-
release_settings:
100-
- name: "Sync Gateway"
102+
- name: "Docs Server (test)"
101103
fields:
102-
- name: release_number
103-
type: text
104-
message: 'Enter the release number:'
105104
- name: release_date
106105
type: text
107106
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:'
108113
- name: file_path
109114
type: file
110115
message: 'Enter the file path for the release notes:'
111116
url: https://jira.issues.couchbase.com
112-
jql: project = CBG AND issuetype in (Bug, "New Feature", Improvement) # <.>
113-
AND (fixVersion = {{release_number}} OR labels IN (known_issue)) # <.>
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)
114121
ORDER BY key ASC # <.>
115-
template: sync-gateway.jinja2
116122
----
117-
<.> Note that the JQL statement restricts the query to tickets belonging to the Sync Gateway project,
123+
<.> Note that the JQL statement restricts the query to tickets belonging to the Couchbase Server project,
118124
and also ensures that the ticket is either a Bug or a New Feature.
119125
<.> We supply the `release_number` parameter to the JQL statement so that we only pick up tickets from the specified release.
120126
<.> The `ORDER BY key` clause ensures that the tickets are returned in ascending order based on their Jira key.
@@ -132,24 +138,29 @@ For most of the Couchbase projects, this was added some time after the Jira syst
132138
so the new field was added as a custom field called `customfield_11402`.
133139

134140
[source,yaml, subs="+quotes"]
141+
.Define the `release_notes_field`
135142
----
136-
- name: "Sync Gateway"
143+
- name: "Docs Server (test)"
137144
fields:
138-
- name: release_number
139-
type: text
140-
message: 'Enter the release number:'
141145
- name: release_date
142146
type: text
143147
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:'
144154
- name: file_path
145155
type: file
146156
message: 'Enter the file path for the release notes:'
147157
url: https://jira.issues.couchbase.com
148-
jql: project = CBG AND issuetype in (Bug, "New Feature", Improvement)
149-
AND (fixVersion = {{release_number}} OR labels IN (known_issue))
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)
150162
ORDER BY key ASC
151163
#release_note_field: 'customfield_11402'#
152-
template: sync-gateway.jinja2
153164
----
154165

155166
Any item from the `fields` list can be designated as a `release_note_field` (e.g. the ticket's `summary` field).
@@ -181,79 +192,76 @@ Before creating the rendering template, you need to add it's location to your re
181192
You can share templates between release sets.
182193

183194
[source,yaml]
184-
.The completed release set
195+
.Define the Jinja template
185196
----
186-
release_settings:
187-
- name: "Sync Gateway"
197+
- name: "Docs Server (test)"
188198
fields:
189-
- name: release_number
190-
type: text
191-
message: 'Enter the release number:'
192199
- name: release_date
193200
type: text
194201
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:'
195208
- name: file_path
196209
type: file
197210
message: 'Enter the file path for the release notes:'
198211
url: https://jira.issues.couchbase.com
199-
jql: project = CBG AND issuetype in (Bug, "New Feature")
200-
AND (fixVersion = {{release_number}} OR labels IN (known_issue))
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))
201219
ORDER BY key ASC
202-
template: sync-gateway.jinja2
220+
release_note_field: 'customfield_11402'
221+
template: docs-server-test.jinja2
203222
----
204223

205224
=== Step {counter: step}: Create your JINJA template
206225

207226
The templates reside in the `templates` directory, as defined near the top of the configuration file.
208-
Use your editor to create a new template file in this directory. The file should be called `sync-gateway.jinja2`,
227+
Use your editor to create a new template file in this directory. The file should be called `docs-server-test.jinja2`,
209228
as defined in the release set configuration. (<<define-your-jinja-template>>)
210229

211230
Copy the template below into your file, then save the file.
212231

213-
[source]
232+
[source, text]
233+
.Create the Jinja template
214234
----
235+
{%- macro generate_issue_table(filtered_issues, title, suffix) %} <1>
215236
216-
{% macro generate_issue_list(issues) %} <1>
217-
218-
{% if issues | length %}
219-
{% for issue in issues %} <2>
220-
221-
* {{ user_settings.release_set.url }}/browse/{{ issue.key }}[++{{ issue.key }} {{ issue.fields.summary }}++] <3>
222-
{% endfor %}
223-
{% else %}
224-
None for this release.
225-
{% endif %}
237+
{% if filtered_issues | length > 0 -%}
226238
227-
{% endmacro %} <1>
239+
{{- "[#dlist-fixed-issues-" ~ user_settings.fields.release_number | replace_dots('') ~ "-" ~ suffix ~ "]\n"}}
240+
{{- "=== " ~ title }}
228241
229-
{% set improvements = issues | selectattr('fields.issuetype.name', 'in', 'New Feature,Epic,Improvement') <4>
230-
| selectattr('fields.status.name', 'in','Resolved, Closed')
231-
| selectattr('fields.resolution.name', 'in','Fixed, Done')
232-
| rejectattr('fields.labels', 'contains', 'known_issue') | list %}
242+
{% for issue in filtered_issues %} <2>
233243
234-
{% set bugs = issues | selectattr('fields.issuetype.name', 'in', 'Bug')
235-
| selectattr('fields.resolution.name', 'in','Fixed')
236-
| rejectattr('fields.labels', 'contains', 'known_issue') | list %}
244+
{{- "*" ~ url_with_jira(user_settings.release_set.url, issue.key) ~ "*::"}} <3>
237245
238-
{% set known_issues = issues | selectattr('fields.labels', 'contains', 'known_issue')
239-
| rejectattr('fields.status.name', 'in','Resolved, Closed') | list %}
246+
{{- issue.raw['fields'][user_settings.release_set.release_note_field] }} <4>
240247
241-
== {{ user_settings.fields.release_number }} -- {{ user_settings.fields.release_date }}
248+
{% endfor %}
242249
243-
[#maint-{{user_settings.fields.release_number | replace_dots('-') }}]
250+
{%- endif %}
244251
245-
=== Enhancements
246-
{{ generate_issue_list(improvements) }} <1>
252+
{%- endmacro %}
247253
248-
=== Issues and Resolutions
249254
250-
==== Fixed Issues
255+
[#release-{{ user_settings.fields.release_number | replace_dots('') }}]
256+
== Release {{ user_settings.fields.release_number }} ({{ user_settings.fields.release_date }})
251257
252-
{{ generate_issue_list(bugs) }} <1>
258+
Couchbase Server {{ user_settings.fields.release_number }} was released in {{ user_settings.fields.release_date }}.
259+
This maintenance release contains fixes to issues.
253260
254-
==== Known Issues
261+
{{ "[#dlist-fixed-issues-" ~ user_settings.fields.release_number | replace_dots('') ~ "]"}}
262+
== Fixed Issues
255263
256-
{{ generate_issue_list(known_issues) }} <1
264+
{% include "docs-server-components.jinja2" %}
257265
258266
----
259267

@@ -263,7 +271,7 @@ but we will highlight some of the features used in this example:
263271
<1> We can define reusable macros that can be called from anywhere within the template.
264272
<2> We can define a `for … endfor` loop to iterate over the list of issues passed to the template.
265273
<3> We can access all the fields of an issue using the dot notation.
266-
<4> We can filter the issue list even further by using the built-in `selectattr` function
274+
<4> Use the parameter `user_settings.release_set.release_note_field` to access the release not description from the ticket.
267275
to filter issues based on field values.
268276

269277
=== Step {counter: step}: Run the Release Note Generator
@@ -275,7 +283,7 @@ From the terminal screen, run the application using the following command:
275283
./cb-release-note
276284
----
277285

278-
.Running the generator with the new Sync Gateway release set
279-
image::release-note-generator/sync-gateway-example.png[Running the Release Note Generator]
286+
.Running the generator with the new release set
287+
image::release-note-generator/docs-server-test-example.png[Running the Release Note Generator]
280288

281289

0 commit comments

Comments
 (0)