Skip to content

coreos-release-notes-generator: init script for generating release notes #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

zonggen
Copy link

@zonggen zonggen commented Aug 7, 2020

This script generates Fedora CoreOS release note from pre-mature release note snippets. Takes two arguments: --config-dir and --output-dir.

The config_dir is the directory where a 'release-notes.d directory resides, typically a fedora-coreos-config directory, which has pre-mature release notes yaml snippets.

The output_dir is the directory where a release-notes.yaml resides. If there's no such file then a new file will be created. If a release-notes.yaml already exists, then checks if the next-release field is present in the file. It inserts the next-release field to the front of the file if none is present or updates the existing next-release field if one already exists.

Related: coreos/fedora-coreos-tracker#194
Signed-off-by: Allen Bai abai@redhat.com

@zonggen zonggen force-pushed the fcos-release-notes branch 3 times, most recently from c83c744 to e37a70a Compare August 7, 2020 19:10
@zonggen zonggen force-pushed the fcos-release-notes branch 2 times, most recently from 310170f to c985d06 Compare August 10, 2020 18:40
@zonggen zonggen changed the title [WIP] coreos-release-note-generator: init script for generating release notes coreos-release-note-generator: init script for generating release notes Aug 10, 2020
@dustymabe
Copy link
Member

Thanks @zonggen for working on this! A few questions/comments:

@zonggen
Copy link
Author

zonggen commented Aug 17, 2020

@dustymabe Thanks for reviewing! Will cleanup the code and add a README for documentation. Also will update with the updated schema in coreos/fedora-coreos-config#550

@zonggen
Copy link
Author

zonggen commented Aug 20, 2020

Removed next-release intermediate logic and added documentations.

Currently working on adding a list of file names such that no duplication between multiple testing releases, since we need yaml snippets to accumulate under release-notes.d/ for stable.

@@ -0,0 +1,82 @@
# coreos-release-note-generator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename to coreos-release-notes-generator?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed 👍

`coreos-release-note-generator` generates `release-notes.yaml` from `release-notes.d` yaml snippets using the specified build id using `--build-id` option.

## Options
- `--build-id`: build id of the latest release note
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `--build-id`: build id of the latest release note
- `--build-id`: build id of the latest release

args.config_dir, 'release-notes.d/*.yaml'))
if len(snippet_yaml_list) == 0:
print("release-notes.d/ does not contain any yaml snippets under '{}'".format(args.config_dir))
exit(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we return here instead of exiting in the middle of a function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should probably consider the case where we haven't added any release-notes.d/ files for a particular release. I guess in that case we should just put an empty entry in the list saying there are not release notes or something.

Copy link
Author

@zonggen zonggen Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should probably consider the case where we haven't added any release-notes.d/ files for a particular release. I guess in that case we should just put an empty entry in the list saying there are not release notes or something.

Or, we could just merge this list of build_id: release_notes items into a single dictionary so that we could query whether a release note exists for a release just by checking if the key build_id exists. This could be done when we are converting to JSON format for website consumption, on the other hand I think it makes sense to use YAML file for human readability on other places like fedora-coreos-config.

note = {'subject': item.get(
'subject', ''), 'body': item.get('body', '')}
# purposely avoid item.get('component', '') to error out if the component key does not exist
project_name = item['component']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using project throughout this file should we just call it component instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed 👍

@zonggen zonggen force-pushed the fcos-release-notes branch from fa5f509 to 6389966 Compare August 24, 2020 18:42
@dustymabe
Copy link
Member

one small nit and then we can merge:

Change commit subject line to coreos-release-notes-generator: init script for generating release notes

`coreos-release-notes-generator` generates `release-notes.yaml` from `release-notes.d` yaml snippets using the specified build id using `--build-id` option.

Supported options include:
 - `--build-id`(required): build id of the latest release note
 - `--config-dir`(required): path to the directory where `release-notes.d/` lives
 - `--release-notes-file`(optional): path to the input `release-notes.yaml` file for update, the script uses this option to determine whether to update an existing `release-notes.yaml` or to create a new one. By default create a new `release-notes.yaml`
 - `--output-dir`(optional): output directory for `release-notes.yaml`, by default outputs to STDOUT
 - `--json`(optional): output JSON format instead of YAML for easier consumption by Fedora CoreOS website (https://getfedora.org/en/coreos?stream=stable), by default uses YAML

Related: coreos/fedora-coreos-tracker#194
Signed-off-by: Allen Bai <abai@redhat.com>
@zonggen zonggen force-pushed the fcos-release-notes branch from 6389966 to 28376c3 Compare August 25, 2020 16:31
@zonggen
Copy link
Author

zonggen commented Aug 25, 2020

Fixed commit subject, thanks for pointing that out!

@dustymabe dustymabe changed the title coreos-release-note-generator: init script for generating release notes coreos-release-notes-generator: init script for generating release notes Aug 25, 2020
@dustymabe
Copy link
Member

LGTM - I think we can merge this and do fixups for things we find in a followup PR.

Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dustymabe dustymabe merged commit 6d7d0b0 into coreos:master Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants