Skip to content

Commit

Permalink
Let checkTests work for PRs
Browse files Browse the repository at this point in the history
Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren committed Apr 30, 2018
1 parent 906b9be commit b98f19a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/org/centos/pipeline/PipelineUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1156,17 +1156,27 @@ def watchForMessages(String msg_provider, String message) {

/**
* Test if $tag tests exist for $mypackage on $mybranch in fedora dist-git
* For mybranch, use fXX or master
* For mybranch, use fXX or master, or PR number (digits only)
* @param mypackage
* @param mybranch
* @param mybranch - Fedora branch or PR number
* @param tag
* @return
*/
def checkTests(String mypackage, String mybranch, String tag) {
echo "Currently checking if package tests exist"
sh "rm -rf ${mypackage}"
return sh (returnStatus: true, script: """
git clone -b ${mybranch} --single-branch https://src.fedoraproject.org/rpms/${mypackage}/ && grep -r '\\- '${tag}'\$' ${mypackage}/tests""") == 0
if (mybranch.isNumber()) {
sh "git clone https://src.fedoraproject.org/rpms/${mypackage}"
dir("${mypackage}") {
sh "git fetch -fu origin refs/pull/${mybranch}/head:pr"
sh "git checkout pr"
return sh (returnStatus: true, script """
grep -r '\\- '${tag}'\$' tests""") == 0
}
} else {
return sh (returnStatus: true, script: """
git clone -b ${mybranch} --single-branch https://src.fedoraproject.org/rpms/${mypackage}/ && grep -r '\\- '${tag}'\$' ${mypackage}/tests""") == 0
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions vars/pipelineUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ class pipelineUtils implements Serializable {

/**
* Test if $tag tests exist for $mypackage on $mybranch in fedora dist-git
* For mybranch, use fXX or master
* For mybranch, use fXX or master or PR number (digits only)
* @param mypackage
* @param mybranch
* @param mybranch - Fedora branch or PR number
* @param tag
* @return
*/
Expand Down

0 comments on commit b98f19a

Please sign in to comment.