From 586ab8848082e0649301e825de16c396990cbc99 Mon Sep 17 00:00:00 2001 From: Aleksei Korotin Date: Wed, 6 Dec 2023 19:33:15 +0300 Subject: [PATCH] Added missing fields for flexibleRollout feature flag strategy --- project_feature_flags.go | 6 ++++++ project_feature_flags_test.go | 15 +++++++++++++++ testdata/get_project_feature_flag.json | 15 +++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/project_feature_flags.go b/project_feature_flags.go index 9f7561155..98c358868 100644 --- a/project_feature_flags.go +++ b/project_feature_flags.go @@ -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 { diff --git a/project_feature_flags_test.go b/project_feature_flags_test.go index 7db8e92aa..b660f0054 100644 --- a/project_feature_flags_test.go +++ b/project_feature_flags_test.go @@ -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: "*", + }, + }, + }, }, } diff --git a/testdata/get_project_feature_flag.json b/testdata/get_project_feature_flag.json index e46062762..9b7129b2a 100644 --- a/testdata/get_project_feature_flag.json +++ b/testdata/get_project_feature_flag.json @@ -17,6 +17,21 @@ "environment_scope": "production" } ] + }, + { + "id": 24, + "name": "flexibleRollout", + "parameters": { + "groupId": "default", + "rollout": "50", + "stickiness": "default" + }, + "scopes": [ + { + "id": 52, + "environment_scope": "*" + } + ] } ] }