-
Notifications
You must be signed in to change notification settings - Fork 1
glmap: Branches
In GitLab, we have the same possibilities with branches as in GitHub. For more information on what you can do with branches in GitLab, see the GitLab documentation.
Branch events works like in GitHub but the generated events have a particularity. A CreateBranch event is generated for each branch created while the number of branches created in a single push is less than 4. Starting from 4 branches, only one CreateBranches event is generated instead with the number of branches created stored in push_data.ref_count. (This is the same when deleting branches)
The following table shows the mapping of the events generated by GitLab for branches. A fully detailed mapping can be found below.
| Action | target_type | action | detection |
|---|---|---|---|
CreateBranch |
null |
pushed new |
push_data.action = created & push_data.ref_type = branch
|
DeleteBranch |
null |
deleted |
push_data.ref_type = branch |
| Activity | Actions | time window |
|---|---|---|
ManageBranches |
- CreateBranch - Opt - Rep- DeleteBranch - Opt - Rep
|
3s |
Detectionare the values used to detect what action has been performed.Detailsare information found in the payload of the event that can be used to group actions to activities. (name_in_action=name_in_payload)
Triggered when a branch is created. Can be triggered multiple times in a single push if the number of branches created is less than 4.
Detection:
-
action_name=pushed new -
target_type=null -
push_data.action=created -
push_data.ref_type=branch
Details:
-
branch.name=push_data.ref -
branch.count=push_data.ref_count -
commit.title=push_data.commit_title -
commit.id=push_data.commit_to -
commit.count=push_data.commit_count
Triggered when a branch is deleted. As for the CreateBranch event, this event can be triggered multiple times in a single push if the number of branches deleted is less than 4.
Detection:
-
action_name=deleted -
target_type=null -
push_data.ref_type=branch
Details:
-
branch.name=push_data.ref -
branch.count=push_data.ref_count -
commit.title=push_data.commit_title -
commit.id=push_data.commit_to -
commit.count=push_data.commit_count
Each activity is composed of one or more actions. Each action can be repeatable and can be optional. A maximum time window is also defined for each activity and it is used to group actions that are close to each other in time.
For each action, we can define a verification function (validate_with) to make sure that the action is part of the activity. (e.g comments are made on the same issue)
time_window = 3s
Since the CreateBranch and DeleteBranch events aren't grouped in a single event when the number of branches created or deleted is less than 4, we have to group each event in an activity with a relatively short time window.
Actions:
-
CreateBranch- Optional - Repeatable -
DeleteBranch- Optional - Repeatable