Skip to content

Commit

Permalink
Cherry-pick #4100 #4101 #4103 #4105 #4111 (#4112)
Browse files Browse the repository at this point in the history
* Fix to return an error when not finding the last commit (#4100)

* Update planpreview comment format (#4101)

* Update planpreview comment format

* fixup

* Update the planpreview format (#4103)

* Remove deprecated envName field (#4105)

* Release v0.41.2 (#4111)

* Release v0.41.2

* Update the release note

Co-authored-by: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com>
  • Loading branch information
knanao and khanhtc1202 committed Jan 6, 2023
1 parent 9ab142f commit 4277963
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tag: v0.41.1
tag: v0.41.2

releaseNoteGenerator:
showCommitter: false
Expand Down
16 changes: 16 additions & 0 deletions docs/content/en/blog/releases/v0.41.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Release v0.41.2"
linkTitle: "Release v0.41.2"
date: 2023-01-06
description: >
Release v0.41.2
---

## Changes since v0.41.1
### Bug Fixes
* Fix to handle an error when not finding the last commit for Cloud Run planpreview ([#4100](https://github.com/pipe-cd/pipecd/pull/4100))

### Internal Changes
* Remove deprecated envName field ([#4105](https://github.com/pipe-cd/pipecd/pull/4105))
* Update planpreview comment format ([#4101](https://github.com/pipe-cd/pipecd/pull/4101))
* Small lint fix ([#4097](https://github.com/pipe-cd/pipecd/pull/4097))
27 changes: 15 additions & 12 deletions pkg/app/piped/planpreview/cloudrundiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@ func (b *builder) cloudrundiff(
return nil, err
}

if lastCommit != "" {
runningDSP := deploysource.NewProvider(
b.workingDir,
deploysource.NewGitSourceCloner(b.gitClient, b.repoCfg, "running", lastCommit),
*app.GitPath,
b.secretDecrypter,
)
oldManifest, err = b.loadCloudRunManifest(ctx, *app, runningDSP)
if err != nil {
fmt.Fprintf(buf, "failed to load cloud run manifest at the running commit (%v)\n", err)
return nil, err
}
if lastCommit == "" {
fmt.Fprintf(buf, "failed to find the commit of the last successful deployment")
return nil, fmt.Errorf("cannot get the old manifest without the last successful deployment")
}

runningDSP := deploysource.NewProvider(
b.workingDir,
deploysource.NewGitSourceCloner(b.gitClient, b.repoCfg, "running", lastCommit),
*app.GitPath,
b.secretDecrypter,
)
oldManifest, err = b.loadCloudRunManifest(ctx, *app, runningDSP)
if err != nil {
fmt.Fprintf(buf, "failed to load cloud run manifest at the running commit (%v)\n", err)
return nil, err
}

result, err := provider.Diff(
Expand Down
3 changes: 0 additions & 3 deletions pkg/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ type GenericApplicationSpec struct {
// The application name.
// This is required if you set the application through the application configuration file.
Name string `json:"name"`
// The environment name. You need to make sure that the environment name is unique in your project.
// Deprecated.
EnvName string `json:"envName"`
// Additional attributes to identify applications.
Labels map[string]string `json:"labels"`
// Notes on the Application.
Expand Down
14 changes: 8 additions & 6 deletions tool/actions-plan-preview/planpreview.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
b.WriteString(fmt.Sprintf(hasChangeTitleFormat, event.HeadCommit, len(r.Applications)))

changedApps, pipelineApps, quickSyncApps := groupApplicationResults(r.Applications)
if len(changedApps)+len(pipelineApps)+len(quickSyncApps) > 0 {
b.WriteString("\n## Plans\n\n")
}

var detailLen int

for _, app := range changedApps {
fmt.Fprintf(&b, "\n## %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "### %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "Sync strategy: %s\n", app.SyncStrategy)
fmt.Fprintf(&b, "Summary: %s\n\n", app.PlanSummary)

Expand Down Expand Up @@ -211,7 +213,7 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
}

if len(pipelineApps)+len(quickSyncApps) > 0 {
b.WriteString("\n## No resource changes were detected but the following apps will also be triggered\n")
b.WriteString("### No resource changes were detected but the following apps will also be triggered\n")

if len(pipelineApps) > 0 {
b.WriteString("\n###### `PIPELINE`\n")
Expand All @@ -232,13 +234,13 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
return b.String()
}

fmt.Fprintf(&b, "\n---\n\n## NOTE\n\n")
fmt.Fprintf(&b, "\n## NOTE\n\n")

if len(r.FailureApplications) > 0 {
fmt.Fprintf(&b, "**An error occurred while building plan-preview for the following applications**\n")

for _, app := range r.FailureApplications {
fmt.Fprintf(&b, "\n## %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "\n### %s\n", makeTitleText(&app.ApplicationInfo))
fmt.Fprintf(&b, "Reason: %s\n\n", app.Reason)

var lang = "diff"
Expand All @@ -256,7 +258,7 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult) string {
fmt.Fprintf(&b, "**An error occurred while building plan-preview for applications of the following Pipeds**\n")

for _, piped := range r.FailurePipeds {
fmt.Fprintf(&b, "\n## piped: [%s](%s)\n", piped.PipedID, piped.PipedURL)
fmt.Fprintf(&b, "\n### piped: [%s](%s)\n", piped.PipedID, piped.PipedURL)
fmt.Fprintf(&b, "Reason: %s\n\n", piped.Reason)
}
}
Expand Down

0 comments on commit 4277963

Please sign in to comment.