Skip to content

Commit

Permalink
ci: improve functional review requirement integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaian committed May 15, 2024
1 parent 28f207e commit 9fd32d6
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,17 @@ pipeline {
return
}

if (!env.CHANGE_ID) {
echo "Not a Pull request."
return
}

def issue = jiraGetIssue site: 'irontec.atlassian.net', idOrKey: env.JIRA_TICKET

// Functional Reviewer - 10105
if (issue.data.fields.customfield_10105) {
println "Functional Reviewer: ${issue.data.fields.customfield_10105.displayName}"
pullRequest.addLabel('functional-review')
} else {
println "No functional reviewer assigned."
}
Expand All @@ -518,9 +524,26 @@ pipeline {
def status = issue.data.fields.status
println "Issue Status: ${status.name} (${status.id})"

// For Issues with Functional reviewer and not validated
if (issue.data.fields.customfield_10105 && status.id != "10325") {
unstable "Functional approval required."
// For Issues with Functional reviewer
if (issue.data.fields.customfield_10105) {
// Not validated
if (status.id != "10325") {
// Ensure the PR is not already marked as changed requested
def lastFuncReviewStatus
for (review in pullRequest.reviews) {
if (review.user == "ironArt3mis") {
lastFuncReviewStatus = review.state
}
}
// PR already marked as review requested
if (lastFuncReviewStatus == "CHANGES_REQUESTED") {
echo "This PR is already marked as functional review required"
return
}
pullRequest.review('REQUEST_CHANGES', 'Functional review required')
} else {
pullRequest.review('APPROVE')
}
}
}
}
Expand Down

0 comments on commit 9fd32d6

Please sign in to comment.