Update findGerritChange
* allow to pass custom sshopts
PRODX-3456
Change-Id: Id97c2ba89827127ea1a6a8061cc606a70a0eb3b6
diff --git a/src/com/mirantis/mk/Gerrit.groovy b/src/com/mirantis/mk/Gerrit.groovy
index b436345..29f994d 100644
--- a/src/com/mirantis/mk/Gerrit.groovy
+++ b/src/com/mirantis/mk/Gerrit.groovy
@@ -323,9 +323,9 @@
* @param extraFlags Additional flags for gerrit querry for example
* '--current-patch-set' or '--comments' as a simple string
*/
-def findGerritChange(credentialsId, LinkedHashMap gerritAuth, LinkedHashMap changeParams, String extraFlags = '') {
+def findGerritChange(credentialsId, LinkedHashMap gerritAuth, LinkedHashMap changeParams, String extraFlags = '', String sshOpts = '') {
scriptText = """
- ssh -p ${gerritAuth['PORT']} ${gerritAuth['USER']}@${gerritAuth['HOST']} \
+ ssh ${sshOpts} -p ${gerritAuth['PORT']} ${gerritAuth['USER']}@${gerritAuth['HOST']} \
gerrit query ${extraFlags} \
--format JSON \
"""
@@ -335,9 +335,9 @@
scriptText += " | fgrep -v runTimeMilliseconds || :"
sshagent([credentialsId]) {
jsonChange = sh(
- script:scriptText,
- returnStdout: true,
- ).trim()
+ script: scriptText,
+ returnStdout: true,
+ ).trim()
}
return jsonChange
}