collecting release notes

feature/optional_link
Karolis Rusenas 2018-06-24 23:28:54 +01:00
parent e29b90391e
commit 4f7dbd3e90
2 changed files with 57 additions and 0 deletions

View File

@ -84,6 +84,9 @@ func checkUnversionedRelease(repo *types.Repository, namespace, name string, cha
plan.CurrentVersion = imageRef.Tag()
plan.Config = keelCfg
shouldUpdateRelease = true
if imageDetails.ReleaseNotes != "" {
plan.ReleaseNotes = append(plan.ReleaseNotes, imageDetails.ReleaseNotes)
}
}
return plan, shouldUpdateRelease, nil

View File

@ -25,6 +25,24 @@ keel:
- repository: image.repository
tag: image.tag
`
chartValuesPolicyForceReleaseNotes := `
name: al Rashid
where:
city: Basrah
title: caliph
image:
repository: gcr.io/v2-namespace/hello-world
tag: 1.1.0
keel:
policy: force
trigger: poll
images:
- repository: image.repository
tag: image.tag
releaseNotes: https://github.com/keel-hq/keel/releases
`
chartValuesPolicyMajor := `
@ -53,6 +71,10 @@ keel:
Values: &hapi_chart.Config{Raw: chartValuesPolicyMajor},
}
helloWorldChartPolicyMajorReleaseNotes := &hapi_chart.Chart{
Values: &hapi_chart.Config{Raw: chartValuesPolicyForceReleaseNotes},
}
type args struct {
repo *types.Repository
namespace string
@ -97,6 +119,38 @@ keel:
wantShouldUpdateRelease: true,
wantErr: false,
},
{
name: "correct force update, with release notes",
args: args{
repo: &types.Repository{Name: "gcr.io/v2-namespace/hello-world", Tag: "1.2.0"},
namespace: "default",
name: "release-1",
chart: helloWorldChartPolicyMajorReleaseNotes,
config: &hapi_chart.Config{Raw: ""},
},
wantPlan: &UpdatePlan{
Namespace: "default",
Name: "release-1",
Chart: helloWorldChartPolicyMajorReleaseNotes,
Values: map[string]string{"image.tag": "1.2.0"},
CurrentVersion: "1.1.0",
NewVersion: "1.2.0",
ReleaseNotes: []string{"https://github.com/keel-hq/keel/releases"},
Config: &KeelChartConfig{
Policy: types.PolicyTypeForce,
Trigger: types.TriggerTypePoll,
Images: []ImageDetails{
ImageDetails{
RepositoryPath: "image.repository",
TagPath: "image.tag",
ReleaseNotes: "https://github.com/keel-hq/keel/releases",
},
},
},
},
wantShouldUpdateRelease: true,
wantErr: false,
},
{
name: "update without force",
args: args{