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

Commit

Permalink
Added missing fields for flexibleRollout feature flag strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
korotin committed Dec 6, 2023
1 parent 3e35f87 commit 586ab88
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 586ab88

Please sign in to comment.