Skip to content

Commit 955eca0

Browse files
authored
Provide usage docs (#29)
1 parent 6f6d4b9 commit 955eca0

12 files changed

+430
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ Tooling to manage the changelog for beats, Elastic Agent and Fleet Server
66
`git` CLI should be installed and available.
77
[`go-licenser`](https://github.com/elastic/go-licenser) CLI should be installed and available.
88

9+
## Usage
10+
11+
Install following one of the methods provided in [docs/install.md].
12+
13+
To get started look into [docs/getting-started.md]
14+
15+
Look at [docs/usage.md] for detailed usage guidelines.
16+
17+
Look into [docs/concepts.md] for overall concepts behind how it works and [docs/glossary.md] for details about terms used in this project.
18+
19+
[docs/install.md]: ./docs/usage.md
20+
[docs/getting-started.md]: ./docs/getting-started.md
21+
[docs/usage.md]: ./docs/usage.md
22+
[docs/concepts.md]: ./docs/concepts.md
23+
[docs/glossary.md]: ./docs/glossary.md
24+
925
## Contributing
1026

1127
Thinking of contributing? Thank you! Look at [`./CONTRIBUTING.md`](./CONTRIBUTING.md) for guidelines.

changelog/0.1.0.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: 0.1.0
2+
entries:
3+
- summary: Add Changelog Fragment creation
4+
description: ""
5+
kind: feature
6+
pr: 13
7+
issue: 21
8+
timestamp: 1649924282
9+
file:
10+
name: 1649924282-changelog-fragment-creation.yaml
11+
checksum: 10bf1bf67509a524e48f0795be75c278e29c0b47
12+
- summary: Add version command
13+
description: ""
14+
kind: feature
15+
pr: 23
16+
issue: 19
17+
timestamp: 1649924372
18+
file:
19+
name: 1649924372-version-command.yaml
20+
checksum: fc5421947f717377f82f539ba3eabbdcd375e67e
21+
- summary: Update Changelog Fragment structure
22+
description: Previous fragment structure was temporary and we agreed on a new flattened structure.
23+
kind: bug-fix
24+
pr: 17
25+
issue: 13
26+
timestamp: 1649924436
27+
file:
28+
name: 1649924436-update-changelog-fragment-structure.yaml
29+
checksum: f711f4ffe46eb5967d77d4e56912a7029bc4ce16
30+
- summary: Add find-pr command
31+
description: find-pr command returns all PRs a commit was found in through GitHub APIs.
32+
kind: feature
33+
pr: 16
34+
issue: 5
35+
timestamp: 1649924529
36+
file:
37+
name: 1649924529-add-find-pr-command.yaml
38+
checksum: b94cc8d3133df0db263c18d0879a70a34f744373
39+
- summary: Implement consolidated changelog builder
40+
description: ""
41+
kind: feature
42+
pr: 15
43+
issue: 20
44+
timestamp: 1649924600
45+
file:
46+
name: 1649924600-implement-consolidated-changelog-builder.yaml
47+
checksum: 3c45730cac255e4300b4f877d73b2d50af70c717
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: feature
12+
# Change summary; a 80ish characters long description of the change.
13+
summary: Add Changelog Fragment creation
14+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
15+
# description:
16+
# Affected component; a word indicating the component this changeset affects.
17+
# component:
18+
# PR number; optional; the PR number that added the changeset.
19+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
20+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
21+
# Please provide it if you are adding a fragment for a different PR.
22+
pr: 13
23+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
24+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
25+
issue: 21
26+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
27+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
28+
# repository: https://github.com/elastic/elastic-agent-changelog-tool
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: feature
12+
# Change summary; a 80ish characters long description of the change.
13+
summary: Add version command
14+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
15+
# description:
16+
# Affected component; a word indicating the component this changeset affects.
17+
# component:
18+
# PR number; optional; the PR number that added the changeset.
19+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
20+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
21+
# Please provide it if you are adding a fragment for a different PR.
22+
pr: 23
23+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
24+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
25+
issue: 19
26+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
27+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
28+
# repository: https://github.com/elastic/elastic-agent-changelog-tool
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: bug-fix
12+
# Change summary; a 80ish characters long description of the change.
13+
summary: Update Changelog Fragment structure
14+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
15+
description: Previous fragment structure was temporary and we agreed on a new flattened structure.
16+
# Affected component; a word indicating the component this changeset affects.
17+
# component:
18+
# PR number; optional; the PR number that added the changeset.
19+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
20+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
21+
# Please provide it if you are adding a fragment for a different PR.
22+
pr: 17
23+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
24+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
25+
issue: 13
26+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
27+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
28+
# repository: https://github.com/elastic/elastic-agent-changelog-tool
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: feature
12+
# Change summary; a 80ish characters long description of the change.
13+
summary: Add find-pr command
14+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
15+
description: find-pr command returns all PRs a commit was found in through GitHub APIs.
16+
# Affected component; a word indicating the component this changeset affects.
17+
# component:
18+
# PR number; optional; the PR number that added the changeset. find-pr command returns all PRs a commit was found in through GitHub APIs.
19+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
20+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
21+
# Please provide it if you are adding a fragment for a different PR.
22+
pr: 16
23+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
24+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
25+
issue: 5
26+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
27+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
28+
# repository: https://github.com/elastic/elastic-agent-changelog-tool
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: feature
12+
# Change summary; a 80ish characters long description of the change.
13+
summary: Implement consolidated changelog builder
14+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
15+
# description:
16+
# Affected component; a word indicating the component this changeset affects.
17+
# component:
18+
# PR number; optional; the PR number that added the changeset.
19+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
20+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
21+
# Please provide it if you are adding a fragment for a different PR.
22+
pr: 15
23+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
24+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
25+
issue: 20
26+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
27+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
28+
# repository: https://github.com/elastic/elastic-agent-changelog-tool

docs/concepts.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# File based approach
2+
3+
This CLI tool is file based. This means files are it's primary source and primary output, and all steps in the process produce files that can be archived or versioned (through `git` for example).
4+
5+
Adopting a file based approach has this advantages:
6+
- Editing files is widely supported
7+
- Validation files is easy
8+
- Structured content is easy
9+
- Is possible to correlate a file with a commit (i.e. through `git blame`)
10+
- Works with any code versioning tools (but we focus on `git`)
11+
- Bulk editing relies on bulk file editing support
12+
- Trunk-based development is supported out of the box
13+
14+
# Git focused
15+
16+
We rely on `git` and `GitHub`, the tool is not expected to allow choosing a different VCS or code hosting platform.
17+
18+
# Files
19+
## Changelog fragment
20+
21+
A **changelog fragment** is a file representing a **changelog entry**.
22+
23+
Changelog fragments are uniquely named and contain all information needed to create changelog entries. They are easy to write and must be part of the git history.
24+
25+
## Changelog entry
26+
27+
A **changelog entry** is an entry in the changelog, representing a documented changeset.
28+
29+
Changelog entries are structured and enriched to provide all information needed to build the consolidated changelog.
30+
31+
## Consolidated changelog
32+
33+
The **consolidated changelog** is a list of changelog entries.
34+
35+
Is created from a list of changelog fragments, enriched and structured. It can be manually edited where needed.
36+
37+
## Release notes
38+
39+
Release notes are the human or machine readable output created from a consolidated changelog.

docs/configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Configuration options
2+
3+
`elastic-agent-changelog-tool` has configuration options available to change it's behaviour.
4+
5+
All settings are managed via the [`settings`][settings] package, using [`spf13/viper`][viper].
6+
Configurations are bound to environment variables with same name and `ELASTIC_AGENT_CHANGELOG` prefix using [`viper.BindEnv`][bindenv].
7+
8+
This CLI supports and adhere to cross platform XDG Standard provided by [`OpenPeeDeeP/xdg`][xdg].
9+
10+
|Settings key|Default value|Note|
11+
|---|---|---|---|
12+
|`fragment_location`|`$GIT_REPO_ROOT/changelog/fragments`|The location of changelog fragments used by the CLI. By default `fragment_root` + `fragment_path`.|
13+
|`fragment_path`|`changelog/fragments`|The path in `fragment_root` where to locate changelog fragments.|
14+
|`fragment_root`|`$GIT_REPO_ROOT`|The root folder for `fragment_location`.|
15+
16+
## Configuration file
17+
18+
Not supported yet.
19+
20+
## Supported Environment Variables
21+
22+
`elastic-agent-changelog-tool` uses some environment variables that can be set.
23+
24+
|Name|Default|Note|
25+
|---|---|---|
26+
|`GIT_REPO_ROOT`|Git repository root folder|This value is computed at each execution to retrieve the repository root folder.|
27+
28+
[bindenv]: https://pkg.go.dev/github.com/spf13/viper#BindEnv
29+
[settings]: ../internal/settings/settings.go
30+
[xdg]: https://pkg.go.dev/github.com/OpenPeeDeeP/xdg
31+
[viper]: https://pkg.go.dev/github.com/spf13/viper

docs/getting-started.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Getting started
2+
3+
This page describes all steps required for going from zero to viewing a consolidated changelog.
4+
5+
## 1. Prerequisites
6+
7+
Ensure you have `git` installed and available.
8+
9+
## 2. Install
10+
11+
Follow one of the installation ways described in [`./install.md`](./install.md).
12+
13+
## 3. Create a changelog fragment
14+
15+
From the root folder of the repository run:
16+
17+
```
18+
$ elastic-agent-changelog-tool new "my test fragment"
19+
```
20+
21+
This will create `./changelog/fragments/<timestamp>-my-test-fragment.yaml` with this content:
22+
23+
```yaml
24+
# one of:
25+
# - breaking-change: a change to previously-documented behavior
26+
# - deprecation: functionality that is being removed in a later release
27+
# - bug-fix: fixes a problem in a previous version
28+
# - enhancement: extends functionality but does not break or fix existing behavior
29+
# - feature: new functionality
30+
# - known-issue: problems that we are aware of in a given version
31+
# - security: impacts on the security of a product or a user’s deployment.
32+
# - upgrade: important information for someone upgrading from a prior version
33+
# - other: does not fit into any of the other categories
34+
kind: feature
35+
# Change summary; a 80ish characters long description of the change.
36+
summary:
37+
# Long description; in case the summary is not enough to describe the change this field accomodate a description without length limits.
38+
# description:
39+
# Affected component; a word indicating the component this changeset affects.
40+
component:
41+
# PR number; optional; the PR number that added the changeset.
42+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
43+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
44+
# Please provide it if you are adding a fragment for a different PR.
45+
# pr: 1234
46+
# Issue number; optional; the GitHub issue related to this changeset (either closes or is part of).
47+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
48+
# issue: 1234
49+
# Repository URL; optional; the repository URL related to this changeset and pr and issue numbers.
50+
# If not present is automatically filled by the tooling based on the repository this file has been committed in.
51+
# repository: https://github.com/elastic/elastic-agent-changelog-tool
52+
```
53+
54+
Ensure `kind` is correct and fill the `summary` field with a brief description. You can ignore `component`, but you must set `pr`, `issue` and `repository` manually, the logic to fill them automatically is still work in progress.
55+
56+
Save and close the file.
57+
58+
## 4. Create the consolidated changelog
59+
60+
From the root folder of the repository run:
61+
62+
```
63+
$ elastic-agent-changelog-tool build --version 0.1.0
64+
```
65+
66+
This will create `./changelog.yaml` with content similar to this:
67+
68+
```yaml
69+
version: 0.1.0
70+
entries:
71+
- summary: Add Changelog Fragment creation
72+
description: ""
73+
kind: feature
74+
pr: 13
75+
issue: 21
76+
timestamp: 1649924282
77+
file:
78+
name: 1649924282-changelog-fragment-creation.yaml
79+
checksum: 10bf1bf67509a524e48f0795be75c278e29c0b47
80+
81+
```
82+
83+
There will be multiple entries, one for each files in `changelog/fragments`.
84+
85+
**NOTE:** the version is currently hard coded to `0.1.0` (the first version for `elastic-agent-changelog-tool`).

0 commit comments

Comments
 (0)