Add work_item_epics feature flag
What does this MR do and why?
In order to prepare for work item epics GA we need to combine all its functionality under a single feature flag. As a first step, this MR introduces the new flag work_item_epics and updates the checks for displaying namespace-level work items to be available when the new flag is enabled.
This will allow us to access work item epics even if namespace_level_work_items feature flag is disabled.
Also, in this MR we introduce the feature flag create_namespace_level_work_items so we can guard the creation of work items at group level (any type except Epic) separately from namespace_level_work_items and work_item_epics. The creation of WI with type Epic is guarded by the feature flag work_item_epics and a license check for the epics feature.
To summarise:
- The method
Group#work_item_epics_enabled?guards displaying work items at the group level, this is enabled when either thenamespace_level_work_itemsORwork_item_epicsflag is enabled. - The ff
create_group_level_work_itemsguards creating group-level work items that are notEpictype - The
work_item_epicsalso guards creating group-level work items that are typeEpic(creation also requires the licensed feature epics to be available)
Follow-ups:
- Update
WorkItems::WorkItemsFinderto exclude types that are not enabled: excludeEpicwhen work_item_epics is disabled and exclude every other type ifcreate_group_level_work_itemsis disabled. These types should be excluded from the filtering options too. - Replace other epic work items-related feature flags with the flag
work_item_epics
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Example below:
- In rails console enable the new flag
work_item_epicsand disablenamespace_level_work_itemsandcreate_group_level_work_itemsFeature.enable(:work_item_epics) Feature.disable(:namespace_level_work_items) Feature.disable(:create_group_level_work_items) - Visit any group's epic and verify that clicking the
New epicbutton opens a pop-up dialogue that creates a work item epic. - Verify that the new epic can be viewed with the work item path, e.g
http://127.0.0.1:3000/groups/GROUP-PATH/-/work_items/EPIC_IID - Visit
http://127.0.0.1:3000/-/graphql-explorerand verify that work items can be created only with the typeEpic
Click to expand
# Get work item type IDs for EPIC and ISSUE
query getGroupTypes {
group(fullPath: "flightjs") {
id
name
webUrl
workItemTypes(name: EPIC) {
edges {
node {
id
name
}
}
}
}
}
mutation createEpic {
workItemCreate(input: {
namespacePath: "group-a", title: "Epic WI",
workItemTypeId: "gid://gitlab/WorkItems::Type/8"
}) {
errors
workItem {
id
webUrl
workItemType {
name
}
}
}
} # Should succeed
mutation createIssue {
workItemCreate(input: {
namespacePath: "group-a", title: "Issue WI",
workItemTypeId: "gid://gitlab/WorkItems::Type/1"
}) {
errors
workItem {
id
webUrl
workItemType {
name
}
}
}
} # Should return error "create_group_level_work_items feature flag is disabled. Only project paths allowed."
- Change the feature flags to test the opposite scenario where all types are allowed except
Epic.Feature.disable(:work_item_epics) Feature.enable(:create_group_level_work_items) - Use the same queries as step 4 and verify that issue creation succeeds while the epic type returns the
"Epic type is not available for the given group"error message.Feature.disable(:work_item_epics) Feature.enable(:create_group_level_work_items)
Related to #467686 (closed)