blob: c8c5ea584200be357e2d00d4261a95ee3f9eb0d7 [file] [log] [blame]
package com.mirantis.mcp
/**
* https://issues.jenkins-ci.org/browse/JENKINS-26481
* fix groovy List.collect()
**/
@NonCPS
def constructString(ArrayList options, String keyOption, String separator = " ") {
return options.collect { keyOption + it }.join(separator).replaceAll("\n", "")
}
/**
* Generate current timestamp
*
* @param format Defaults to yyyyMMddHHmmss
*/
def getDatetime(format = "yyyyMMddHHmmss") {
def now = new Date();
return now.format(format, TimeZone.getTimeZone('UTC'));
}
/**
* Run tox with or without specified environment
* @param env String, name of environment
*/
def runTox(String env = null) {
if (env) {
sh "tox -v -e ${env}"
} else {
sh "tox -v"
}
}