@@ -28,6 +28,7 @@ type MarkAsDeleteOptions struct {
28
28
const (
29
29
RunStatus = "run_status"
30
30
RunDaysBefore = "run_days_before"
31
+ RunHasGitBranch = "has_git_branch"
31
32
RunGitBranchExist = "git_branch_exist"
32
33
RunChangeExist = "gerrit_change_exist"
33
34
RunChangeMerged = "gerrit_change_merged"
@@ -36,7 +37,7 @@ const (
36
37
)
37
38
38
39
func GetRetentionPolicyVariables () []string {
39
- return []string {RunDaysBefore , RunStatus , RunGitBranchExist , RunChangeMerged , RunChangeAbandoned , RunChangeDayBefore , RunChangeExist }
40
+ return []string {RunDaysBefore , RunStatus , RunHasGitBranch , RunGitBranchExist , RunChangeMerged , RunChangeAbandoned , RunChangeDayBefore , RunChangeExist }
40
41
}
41
42
42
43
func markWorkflowRunsToDelete (ctx context.Context , store cache.Store , db * gorp.DbMap , workflowRunsMarkToDelete * stats.Int64Measure ) error {
@@ -218,10 +219,14 @@ func purgeComputeVariables(ctx context.Context, luaCheck *luascript.Check, run s
218
219
}
219
220
220
221
// If we have a branch in payload, check if it exists on repository branches list
221
- if b , has := vars ["git.branch" ]; has {
222
- _ , exist := branchesMap [b ]
223
- vars [RunGitBranchExist ] = strconv .FormatBool (exist )
222
+ b , has := vars ["git.branch" ]
223
+ var exist bool
224
+ if has {
225
+ _ , exist = branchesMap [b ]
224
226
}
227
+ vars [RunHasGitBranch ] = strconv .FormatBool (has )
228
+ vars [RunGitBranchExist ] = strconv .FormatBool (exist )
229
+
225
230
vars [RunStatus ] = run .Status
226
231
227
232
varsFloats [RunDaysBefore ] = math .Floor (time .Now ().Sub (run .LastModified ).Hours () / 24 )
0 commit comments