Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion api/v1alpha1/freight_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type GitCommit struct {
Author string `json:"author,omitempty" protobuf:"bytes,7,opt,name=author"`
// Committer is the person who committed the commit.
Committer string `json:"committer,omitempty" protobuf:"bytes,8,opt,name=committer"`
// SubscriptionName is the name of the subscription that discovered this
// commit. This field is only populated if the subscription was assigned
// a name.
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,9,opt,name=subscriptionName"`
}

// DeepEquals returns a bool indicating whether the receiver deep-equals the
Expand All @@ -87,7 +91,8 @@ func (g *GitCommit) DeepEquals(other *GitCommit) bool {
g.Tag == other.Tag &&
g.Message == other.Message &&
g.Author == other.Author &&
g.Committer == other.Committer
g.Committer == other.Committer &&
g.SubscriptionName == other.SubscriptionName
}

// Equals returns a bool indicating whether two GitCommits are equivalent.
Expand Down
28 changes: 28 additions & 0 deletions api/v1alpha1/freight_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,34 @@ func TestGitCommitDeepEquals(t *testing.T) {
},
expectedResult: true,
},
{
name: "subscription names differ",
a: &GitCommit{
RepoURL: "fake-url",
ID: "fake-commit-id",
SubscriptionName: "sub-a",
},
b: &GitCommit{
RepoURL: "fake-url",
ID: "fake-commit-id",
SubscriptionName: "sub-b",
},
expectedResult: false,
},
{
name: "perfect match with subscription name",
a: &GitCommit{
RepoURL: "fake-url",
ID: "fake-commit-id",
SubscriptionName: "my-sub",
},
b: &GitCommit{
RepoURL: "fake-url",
ID: "fake-commit-id",
SubscriptionName: "my-sub",
},
expectedResult: true,
},
}

for _, testCase := range testCases {
Expand Down
1,011 changes: 647 additions & 364 deletions api/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions api/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions api/v1alpha1/stage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@ type Image struct {
Digest string `json:"digest,omitempty" protobuf:"bytes,4,opt,name=digest"`
// Annotations is a map of arbitrary metadata for the image.
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,5,rep,name=annotations" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// SubscriptionName is the name of the subscription that discovered this
// image. This field is only populated if the subscription was assigned
// a name.
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,6,opt,name=subscriptionName"`
}

// DeepEquals returns a bool indicating whether the receiver deep-equals the
Expand All @@ -629,7 +633,8 @@ func (i *Image) DeepEquals(other *Image) bool {
return i.RepoURL == other.RepoURL &&
i.Tag == other.Tag &&
i.Digest == other.Digest &&
maps.Equal(i.Annotations, other.Annotations)
maps.Equal(i.Annotations, other.Annotations) &&
i.SubscriptionName == other.SubscriptionName
}

// Chart describes a specific version of a Helm chart.
Expand All @@ -645,6 +650,10 @@ type Chart struct {
Name string `json:"name,omitempty" protobuf:"bytes,2,opt,name=name"`
// Version specifies a particular version of the chart.
Version string `json:"version,omitempty" protobuf:"bytes,3,opt,name=version"`
// SubscriptionName is the name of the subscription that discovered this
// chart. This field is only populated if the subscription was assigned
// a name.
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,4,opt,name=subscriptionName"`
}

// DeepEquals returns a bool indicating whether the receiver deep-equals the
Expand All @@ -658,7 +667,8 @@ func (c *Chart) DeepEquals(other *Chart) bool {
}
return c.RepoURL == other.RepoURL &&
c.Name == other.Name &&
c.Version == other.Version
c.Version == other.Version &&
c.SubscriptionName == other.SubscriptionName
}

// Health describes the health of a Stage.
Expand Down
60 changes: 60 additions & 0 deletions api/v1alpha1/stage_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,34 @@ func TestImageDeepEquals(t *testing.T) {
},
expectedResult: true,
},
{
name: "subscription names differ",
a: &Image{
RepoURL: "fake-url",
Tag: "fake-tag",
SubscriptionName: "sub-a",
},
b: &Image{
RepoURL: "fake-url",
Tag: "fake-tag",
SubscriptionName: "sub-b",
},
expectedResult: false,
},
{
name: "perfect match with subscription name",
a: &Image{
RepoURL: "fake-url",
Tag: "fake-tag",
SubscriptionName: "img-sub",
},
b: &Image{
RepoURL: "fake-url",
Tag: "fake-tag",
SubscriptionName: "img-sub",
},
expectedResult: true,
},
}

for _, testCase := range testCases {
Expand Down Expand Up @@ -964,6 +992,38 @@ func TestChartDeepEquals(t *testing.T) {
},
expectedResult: true,
},
{
name: "subscription names differ",
a: &Chart{
RepoURL: "fake-url",
Name: "fake-name",
Version: "v1.0.0",
SubscriptionName: "sub-a",
},
b: &Chart{
RepoURL: "fake-url",
Name: "fake-name",
Version: "v1.0.0",
SubscriptionName: "sub-b",
},
expectedResult: false,
},
{
name: "perfect match with subscription name",
a: &Chart{
RepoURL: "fake-url",
Name: "fake-name",
Version: "v1.0.0",
SubscriptionName: "chart-sub",
},
b: &Chart{
RepoURL: "fake-url",
Name: "fake-name",
Version: "v1.0.0",
SubscriptionName: "chart-sub",
},
expectedResult: true,
},
}

for _, testCase := range testCases {
Expand Down
28 changes: 28 additions & 0 deletions api/v1alpha1/warehouse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,19 @@ type FreightCreationCriteria struct {
// RepoSubscription describes a subscription to ONE OF a Git repository, a
// container image repository, a Helm chart repository, or something else.
type RepoSubscription struct {
// Name is an optional, human-readable identifier for this subscription.
// Subscription names are primarily intended as a stepping stone toward
// allowing a single Warehouse to subscribe to the same repository more than
// once, which in turn would allow a single Freight resource to reference
// multiple distinct revisions of an artifact from one repository. As an
// incidental benefit, a name may also be surfaced in the Kargo UI and other
// tooling as a more human-readable label where a repository URL would
// otherwise appear.
//
// +kubebuilder:validation:Optional
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$`
Name string `json:"name,omitempty" protobuf:"bytes,5,opt,name=name"`
// Git describes a subscriptions to a Git repository.
Git *GitSubscription `json:"git,omitempty" protobuf:"bytes,1,opt,name=git"`
// Image describes a subscription to container image repository.
Expand Down Expand Up @@ -408,6 +421,11 @@ type GitDiscoveryResult struct {
//
// +optional
Commits []DiscoveredCommit `json:"commits" protobuf:"bytes,2,rep,name=commits"`
// SubscriptionName is the optional human-readable name of the subscription
// that produced this discovery result.
//
// +optional
Comment thread
krancour marked this conversation as resolved.
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,3,opt,name=subscriptionName"`
}

// DiscoveredCommit represents a commit discovered by a Warehouse for a
Expand Down Expand Up @@ -455,6 +473,11 @@ type ImageDiscoveryResult struct {
//
// +optional
References []DiscoveredImageReference `json:"references" protobuf:"bytes,3,rep,name=references"`
// SubscriptionName is the optional human-readable name of the subscription
// that produced this discovery result.
//
// +optional
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,4,opt,name=subscriptionName"`
}

// DiscoveredImageReference represents an image reference discovered by a
Expand Down Expand Up @@ -502,6 +525,11 @@ type ChartDiscoveryResult struct {
//
// +optional
Versions []string `json:"versions" protobuf:"bytes,4,rep,name=versions"`
// SubscriptionName is the optional human-readable name of the subscription
// that produced this discovery result.
//
// +optional
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,5,opt,name=subscriptionName"`
}

// DiscoveryResult represents the result of an artifact discovery operation for
Expand Down
18 changes: 18 additions & 0 deletions charts/kargo/resources/crds/kargo.akuity.io_freights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ spec:
registry, the URL implicitly points to a specific chart and the Name field
will be empty.
type: string
subscriptionName:
description: |-
SubscriptionName is the name of the subscription that discovered this
chart. This field is only populated if the subscription was assigned
a name.
type: string
version:
description: Version specifies a particular version of the chart.
type: string
Expand Down Expand Up @@ -140,6 +146,12 @@ spec:
repoURL:
description: RepoURL is the URL of a Git repository.
type: string
subscriptionName:
description: |-
SubscriptionName is the name of the subscription that discovered this
commit. This field is only populated if the subscription was assigned
a name.
type: string
tag:
description: |-
Tag denotes a tag in the repository that matched selection criteria and
Expand Down Expand Up @@ -168,6 +180,12 @@ spec:
description: RepoURL describes the repository in which the image
can be found.
type: string
subscriptionName:
description: |-
SubscriptionName is the name of the subscription that discovered this
image. This field is only populated if the subscription was assigned
a name.
type: string
tag:
description: |-
Tag identifies a specific version of the image in the repository specified
Expand Down
Loading
Loading