miniscruff/changie

changie batch should throw a better error message when a change entry yaml is invalid yaml

rocktavious opened this issue · 4 comments

Description
Using the latest version of changie seems to have broken our deployment pipeline. We run changie batch v2023.10.20 today and we get the following error

yaml: line 2: mapping values are not allowed in this context

This worked on our last release v2023.10.3

What happened

yaml: line 2: mapping values are not allowed in this context

Expected behavior
To create the batch of changes

Additional context
Here is the .changie.yaml we are using

changesDir: ".changes"
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## [{{.Time.Format "January 02, 2006"}}](https://github.com/OpsLevel/opslevel-go/compare/{{.PreviousVersion}}...{{.Version}})'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Bugfix
- label: Feature
- label: Security
- label: Refactor
- label: Deprecated
- label: Removed
- label: Docs
- label: Dependency
newlines:
  afterChangelogHeader: 1
  beforeChangelogVersion: 1
  endOfVersion: 1
envPrefix: CHANGIE_

hmm it appears this was due to a change entry with bad yaml

kind: Deprecated
body: BREAKING CHANGE: TeamMembershipUserInput Email field replaced with User field
time: 2023-10-13T13:27:10.249548-05:00

was the entry and you can see there is a non-escaped : or not quotes around it.

switching it to

kind: Deprecated
body: "BREAKING CHANGE: TeamMembershipUserInput Email field replaced with User field"
time: 2023-10-13T13:27:10.249548-05:00

Fixed the changie batch command. Maybe it would be good to be more explicit which .yaml file was failing to be parsed?

hmm it appears this was due to a change entry with bad yaml

kind: Deprecated
body: BREAKING CHANGE: TeamMembershipUserInput Email field replaced with User field
time: 2023-10-13T13:27:10.249548-05:00

was the entry and you can see there is a non-escaped : or not quotes around it.

switching it to

kind: Deprecated
body: "BREAKING CHANGE: TeamMembershipUserInput Email field replaced with User field"
time: 2023-10-13T13:27:10.249548-05:00

Fixed the changie batch command. Maybe it would be good to be more explicit which .yaml file was failing to be parsed?

Was this file manually written or did changie create a bad file?

A more explicit error sounds like a good plan as well, I would of had a hard time finding that.

@miniscruff looks like it was due to a inline github edit 😢
Screen Shot 2023-10-20 at 4 18 37 PM

So ya no problem with changie - just a better error message would help. After i regenerated the .changie.yaml from scratch and used the baseline the tool generates and it still was erroring it hit me it might be a change entry yaml file. Sure enough. 😢

@miniscruff looks like it was due to a inline github edit 😢
Screen Shot 2023-10-20 at 4 18 37 PM

So ya no problem with changie - just a better error message would help. After i regenerated the .changie.yaml from scratch and used the baseline the tool generates and it still was erroring it hit me it might be a change entry yaml file. Sure enough. 😢

Ok yea that makes sense. A new issue to update the error to include which file would be good.