Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1844 from korotin/feature-flags-flexible-rollout
Browse files Browse the repository at this point in the history
Added missing fields for flexibleRollout feature flag strategy
  • Loading branch information
svanharmelen authored Dec 9, 2023
2 parents a8a6176 + 586ab88 commit 6e2f48e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions project_feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ type ProjectFeatureFlagStrategyParameter struct {
GroupID string `json:"groupId,omitempty"`
UserIDs string `json:"userIds,omitempty"`
Percentage string `json:"percentage,omitempty"`

// Following fields aren't documented in Gitlab API docs,
// but are present in Gitlab API since 13.5.
// Docs: https://docs.getunleash.io/reference/activation-strategies#gradual-rollout
Rollout string `json:"rollout,omitempty"`
Stickiness string `json:"stickiness,omitempty"`
}

func (i ProjectFeatureFlag) String() string {
Expand Down
15 changes: 15 additions & 0 deletions project_feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ func TestGetProjectFeatureFlag(t *testing.T) {
},
},
},
{
ID: 24,
Name: "flexibleRollout",
Parameters: &ProjectFeatureFlagStrategyParameter{
GroupID: "default",
Rollout: "50",
Stickiness: "default",
},
Scopes: []*ProjectFeatureFlagScope{
{
ID: 52,
EnvironmentScope: "*",
},
},
},
},
}

Expand Down
15 changes: 15 additions & 0 deletions testdata/get_project_feature_flag.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
"environment_scope": "production"
}
]
},
{
"id": 24,
"name": "flexibleRollout",
"parameters": {
"groupId": "default",
"rollout": "50",
"stickiness": "default"
},
"scopes": [
{
"id": 52,
"environment_scope": "*"
}
]
}
]
}

0 comments on commit 6e2f48e

Please sign in to comment.