Skip to content

Commit

Permalink
Fix generate comment diff processor build failure (GoogleCloudPlatfor…
Browse files Browse the repository at this point in the history
…m#10164)

* Refactored generate_comment to continue in the face of errors

Also switched to go template for comment formatting

* Moved to structured data for diffs

Also added error formatting into comment

* Added basic tests for comment formatting

* Skipped missing tests and breaking changes if repo failed to clone

* Force generation

* Breaking change

* Fixed error display in diff comment

* Marked diff-processor targets as not being real files

* Added PATH to diffProcessorEnv

* Fixed formatting for error sections

* Cleaned up passthrough env var usage

* Made exec.sh exit 1 if there are any errors running the magician

* Don't error on initial build of the magician binary

* Added missing  env var for diff processor build

* Force generation of tf-oics

* Revert "Force generation of tf-oics"

This reverts commit fcb65f1.

* Revert "Force generation"

This reverts commit 596d1eb.

* Revert "Breaking change"

This reverts commit fb04ad4.

* Force missing test run

* force missing tests to run - take 2

* Revert "force missing tests to run - take 2"

This reverts commit 34f7d16.

* Revert "Force missing test run"

This reverts commit 90e664a.
  • Loading branch information
melinath authored and balanaguharsha committed May 2, 2024
1 parent cda5343 commit 2d34727
Show file tree
Hide file tree
Showing 7 changed files with 488 additions and 265 deletions.
36 changes: 36 additions & 0 deletions .ci/magician/cmd/DIFF_COMMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Hi there, I'm the Modular magician. I've detected the following information about your changes:

## Diff report
{{ $diffsLength := len .Diffs }}{{if eq $diffsLength 0 }}
Your PR hasn't generated any diffs, but I'll let you know if a future commit does.
{{else}}
Your PR generated some diffs in downstreams - here they are.

{{range .Diffs -}}
{{.Title}}: [Diff](https://github.com/modular-magician/{{.Repo}}/compare/auto-pr-{{$.PrNumber}}-old..auto-pr-{{$.PrNumber}}) ({{.DiffStats}})
{{end -}}
{{end -}}

{{- $breakingChangesLength := len .BreakingChanges }}
{{- if gt $breakingChangesLength 0}}
## Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

{{- range .BreakingChanges}}
- {{.}}{{end}}

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a [major release](https://www.terraform.io/plugin/sdkv2/best-practices/versioning#example-major-number-increments) window.
An `override-breaking-change` label can be added to allow merging.
{{end}}
{{.MissingTests}}
{{- $errorsLength := len .Errors}}
{{- if gt $errorsLength 0}}
## Errors
{{range .Errors}}
{{.Title}}:
{{- range .Errors}}
- {{.}}{{end}}
{{end}}
{{- end -}}
Loading

0 comments on commit 2d34727

Please sign in to comment.