Skip to content
Merged
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
36 changes: 19 additions & 17 deletions pkg/channels/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ import (
)

type Channel struct {
Description string `json:"Description,omitempty"`
IsDefault bool `json:"IsDefault"`
LifecycleID string `json:"LifecycleId,omitempty"`
Name string `json:"Name" validate:"required,notblank,notall"`
ProjectID string `json:"ProjectId" validate:"required,notblank"`
Rules []ChannelRule `json:"Rules,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
TenantTags []string `json:"TenantTags,omitempty"`
GitReferenceRules []string `json:"GitReferenceRules,omitempty"`
GitResourceRules []ChannelGitResourceRule `json:"GitResourceRules,omitempty"`
Description string `json:"Description,omitempty"`
IsDefault bool `json:"IsDefault"`
LifecycleID string `json:"LifecycleId,omitempty"`
Name string `json:"Name" validate:"required,notblank,notall"`
ProjectID string `json:"ProjectId" validate:"required,notblank"`
Rules []ChannelRule `json:"Rules,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
TenantTags []string `json:"TenantTags,omitempty"`
GitReferenceRules []string `json:"GitReferenceRules,omitempty"`
GitResourceRules []ChannelGitResourceRule `json:"GitResourceRules,omitempty"`
CustomFieldDefinitions []ChannelCustomFieldDefinition `json:"CustomFieldDefinitions,omitempty"`

resources.Resource
}

func NewChannel(name string, projectID string) *Channel {
return &Channel{
Name: strings.TrimSpace(name),
ProjectID: projectID,
Rules: []ChannelRule{},
TenantTags: []string{},
GitReferenceRules: []string{},
GitResourceRules: []ChannelGitResourceRule{},
Resource: *resources.NewResource(),
Name: strings.TrimSpace(name),
ProjectID: projectID,
Rules: []ChannelRule{},
TenantTags: []string{},
GitReferenceRules: []string{},
GitResourceRules: []ChannelGitResourceRule{},
CustomFieldDefinitions: []ChannelCustomFieldDefinition{},
Resource: *resources.NewResource(),
}
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/channels/channel_custom_field_definition.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package channels

type ChannelCustomFieldDefinition struct {
FieldName string `json:"FieldName,omitempty"`
Description string `json:"Description,omitempty"`
}
28 changes: 15 additions & 13 deletions pkg/releases/create_release_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package releases

import (
"encoding/json"

"github.com/OctopusDeploy/go-octopusdeploy/v2/internal"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/newclient"
"github.com/OctopusDeploy/go-octopusdeploy/v2/uritemplates"
Expand All @@ -12,19 +13,20 @@ type CreateReleaseCommandV1 struct {
// payload.
// It'd be nice to allow SpaceIDOrName, but the current server implementation requires a SpaceID
// (not a name) in the URL route, so we must force the caller to specify an ID only.
SpaceID string `json:"spaceId"`
ProjectIDOrName string `json:"projectName"`
PackageVersion string `json:"packageVersion,omitempty"`
GitCommit string `json:"gitCommit,omitempty"`
GitRef string `json:"gitRef,omitempty"`
ReleaseVersion string `json:"releaseVersion,omitempty"`
ChannelIDOrName string `json:"channelName,omitempty"`
Packages []string `json:"packages,omitempty"`
GitResources []string `json:"gitResources,omitempty"`
ReleaseNotes string `json:"releaseNotes,omitempty"`
IgnoreIfAlreadyExists bool `json:"ignoreIfAlreadyExists"`
IgnoreChannelRules bool `json:"ignoreChannelRules"`
PackagePrerelease string `json:"packagePrerelease,omitempty"`
SpaceID string `json:"spaceId"`
ProjectIDOrName string `json:"projectName"`
PackageVersion string `json:"packageVersion,omitempty"`
GitCommit string `json:"gitCommit,omitempty"`
GitRef string `json:"gitRef,omitempty"`
ReleaseVersion string `json:"releaseVersion,omitempty"`
ChannelIDOrName string `json:"channelName,omitempty"`
Packages []string `json:"packages,omitempty"`
GitResources []string `json:"gitResources,omitempty"`
ReleaseNotes string `json:"releaseNotes,omitempty"`
IgnoreIfAlreadyExists bool `json:"ignoreIfAlreadyExists"`
IgnoreChannelRules bool `json:"ignoreChannelRules"`
PackagePrerelease string `json:"packagePrerelease,omitempty"`
CustomFields map[string]string `json:"customFields,omitempty"`
}

type CreateReleaseResponseV1 struct {
Expand Down
4 changes: 3 additions & 1 deletion pkg/releases/release.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package releases

import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/gitdependencies"
"time"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/gitdependencies"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/packages"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources"
)
Expand All @@ -22,6 +23,7 @@ type Release struct {
SelectedGitResources []*gitdependencies.SelectedGitResources `json:"SelectedGitResources,omitempty"`
SpaceID string `json:"SpaceId,omitempty"`
Version string `json:"Version"`
CustomFields map[string]string `json:"CustomFields,omitempty"`

resources.Resource
}
Expand Down
1 change: 1 addition & 0 deletions test/e2e/channel_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func AssertEqualChannels(t *testing.T, expected *channels.Channel, actual *chann
assert.True(t, reflect.DeepEqual(expected.TenantTags, actual.TenantTags))
assert.True(t, reflect.DeepEqual(expected.GitReferenceRules, actual.GitReferenceRules))
assert.True(t, reflect.DeepEqual(expected.GitResourceRules, actual.GitResourceRules))
assert.True(t, reflect.DeepEqual(expected.CustomFieldDefinitions, actual.CustomFieldDefinitions))
}

func CreateTestChannel(t *testing.T, client *client.Client, project *projects.Project) *channels.Channel {
Expand Down
Loading