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
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ linters-settings:
# https://staticcheck.io/docs/options#checks
checks: [ "all","-SA1019","-SA1029" ]
gosec:
excludes: ["G204", "G301", "G302", "G304", "G306", "G601", "G101", "G407"]
excludes: ["G204", "G301", "G302", "G304", "G306", "G601", "G101"]
exclude-generated: true
exclude-test-files: true
config:
global:
nosec: true
Expand Down
2 changes: 1 addition & 1 deletion commands/common/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var manifestSample = &model.Manifest{
"hidden1": "hidden1.value",
"hidden2": "hidden2.value",
},
FilterCriteria: model.FilterCriteria{
FilterCriteria: &model.FilterCriteria{
ArtifactFilterCriteria: &model.ArtifactFilterCriteria{
RepoKeys: []string{
"my-repo-local",
Expand Down
4 changes: 2 additions & 2 deletions commands/deploy_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func GetDeployCommand() components.Command {
return err
}

if err = common.ValidateFilterCriteria(&manifest.FilterCriteria, actionMeta); err != nil {
if err = common.ValidateFilterCriteria(manifest.FilterCriteria, actionMeta); err != nil {
return err
}

Expand Down Expand Up @@ -149,7 +149,7 @@ func prepareDeployRequest(ctx *components.Context, manifest *model.Manifest, act
}

if actionMeta.MandatoryFilter {
payload.FilterCriteria = &manifest.FilterCriteria
payload.FilterCriteria = manifest.FilterCriteria
}

return payload, nil
Expand Down
8 changes: 5 additions & 3 deletions commands/deploy_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ func TestDeployCommand(t *testing.T) {
workerName: "wk-3",
serverBehavior: common.NewServerStub(t).WithGetOneEndpoint(),
patchManifest: func(mf *model.Manifest) {
mf.FilterCriteria.Schedule = &model.ScheduleFilterCriteria{
Cron: "1h",
Timezone: "Asia/New_York",
mf.FilterCriteria = &model.FilterCriteria{
Schedule: &model.ScheduleFilterCriteria{
Cron: "1h",
Timezone: "Asia/New_York",
},
}
},
wantErr: errors.New("manifest validation failed: invalid cron expression"),
Expand Down
4 changes: 3 additions & 1 deletion commands/edit_schedule_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ func (c *editScheduleCommand) run() error {
return fmt.Errorf("invalid schedule provided: %w", err)
}

manifest.FilterCriteria.Schedule = newCriteria
manifest.FilterCriteria = &model.FilterCriteria{
Schedule: newCriteria,
}

if err = common.SaveManifest(manifest); err != nil {
return fmt.Errorf("failed to save manifest: %w", err)
Expand Down
20 changes: 10 additions & 10 deletions model/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ type FilterCriteria struct {
type Secrets map[string]string

type Manifest struct {
Name string `json:"name"`
Description string `json:"description"`
SourceCodePath string `json:"sourceCodePath"`
Action string `json:"action"`
Enabled bool `json:"enabled"`
Debug bool `json:"debug"`
ProjectKey string `json:"projectKey"`
Secrets Secrets `json:"secrets"`
FilterCriteria FilterCriteria `json:"filterCriteria,omitempty"`
Application string `json:"application,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
SourceCodePath string `json:"sourceCodePath"`
Action string `json:"action"`
Enabled bool `json:"enabled"`
Debug bool `json:"debug"`
ProjectKey string `json:"projectKey"`
Secrets Secrets `json:"secrets"`
FilterCriteria *FilterCriteria `json:"filterCriteria,omitempty"`
Application string `json:"application,omitempty"`
}
18 changes: 9 additions & 9 deletions model/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ type Secret struct {
MarkedForRemoval bool `json:"markedForRemoval"`
}
type WorkerDetails struct {
Key string `json:"key"`
Description string `json:"description"`
Debug bool `json:"debug"`
Enabled bool `json:"enabled"`
SourceCode string `json:"sourceCode"`
Action string `json:"action"`
FilterCriteria FilterCriteria `json:"filterCriteria,omitempty"`
Secrets []*Secret `json:"secrets"`
ProjectKey string `json:"projectKey"`
Key string `json:"key"`
Description string `json:"description"`
Debug bool `json:"debug"`
Enabled bool `json:"enabled"`
SourceCode string `json:"sourceCode"`
Action string `json:"action"`
FilterCriteria *FilterCriteria `json:"filterCriteria,omitempty"`
Secrets []*Secret `json:"secrets"`
ProjectKey string `json:"projectKey"`
}
2 changes: 1 addition & 1 deletion test/commands/list_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestListCommand(t *testing.T) {
Enabled: true,
SourceCode: `export default async function() { return { "status": "OK" } }`,
Action: "BEFORE_DOWNLOAD",
FilterCriteria: model.FilterCriteria{
FilterCriteria: &model.FilterCriteria{
ArtifactFilterCriteria: &model.ArtifactFilterCriteria{
RepoKeys: []string{"example-repo-local"},
},
Expand Down
Loading