ran through gofmt; removed uneccessary comments; cleaned prometheus test
parent
370779e5b7
commit
e7a130d589
|
@ -90,4 +90,3 @@ func (c *ApprovalContext) Created() string {
|
|||
c.AddHeader(ApprovalCreatedHeader)
|
||||
return c.v.CreatedAt.String()
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package hipchat
|
|||
import (
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/daneharrigan/hipchat"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type XmppImplementer interface {
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"github.com/keel-hq/keel/bot"
|
||||
"github.com/keel-hq/keel/constants"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
h "github.com/daneharrigan/hipchat"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const connectionAttemptsDefault = 5
|
||||
|
|
|
@ -14,27 +14,27 @@ func (b *Bot) RequestApproval(req *types.Approval) error {
|
|||
req.Message,
|
||||
types.LevelSuccess.Color(),
|
||||
[]slack.AttachmentField{
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Approval required!",
|
||||
Value: req.Message + "\n" + fmt.Sprintf("To vote for change type '%s approve %s' to reject it: '%s reject %s'.", b.name, req.Identifier, b.name, req.Identifier),
|
||||
Short: false,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Votes",
|
||||
Value: fmt.Sprintf("%d/%d", req.VotesReceived, req.VotesRequired),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Delta",
|
||||
Value: req.Delta(),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Identifier",
|
||||
Value: req.Identifier,
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Provider",
|
||||
Value: req.Provider.String(),
|
||||
Short: true,
|
||||
|
@ -50,22 +50,22 @@ func (b *Bot) ReplyToApproval(approval *types.Approval) error {
|
|||
"All approvals received, thanks for voting!",
|
||||
types.LevelInfo.Color(),
|
||||
[]slack.AttachmentField{
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "vote received!",
|
||||
Value: "Waiting for remaining votes.",
|
||||
Short: false,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Votes",
|
||||
Value: fmt.Sprintf("%d/%d", approval.VotesReceived, approval.VotesRequired),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Delta",
|
||||
Value: approval.Delta(),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Identifier",
|
||||
Value: approval.Identifier,
|
||||
Short: true,
|
||||
|
@ -77,27 +77,27 @@ func (b *Bot) ReplyToApproval(approval *types.Approval) error {
|
|||
"Change was rejected",
|
||||
types.LevelWarn.Color(),
|
||||
[]slack.AttachmentField{
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "change rejected",
|
||||
Value: "Change was rejected.",
|
||||
Short: false,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Status",
|
||||
Value: approval.Status().String(),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Votes",
|
||||
Value: fmt.Sprintf("%d/%d", approval.VotesReceived, approval.VotesRequired),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Delta",
|
||||
Value: approval.Delta(),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Identifier",
|
||||
Value: approval.Identifier,
|
||||
Short: true,
|
||||
|
@ -109,22 +109,22 @@ func (b *Bot) ReplyToApproval(approval *types.Approval) error {
|
|||
"All approvals received, thanks for voting!",
|
||||
types.LevelSuccess.Color(),
|
||||
[]slack.AttachmentField{
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "update approved!",
|
||||
Value: "All approvals received, thanks for voting!",
|
||||
Short: false,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Votes",
|
||||
Value: fmt.Sprintf("%d/%d", approval.VotesReceived, approval.VotesRequired),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Delta",
|
||||
Value: approval.Delta(),
|
||||
Short: true,
|
||||
},
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: "Identifier",
|
||||
Value: approval.Identifier,
|
||||
Short: true,
|
||||
|
|
|
@ -150,7 +150,7 @@ func (b *Bot) postMessage(title, message, color string, fields []slack.Attachmen
|
|||
params.IconURL = b.getBotUserIconURL()
|
||||
|
||||
attachements := []slack.Attachment{
|
||||
slack.Attachment{
|
||||
{
|
||||
Fallback: message,
|
||||
Color: color,
|
||||
Fields: fields,
|
||||
|
|
|
@ -92,11 +92,11 @@ func (s *sender) Send(event types.EventNotification) error {
|
|||
params.IconURL = constants.KeelLogoURL
|
||||
|
||||
attachements := []slack.Attachment{
|
||||
slack.Attachment{
|
||||
{
|
||||
Fallback: event.Message,
|
||||
Color: event.Level.Color(),
|
||||
Fields: []slack.AttachmentField{
|
||||
slack.AttachmentField{
|
||||
{
|
||||
Title: event.Type.String(),
|
||||
Value: event.Message,
|
||||
Short: false,
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// namespace/release name/version
|
||||
func getIdentifier(namespace, name, version string) string {
|
||||
return namespace + "/" + name + ":" + version
|
||||
// namespace/release name:version
|
||||
func getIdentifier(plan *UpdatePlan) string {
|
||||
return fmt.Sprintf("%s/%s:%s", plan.Namespace, plan.Name, plan.NewVersion)
|
||||
}
|
||||
|
||||
func (p *Provider) checkForApprovals(event *types.Event, plans []*UpdatePlan) (approvedPlans []*UpdatePlan) {
|
||||
|
@ -24,6 +24,7 @@ func (p *Provider) checkForApprovals(event *types.Event, plans []*UpdatePlan) (a
|
|||
"error": err,
|
||||
"release_name": plan.Name,
|
||||
"namespace": plan.Namespace,
|
||||
"version": plan.NewVersion,
|
||||
}).Error("provider.helm: failed to check approval status for deployment")
|
||||
continue
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ func (p *Provider) checkForApprovals(event *types.Event, plans []*UpdatePlan) (a
|
|||
|
||||
// updateComplete is called after we successfully update resource
|
||||
func (p *Provider) updateComplete(plan *UpdatePlan) error {
|
||||
return p.approvalManager.Archive(getIdentifier(plan.Namespace, plan.Name, plan.NewVersion))
|
||||
return p.approvalManager.Archive(getIdentifier(plan))
|
||||
}
|
||||
|
||||
func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error) {
|
||||
|
@ -44,7 +45,7 @@ func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error
|
|||
return true, nil
|
||||
}
|
||||
|
||||
identifier := getIdentifier(plan.Namespace, plan.Name, plan.NewVersion)
|
||||
identifier := getIdentifier(plan)
|
||||
|
||||
// checking for existing approval
|
||||
existing, err := p.approvalManager.Get(identifier)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -443,7 +443,6 @@ func getValueAsString(vals chartutil.Values, path string) (string, error) {
|
|||
}
|
||||
|
||||
func values(chart *hapi_chart.Chart, config *hapi_chart.Config) (chartutil.Values, error) {
|
||||
// func CoalesceValues(chrt *chart.Chart, vals *chart.Config) (Values, error) {
|
||||
return chartutil.CoalesceValues(chart, config)
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ keel:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: chartVals},
|
||||
|
@ -164,7 +164,7 @@ func TestGetChartPolicyFromProm(t *testing.T) {
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: promChartValues},
|
||||
|
@ -232,7 +232,7 @@ keel:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: chartVals},
|
||||
|
@ -275,7 +275,7 @@ image2:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: chartVals},
|
||||
|
@ -326,7 +326,7 @@ keel:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: chartVals},
|
||||
|
@ -384,7 +384,7 @@ func TestGetPolicyFromConfig(t *testing.T) {
|
|||
|
||||
func TestGetImagesFromConfig(t *testing.T) {
|
||||
vals, err := testingConfigYaml(&KeelChartConfig{Policy: "all", Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "repopath",
|
||||
TagPath: "tagpath",
|
||||
},
|
||||
|
@ -434,7 +434,7 @@ keel:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: &chart.Config{Raw: ""},
|
||||
|
@ -443,8 +443,6 @@ keel:
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
approver, teardown := approver()
|
||||
defer teardown()
|
||||
provider := NewProvider(fakeImpl, &fakeSender{}, approver)
|
||||
|
@ -598,7 +596,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypeDefault,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -612,7 +610,7 @@ keel:
|
|||
Trigger: types.TriggerTypeDefault,
|
||||
NotificationChannels: []string{"chan1", "chan2"},
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -626,7 +624,7 @@ keel:
|
|||
Trigger: types.TriggerTypePoll,
|
||||
PollSchedule: "@every 30m",
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag", ImagePullSecret: "such-secret"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag", ImagePullSecret: "such-secret"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
@ -639,7 +637,7 @@ keel:
|
|||
MatchPreRelease: false,
|
||||
Trigger: types.TriggerTypeDefault,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, false),
|
||||
},
|
||||
|
@ -683,7 +681,7 @@ keel:
|
|||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: &rls.ListReleasesResponse{
|
||||
Releases: []*hapi_release5.Release{
|
||||
&hapi_release5.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: &chart.Chart{
|
||||
Values: &chart.Config{Raw: chartVals},
|
||||
|
|
|
@ -114,7 +114,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "image.repository",
|
||||
TagPath: "image.tag",
|
||||
},
|
||||
|
@ -147,7 +147,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "image.repository",
|
||||
TagPath: "image.tag",
|
||||
ReleaseNotes: "https://github.com/keel-hq/keel/releases",
|
||||
|
@ -332,7 +332,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -389,7 +389,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewForcePolicy(false),
|
||||
},
|
||||
|
@ -433,7 +433,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository"},
|
||||
{RepositoryPath: "image.repository"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// namespace/release name/version
|
||||
func getIdentifier(namespace, name, version string) string {
|
||||
return namespace + "/" + name + ":" + version
|
||||
// namespace/release name:version
|
||||
func getIdentifier(plan *UpdatePlan) string {
|
||||
return fmt.Sprintf("%s/%s:%s", plan.Namespace, plan.Name, plan.NewVersion)
|
||||
}
|
||||
|
||||
func (p *Provider) checkForApprovals(event *types.Event, plans []*UpdatePlan) (approvedPlans []*UpdatePlan) {
|
||||
|
@ -36,7 +36,7 @@ func (p *Provider) checkForApprovals(event *types.Event, plans []*UpdatePlan) (a
|
|||
|
||||
// updateComplete is called after we successfully update resource
|
||||
func (p *Provider) updateComplete(plan *UpdatePlan) error {
|
||||
return p.approvalManager.Archive(getIdentifier(plan.Namespace, plan.Name, plan.NewVersion))
|
||||
return p.approvalManager.Archive(getIdentifier(plan))
|
||||
}
|
||||
|
||||
func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error) {
|
||||
|
@ -44,7 +44,7 @@ func (p *Provider) isApproved(event *types.Event, plan *UpdatePlan) (bool, error
|
|||
return true, nil
|
||||
}
|
||||
|
||||
identifier := getIdentifier(plan.Namespace, plan.Name, plan.NewVersion)
|
||||
identifier := getIdentifier(plan)
|
||||
|
||||
// checking for existing approval
|
||||
existing, err := p.approvalManager.Get(identifier)
|
||||
|
|
|
@ -61,7 +61,6 @@ func getImages(vals chartutil.Values) ([]*types.TrackedImage, error) {
|
|||
}
|
||||
|
||||
func getPlanValues(newVersion *types.Version, ref *image.Reference, imageDetails *ImageDetails) (path, value string) {
|
||||
// vals := make(map[string]string)
|
||||
// if tag is not supplied, then user specified full image name
|
||||
if imageDetails.TagPath == "" {
|
||||
return imageDetails.RepositoryPath, getUpdatedImage(ref, newVersion.String())
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,17 +15,16 @@ import (
|
|||
|
||||
"github.com/keel-hq/keel/extension/notification"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"helm.sh/helm/v3/pkg/strvals"
|
||||
|
||||
_ "helm.sh/helm/v3/pkg/action"
|
||||
_ "helm.sh/helm/v3/pkg/release"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
hapi_chart "helm.sh/helm/v3/pkg/chart"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
)
|
||||
|
||||
var helm3VersionedUpdatesCounter = prometheus.NewCounterVec(
|
||||
|
|
|
@ -8,17 +8,16 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
"github.com/keel-hq/keel/approvals"
|
||||
"github.com/keel-hq/keel/extension/notification"
|
||||
"github.com/keel-hq/keel/internal/policy"
|
||||
"github.com/keel-hq/keel/pkg/store/sql"
|
||||
"github.com/keel-hq/keel/types"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
"helm.sh/helm/v3/pkg/release"
|
||||
|
||||
)
|
||||
|
||||
func newTestingUtils() (*sql.SQLStore, func()) {
|
||||
|
@ -74,7 +73,7 @@ func (i *fakeImplementer) ListReleases() ([]*release.Release, error) {
|
|||
}
|
||||
|
||||
func (i *fakeImplementer) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, vals map[string]string, namespace string, opts ...bool) (*release.Release, error) {
|
||||
// func (i *fakeImplementer) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...helm.UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
||||
// func (i *fakeImplementer) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...helm.UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
||||
i.updatedRlsName = rlsName
|
||||
i.updatedChart = chart
|
||||
// i.updatedOptions = opts
|
||||
|
@ -136,10 +135,10 @@ keel:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -186,10 +185,10 @@ func TestGetChartPolicyFromProm(t *testing.T) {
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -254,10 +253,10 @@ keel:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -297,10 +296,10 @@ image2:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -348,10 +347,10 @@ keel:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -383,7 +382,6 @@ func TestGetTriggerFromConfig(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func TestGetPolicyFromConfig(t *testing.T) {
|
||||
vals, err := testingConfigYaml(&KeelChartConfig{Policy: "all"})
|
||||
if err != nil {
|
||||
|
@ -403,7 +401,7 @@ func TestGetPolicyFromConfig(t *testing.T) {
|
|||
|
||||
func TestGetImagesFromConfig(t *testing.T) {
|
||||
vals, err := testingConfigYaml(&KeelChartConfig{Policy: "all", Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "repopath",
|
||||
TagPath: "tagpath",
|
||||
},
|
||||
|
@ -453,10 +451,10 @@ keel:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -614,7 +612,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypeDefault,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -628,7 +626,7 @@ keel:
|
|||
Trigger: types.TriggerTypeDefault,
|
||||
NotificationChannels: []string{"chan1", "chan2"},
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -642,7 +640,7 @@ keel:
|
|||
Trigger: types.TriggerTypePoll,
|
||||
PollSchedule: "@every 30m",
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag", ImagePullSecret: "such-secret"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag", ImagePullSecret: "such-secret"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
@ -655,7 +653,7 @@ keel:
|
|||
MatchPreRelease: false,
|
||||
Trigger: types.TriggerTypeDefault,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, false),
|
||||
},
|
||||
|
@ -703,10 +701,10 @@ keel:
|
|||
|
||||
fakeImpl := &fakeImplementer{
|
||||
listReleasesResponse: []*release.Release{
|
||||
&release.Release{
|
||||
{
|
||||
Name: "release-1",
|
||||
Chart: myChart,
|
||||
Config: make(map[string]interface {}),
|
||||
Config: make(map[string]interface{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import (
|
|||
)
|
||||
|
||||
// to do:
|
||||
// * update to latest chart package
|
||||
// * udpate the paramateres for the function
|
||||
// * update to latest chart package
|
||||
// * udpate the paramateres for the function
|
||||
|
||||
const DefaultUpdateTimeout = 300
|
||||
|
||||
|
@ -39,15 +39,6 @@ type Helm3Implementer struct {
|
|||
|
||||
// NewHelm3Implementer - get new helm implementer
|
||||
func NewHelm3Implementer() *Helm3Implementer {
|
||||
// settings := cli.New()
|
||||
|
||||
// actionConfig := &action.Configuration{}
|
||||
// // You can pass an empty string instead of settings.Namespace() to list
|
||||
// // all namespaces
|
||||
// if err := actionConfig.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), log.Printf); err != nil {
|
||||
// log.Printf("%+v", err)
|
||||
// os.Exit(1)
|
||||
// }
|
||||
return &Helm3Implementer{
|
||||
HelmDriver: os.Getenv("HELM_DRIVER"),
|
||||
KubeContext: os.Getenv("HELM_KUBECONTEXT"),
|
||||
|
@ -71,13 +62,12 @@ func (i *Helm3Implementer) ListReleases() ([]*release.Release, error) {
|
|||
}
|
||||
|
||||
// UpdateReleaseFromChart - update release from chart
|
||||
// func (i *Helm3Implementer) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, vals map[string]string) (*release.Release, error) {
|
||||
func (i *Helm3Implementer) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, vals map[string]string, namespace string, opts ...bool) (*release.Release, error) {
|
||||
actionConfig := i.generateConfig(namespace)
|
||||
client := action.NewUpgrade(actionConfig)
|
||||
client.Namespace = namespace
|
||||
client.Force = true
|
||||
client.Timeout = DefaultUpdateTimeout;
|
||||
client.Timeout = DefaultUpdateTimeout
|
||||
client.ReuseValues = true
|
||||
|
||||
// set reuse values to false if currentRelease.config is nil (temp fix for bug in chartutil.coalesce v3.1.2)
|
||||
|
@ -98,7 +88,7 @@ func (i *Helm3Implementer) UpdateReleaseFromChart(rlsName string, chart *chart.C
|
|||
return results, err
|
||||
}
|
||||
|
||||
func (i *Helm3Implementer) generateConfig(namespace string) (*action.Configuration) {
|
||||
func (i *Helm3Implementer) generateConfig(namespace string) *action.Configuration {
|
||||
// settings := cli.New()
|
||||
config := &genericclioptions.ConfigFlags{
|
||||
Namespace: &namespace,
|
||||
|
@ -122,7 +112,7 @@ func (i *Helm3Implementer) generateConfig(namespace string) (*action.Configurati
|
|||
// map[string]string{"image.tag": "0.1.0"}
|
||||
// to:
|
||||
// map[string]interface{"image": map[string]interface{"tag": "0.1.0"}}
|
||||
func convertToInterface(values map[string]string) (map[string]interface{}) {
|
||||
func convertToInterface(values map[string]string) map[string]interface{} {
|
||||
converted := make(map[string]interface{})
|
||||
for key, value := range values {
|
||||
keys := strings.SplitN(key, ".", 2)
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"github.com/keel-hq/keel/types"
|
||||
"github.com/keel-hq/keel/util/image"
|
||||
|
||||
// hapi_chart "k8s.io/helm/pkg/proto/hapi/chart"
|
||||
hapi_chart "helm.sh/helm/v3/pkg/chart"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
@ -97,15 +96,6 @@ func checkRelease(repo *types.Repository, namespace, name string, chart *hapi_ch
|
|||
continue
|
||||
}
|
||||
|
||||
// if keelCfg.MatchTag && imageRef.Tag() != eventRepoRef.Tag() {
|
||||
// log.WithFields(log.Fields{
|
||||
// "parsed_image_name": imageRef.Remote(),
|
||||
// "target_image_name": repo.Name,
|
||||
// "policy": keelCfg.Policy.String(),
|
||||
// }).Info("provider.helm3: match tag set but tags do not match, ignoring")
|
||||
// continue
|
||||
// }
|
||||
|
||||
if imageDetails.DigestPath != "" {
|
||||
plan.Values[imageDetails.DigestPath] = repo.Digest
|
||||
log.WithFields(log.Fields{
|
||||
|
|
|
@ -7,11 +7,10 @@ import (
|
|||
"github.com/keel-hq/keel/internal/policy"
|
||||
"github.com/keel-hq/keel/types"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
hapi_chart "helm.sh/helm/v3/pkg/chart"
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
)
|
||||
|
||||
|
||||
func Test_checkUnversionedRelease(t *testing.T) {
|
||||
chartValuesPolicyForce := `
|
||||
name: al Rashid
|
||||
|
@ -119,7 +118,7 @@ keel:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -133,7 +132,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "image.repository",
|
||||
TagPath: "image.tag",
|
||||
},
|
||||
|
@ -151,7 +150,7 @@ keel:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChartPolicyMajorReleaseNotes,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -166,7 +165,7 @@ keel:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{
|
||||
{
|
||||
RepositoryPath: "image.repository",
|
||||
TagPath: "image.tag",
|
||||
ReleaseNotes: "https://github.com/keel-hq/keel/releases",
|
||||
|
@ -185,7 +184,7 @@ keel:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChartPolicyMajor,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -341,7 +340,7 @@ image:
|
|||
namespace string
|
||||
name string
|
||||
chart *hapi_chart.Chart
|
||||
config map[string]interface {}
|
||||
config map[string]interface{}
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -358,7 +357,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -372,7 +371,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -387,7 +386,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{Namespace: "default", Name: "release-1", Chart: helloWorldChart, Values: map[string]string{}},
|
||||
wantShouldUpdateRelease: false,
|
||||
|
@ -401,7 +400,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{Namespace: "default", Name: "release-1", Chart: helloWorldChart, Values: map[string]string{}},
|
||||
wantShouldUpdateRelease: false,
|
||||
|
@ -415,7 +414,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldNonSemverChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -429,7 +428,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
{RepositoryPath: "image.repository", TagPath: "image.tag"},
|
||||
},
|
||||
Plc: policy.NewForcePolicy(false),
|
||||
},
|
||||
|
@ -445,7 +444,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1",
|
||||
chart: helloWorldNonSemverNoForceChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{Namespace: "default", Name: "release-1", Chart: helloWorldNonSemverNoForceChart, Values: map[string]string{}},
|
||||
wantShouldUpdateRelease: false,
|
||||
|
@ -459,7 +458,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1-no-tag",
|
||||
chart: helloWorldNoTagChart,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{
|
||||
Namespace: "default",
|
||||
|
@ -473,7 +472,7 @@ image:
|
|||
MatchPreRelease: true,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Images: []ImageDetails{
|
||||
ImageDetails{RepositoryPath: "image.repository"},
|
||||
{RepositoryPath: "image.repository"},
|
||||
},
|
||||
Plc: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
@ -489,7 +488,7 @@ image:
|
|||
namespace: "default",
|
||||
name: "release-1-no-tag",
|
||||
chart: helloWorldNoKeelCfg,
|
||||
config: make(map[string]interface {}),
|
||||
config: make(map[string]interface{}),
|
||||
},
|
||||
wantPlan: &UpdatePlan{Namespace: "default", Name: "release-1-no-tag", Chart: helloWorldNoKeelCfg, Values: map[string]string{}},
|
||||
wantShouldUpdateRelease: false,
|
||||
|
|
|
@ -16,7 +16,7 @@ func TestCheckRequestedApproval(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -37,7 +37,7 @@ func TestCheckRequestedApproval(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -88,7 +88,7 @@ func TestCheckRequestedApprovalAnnotation(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -113,7 +113,7 @@ func TestCheckRequestedApprovalAnnotation(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -171,7 +171,7 @@ func TestApprovedCheck(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -192,7 +192,7 @@ func TestApprovedCheck(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -252,7 +252,7 @@ func TestApprovalsCleanup(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -273,7 +273,7 @@ func TestApprovalsCleanup(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -141,7 +141,7 @@ func TestGetNamespaces(t *testing.T) {
|
|||
fi := &fakeImplementer{
|
||||
namespaces: &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -203,7 +203,7 @@ func TestGetImpacted(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -224,7 +224,7 @@ func TestGetImpacted(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -244,7 +244,7 @@ func TestGetImpacted(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -300,7 +300,7 @@ func TestGetImpactedPolicyAnnotations(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -322,7 +322,7 @@ func TestGetImpactedPolicyAnnotations(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -342,7 +342,7 @@ func TestGetImpactedPolicyAnnotations(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -403,7 +403,7 @@ func TestPrereleaseGetImpactedA(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -424,7 +424,7 @@ func TestPrereleaseGetImpactedA(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1-staging",
|
||||
},
|
||||
},
|
||||
|
@ -444,7 +444,7 @@ func TestPrereleaseGetImpactedA(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -495,7 +495,7 @@ func TestPrereleaseGetImpactedB(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -516,7 +516,7 @@ func TestPrereleaseGetImpactedB(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1-staging",
|
||||
},
|
||||
},
|
||||
|
@ -536,7 +536,7 @@ func TestPrereleaseGetImpactedB(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -582,7 +582,7 @@ func TestProcessEvent(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -608,7 +608,7 @@ func TestProcessEvent(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -634,7 +634,7 @@ func TestProcessEvent(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/bye-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -665,7 +665,7 @@ func TestProcessEvent(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/bye-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -710,7 +710,7 @@ func TestProcessEventBuildNumber(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -731,7 +731,7 @@ func TestProcessEventBuildNumber(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:10",
|
||||
},
|
||||
},
|
||||
|
@ -773,7 +773,7 @@ func TestEventSent(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -794,7 +794,7 @@ func TestEventSent(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:10.0.0",
|
||||
},
|
||||
},
|
||||
|
@ -841,7 +841,7 @@ func TestEventSentWithReleaseNotes(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -862,7 +862,7 @@ func TestEventSentWithReleaseNotes(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:10.0.0",
|
||||
},
|
||||
},
|
||||
|
@ -914,7 +914,7 @@ func TestGetImpactedTwoContainersInSameDeployment(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -935,10 +935,10 @@ func TestGetImpactedTwoContainersInSameDeployment(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/greetings-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -958,7 +958,7 @@ func TestGetImpactedTwoContainersInSameDeployment(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1015,7 +1015,7 @@ func TestGetImpactedTwoSameContainersInSameDeployment(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -1036,10 +1036,10 @@ func TestGetImpactedTwoSameContainersInSameDeployment(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1060,7 +1060,7 @@ func TestGetImpactedTwoSameContainersInSameDeployment(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1117,7 +1117,7 @@ func TestGetImpactedUntaggedImage(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -1138,7 +1138,7 @@ func TestGetImpactedUntaggedImage(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/foo-world",
|
||||
},
|
||||
},
|
||||
|
@ -1159,7 +1159,7 @@ func TestGetImpactedUntaggedImage(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1216,7 +1216,7 @@ func TestGetImpactedUntaggedOneImage(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -1237,7 +1237,7 @@ func TestGetImpactedUntaggedOneImage(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world",
|
||||
},
|
||||
},
|
||||
|
@ -1258,7 +1258,7 @@ func TestGetImpactedUntaggedOneImage(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1316,7 +1316,7 @@ func TestTrackedImages(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -1336,12 +1336,12 @@ func TestTrackedImages(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1",
|
||||
},
|
||||
},
|
||||
ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret",
|
||||
},
|
||||
},
|
||||
|
@ -1380,7 +1380,7 @@ func TestTrackedImagesWithSecrets(t *testing.T) {
|
|||
fp := &fakeImplementer{}
|
||||
fp.namespaces = &v1.NamespaceList{
|
||||
Items: []v1.Namespace{
|
||||
v1.Namespace{
|
||||
{
|
||||
meta_v1.TypeMeta{},
|
||||
meta_v1.ObjectMeta{Name: "xxxx"},
|
||||
v1.NamespaceSpec{},
|
||||
|
@ -1403,12 +1403,12 @@ func TestTrackedImagesWithSecrets(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1",
|
||||
},
|
||||
},
|
||||
ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -65,7 +65,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world",
|
||||
},
|
||||
},
|
||||
|
@ -93,7 +93,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:latest",
|
||||
},
|
||||
},
|
||||
|
@ -125,7 +125,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/goodbye-world:earliest",
|
||||
},
|
||||
},
|
||||
|
@ -163,7 +163,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:alpha",
|
||||
},
|
||||
},
|
||||
|
@ -201,7 +201,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:latest",
|
||||
},
|
||||
},
|
||||
|
@ -229,7 +229,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:0.2.0",
|
||||
},
|
||||
},
|
||||
|
@ -266,7 +266,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:master",
|
||||
},
|
||||
},
|
||||
|
@ -296,7 +296,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:master",
|
||||
},
|
||||
},
|
||||
|
@ -336,7 +336,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -366,7 +366,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -406,7 +406,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -437,7 +437,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -471,7 +471,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "karolisr/keel:latest-acceptance",
|
||||
},
|
||||
},
|
||||
|
@ -511,7 +511,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -542,7 +542,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:latest-staging",
|
||||
},
|
||||
},
|
||||
|
@ -581,7 +581,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:release-1",
|
||||
},
|
||||
},
|
||||
|
@ -612,7 +612,7 @@ func TestProvider_checkForUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "eu.gcr.io/karolisr/keel:release-2",
|
||||
},
|
||||
},
|
||||
|
@ -693,7 +693,7 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -721,7 +721,7 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
},
|
||||
|
@ -759,7 +759,7 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-prerelease:v1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -796,7 +796,7 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-prerelease:v1.1.1-staging",
|
||||
},
|
||||
},
|
||||
|
@ -828,7 +828,7 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
Template: v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -868,10 +868,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.1",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -899,10 +899,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -939,10 +939,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:latest",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -970,10 +970,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1013,10 +1013,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1047,10 +1047,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
@ -1090,10 +1090,10 @@ func TestProvider_checkForUpdateSemver(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Image: "gcr.io/v2-namespace/hello-world:1.1.2",
|
||||
},
|
||||
v1.Container{
|
||||
{
|
||||
Image: "yo-world:1.1.1",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -305,14 +305,11 @@ var tagsResp = `{
|
|||
]
|
||||
}`
|
||||
|
||||
func TestGetDockerHubManyTags(t *testing.T) {
|
||||
func TestGetDockerHubManyTags(t *testing.T) {
|
||||
client := registry.New("https://quay.io", "", "")
|
||||
tags, err := client.Tags("coreos/prometheus-operator")
|
||||
if err != nil {
|
||||
t.Errorf("error while getting repo: %s", err)
|
||||
}
|
||||
fmt.Println(tags)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestGetSecret(t *testing.T) {
|
|||
|
||||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(secretDataPayload),
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ func TestGetDockerConfigJSONSecret(t *testing.T) {
|
|||
|
||||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigJSONKey: []byte(secretDockerConfigJSONPayload),
|
||||
},
|
||||
|
@ -106,7 +106,7 @@ func TestGetDockerConfigJSONSecretUsernmePassword(t *testing.T) {
|
|||
|
||||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigJSONKey: []byte(secretDockerConfigJSONPayloadWithUsernamePassword),
|
||||
},
|
||||
|
@ -142,7 +142,7 @@ func TestGetFromDefaultCredentials(t *testing.T) {
|
|||
|
||||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigJSONKey: []byte(secretDockerConfigJSONPayloadWithUsernamePassword),
|
||||
},
|
||||
|
@ -215,9 +215,9 @@ func TestLookupHelmSecret(t *testing.T) {
|
|||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailablePods: &v1.PodList{
|
||||
Items: []v1.Pod{
|
||||
v1.Pod{
|
||||
{
|
||||
Spec: v1.PodSpec{ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret",
|
||||
},
|
||||
},
|
||||
|
@ -226,7 +226,7 @@ func TestLookupHelmSecret(t *testing.T) {
|
|||
},
|
||||
},
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(fmt.Sprintf(secretDataPayloadEncoded, mustEncode("user-y:pass-y"))),
|
||||
},
|
||||
|
@ -263,9 +263,9 @@ func TestLookupHelmEncodedSecret(t *testing.T) {
|
|||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailablePods: &v1.PodList{
|
||||
Items: []v1.Pod{
|
||||
v1.Pod{
|
||||
{
|
||||
Spec: v1.PodSpec{ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret",
|
||||
},
|
||||
},
|
||||
|
@ -274,7 +274,7 @@ func TestLookupHelmEncodedSecret(t *testing.T) {
|
|||
},
|
||||
},
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(secretDataPayload),
|
||||
},
|
||||
|
@ -311,10 +311,10 @@ func TestGetDirectHelmSecret(t *testing.T) {
|
|||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailablePods: &v1.PodList{
|
||||
Items: []v1.Pod{
|
||||
v1.Pod{
|
||||
{
|
||||
Spec: v1.PodSpec{
|
||||
ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret-dont-look",
|
||||
},
|
||||
},
|
||||
|
@ -323,13 +323,13 @@ func TestGetDirectHelmSecret(t *testing.T) {
|
|||
},
|
||||
},
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"myregistrysecret": &v1.Secret{
|
||||
"myregistrysecret": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(secretDataPayload2),
|
||||
},
|
||||
Type: v1.SecretTypeDockercfg,
|
||||
},
|
||||
"very-secret-dont-look": &v1.Secret{
|
||||
"very-secret-dont-look": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(secretDataPayload),
|
||||
},
|
||||
|
@ -367,9 +367,9 @@ func TestLookupHelmNoSecretsFound(t *testing.T) {
|
|||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailablePods: &v1.PodList{
|
||||
Items: []v1.Pod{
|
||||
v1.Pod{
|
||||
{
|
||||
Spec: v1.PodSpec{ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "very-secret",
|
||||
},
|
||||
},
|
||||
|
@ -411,9 +411,9 @@ func TestLookupWithPortedRegistry(t *testing.T) {
|
|||
impl := &testutil.FakeK8sImplementer{
|
||||
AvailablePods: &v1.PodList{
|
||||
Items: []v1.Pod{
|
||||
v1.Pod{
|
||||
{
|
||||
Spec: v1.PodSpec{ImagePullSecrets: []v1.LocalObjectReference{
|
||||
v1.LocalObjectReference{
|
||||
{
|
||||
Name: "example.com",
|
||||
},
|
||||
},
|
||||
|
@ -422,7 +422,7 @@ func TestLookupWithPortedRegistry(t *testing.T) {
|
|||
},
|
||||
},
|
||||
AvailableSecret: map[string]*v1.Secret{
|
||||
"example.com": &v1.Secret{
|
||||
"example.com": {
|
||||
Data: map[string][]byte{
|
||||
dockerConfigKey: []byte(secretDataPayloadWithPort),
|
||||
},
|
||||
|
|
|
@ -80,7 +80,7 @@ func TestPollingSemverUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "keelhq/push-workflow-example:0.1.0-dev",
|
||||
},
|
||||
|
@ -140,7 +140,7 @@ func TestPollingSemverUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "keelhq/push-workflow-example:0.1.0",
|
||||
},
|
||||
|
@ -197,7 +197,7 @@ func TestPollingSemverUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "keelhq/push-workflow-example:0.3.0-alpha",
|
||||
},
|
||||
|
@ -335,7 +335,7 @@ func TestPollingPrivateRegistry(t *testing.T) {
|
|||
},
|
||||
},
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: "wd-1",
|
||||
Image: "karolisr/demo-webhook:0.0.1",
|
||||
|
@ -447,7 +447,7 @@ func TestPollingPrivateRegistry(t *testing.T) {
|
|||
},
|
||||
},
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: "wd-1",
|
||||
Image: "registry.gitlab.com/karolisr/keel:0.1.0",
|
||||
|
|
|
@ -101,7 +101,7 @@ func TestWebhooksSemverUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "karolisr/webhook-demo:0.0.14",
|
||||
},
|
||||
|
@ -205,7 +205,7 @@ func TestWebhookHighIntegerUpdate(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "karolisr/webhook-demo:0.0.14",
|
||||
},
|
||||
|
@ -339,7 +339,7 @@ func TestApprovals(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "karolisr/webhook-demo:0.0.14",
|
||||
},
|
||||
|
@ -480,7 +480,7 @@ func TestApprovalsWithAuthentication(t *testing.T) {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
v1.Container{
|
||||
{
|
||||
Name: "wd-1",
|
||||
Image: "karolisr/webhook-demo:0.0.14",
|
||||
},
|
||||
|
|
|
@ -55,14 +55,14 @@ func TestCheckDeployment(t *testing.T) {
|
|||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
PollSchedule: types.KeelPollDefaultSchedule,
|
||||
},
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Image: imgB,
|
||||
Provider: "fp",
|
||||
|
@ -144,7 +144,7 @@ func TestCheckECRDeployment(t *testing.T) {
|
|||
imgA, _ := image.Parse("528670773427.dkr.ecr.us-east-2.amazonaws.com/webhook-demo:master")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
|
|
|
@ -23,7 +23,7 @@ func TestWatchMultipleTagsWithSemver(t *testing.T) {
|
|||
imgA, _ := image.Parse("gcr.io/v2-namespace/hello-world:1.1.1")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
|
@ -212,7 +212,7 @@ func TestWatchMultipleTagsWithCredentialsHelper(t *testing.T) {
|
|||
imgA, _ := image.Parse("gcr.io/v2-namespace/hello-world:1.1.1")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
|
|
|
@ -177,7 +177,7 @@ func TestWatchAllTagsJob(t *testing.T) {
|
|||
reference, _ := image.Parse("foo/bar:1.1.0")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: reference,
|
||||
Policy: policy.NewSemverPolicy(policy.SemverPolicyTypeAll, true),
|
||||
},
|
||||
|
@ -221,7 +221,7 @@ func TestWatchAllTagsJobCurrentLatest(t *testing.T) {
|
|||
reference, _ := image.Parse("foo/bar:latest")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: reference,
|
||||
Policy: policy.NewForcePolicy(true),
|
||||
},
|
||||
|
@ -264,7 +264,7 @@ func TestWatchMultipleTags(t *testing.T) {
|
|||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
|
@ -273,7 +273,7 @@ func TestWatchMultipleTags(t *testing.T) {
|
|||
Policy: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Image: imgB,
|
||||
Provider: "fp",
|
||||
|
@ -281,7 +281,7 @@ func TestWatchMultipleTags(t *testing.T) {
|
|||
Policy: policy.NewSemverPolicy(policy.SemverPolicyTypeMajor, true),
|
||||
},
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Image: imgC,
|
||||
Provider: "fp",
|
||||
|
@ -289,7 +289,7 @@ func TestWatchMultipleTags(t *testing.T) {
|
|||
Policy: policy.NewForcePolicy(true),
|
||||
},
|
||||
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Image: imgD,
|
||||
Provider: "fp",
|
||||
|
@ -422,7 +422,7 @@ func TestWatchTagJobLatestECR(t *testing.T) {
|
|||
imgA, _ := image.Parse("528670773427.dkr.ecr.us-east-2.amazonaws.com/webhook-demo:master")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: imgA,
|
||||
Trigger: types.TriggerTypePoll,
|
||||
Provider: "fp",
|
||||
|
|
|
@ -82,7 +82,7 @@ func TestCheckDeployment(t *testing.T) {
|
|||
img, _ := image.Parse("gcr.io/v2-namespace/hello-world:1.1")
|
||||
fp := &fakeProvider{
|
||||
images: []*types.TrackedImage{
|
||||
&types.TrackedImage{
|
||||
{
|
||||
Image: img,
|
||||
Provider: "fp",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue