Skip to content

Commit

Permalink
Merge branch 'master' into new_installation
Browse files Browse the repository at this point in the history
  • Loading branch information
nnarh authored Jan 22, 2024
2 parents d6c5d0b + ab9081e commit ac2d8c3
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/jira_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
pull_request_target:
types:
- closed

jobs:
jira_comment:
permissions:
pull-requests: read
if: github.event.pull_request.merged == true
uses: namely/sre/.github/workflows/reusable-workflow-jira-comment.yml@main
secrets:
jira_token: ${{ secrets.NAMELY_ENG_INTEGRATIONS_JIRA_PAT }}
4 changes: 2 additions & 2 deletions cmd/k8s-pipeliner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func main() {
}

if err := app.Run(os.Args); err != nil {
fmt.Println(err.Error())
os.Exit(1)
fmt.Printf("error: %v", err)
os.Exit(255)
}
}

Expand Down
7 changes: 7 additions & 0 deletions pipeline/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,13 @@ func buildStageMetadata(s config.Stage, t string, index int, linear bool) types.
Type: t,
Notifications: notifications,
SendNotifications: (len(notifications) > 0),
TrafficManagement: &types.TrafficManagement{
Enabled: false,
Options: &types.TrafficManagementOptions{
EnableTraffic: false,
Services: []string{},
},
},
}

if len(s.Condition) > 0 {
Expand Down
16 changes: 16 additions & 0 deletions pipeline/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,22 @@ func TestBuilderPipelineStages(t *testing.T) {

assert.Equal(t, []string{"2"}, spinnaker.Stages[0].(*types.RunSpinnakerPipelineStage).StageMetadata.RequisiteStageRefIds)
})

t.Run("TrafficManagement is assigned", func(t *testing.T) {
pipeline := &config.Pipeline{
Stages: []config.Stage{
{
Deploy: &config.DeployStage{},
},
},
}

builder := builder.New(pipeline)
spinnaker, err := builder.Pipeline()
require.NoError(t, err, "error generating pipeline json")

assert.Equal(t, &types.TrafficManagement{Enabled: false, Options: &types.TrafficManagementOptions{EnableTraffic: false, Services: []string{}}}, spinnaker.Stages[0].(*types.DeployStage).StageMetadata.TrafficManagement)
})
})
}

Expand Down
1 change: 1 addition & 0 deletions pipeline/builder/types/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type StageMetadata struct {
Notifications []Notification `json:"notifications,omitempty"`
SendNotifications bool `json:"sendNotifications,omitempty"`
StageEnabled *OptionalStageSupport `json:"stageEnabled,omitempty"`
TrafficManagement *TrafficManagement `json:"trafficManagement"`
}

// JenkinsTrigger constructs the JSON necessary to include a Jenkins trigger
Expand Down
12 changes: 12 additions & 0 deletions pipeline/builder/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,15 @@ type EvaluateVariablesStage struct {
func (evs EvaluateVariablesStage) spinnakerStage() {}

var _ Stage = EvaluateVariablesStage{}

// TrafficManagement is a struct for the Spinnaker traffic management configuration
type TrafficManagement struct {
Enabled bool `json:"enabled" default:"false"`
Options *TrafficManagementOptions `json:"options"`
}

// TrafficManagementOptions options for traffic management
type TrafficManagementOptions struct {
EnableTraffic bool `json:"enableTraffic" default:"false"`
Services []string `json:"services" default:"[]"`
}

0 comments on commit ac2d8c3

Please sign in to comment.