blob: c8c5ea584200be357e2d00d4261a95ee3f9eb0d7 [file] [log] [blame]
Ruslan Kamaldinov90d4e672016-11-11 18:31:00 +03001package com.mirantis.mcp
2
3/**
4 * https://issues.jenkins-ci.org/browse/JENKINS-26481
5 * fix groovy List.collect()
6 **/
7@NonCPS
8def constructString(ArrayList options, String keyOption, String separator = " ") {
9 return options.collect { keyOption + it }.join(separator).replaceAll("\n", "")
10}
11
12/**
13 * Generate current timestamp
14 *
15 * @param format Defaults to yyyyMMddHHmmss
16 */
17def getDatetime(format = "yyyyMMddHHmmss") {
18 def now = new Date();
19 return now.format(format, TimeZone.getTimeZone('UTC'));
Denis Egorenko8c606552016-12-07 14:22:50 +040020}
21
22/**
23 * Run tox with or without specified environment
24 * @param env String, name of environment
25 */
26def runTox(String env = null) {
27 if (env) {
28 sh "tox -v -e ${env}"
29 } else {
30 sh "tox -v"
31 }
32}