public final class DeployHelper extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkURIForMarathon(String path)
Check if the URI is Marathon compatible.
|
static String |
encodeURIPath(String path) |
static String |
escapeSingleQuote(String arg)
Escape the ' (single quote) in the argument so that it can be safely used in a singly quoted shell command
argument.
|
static String |
generateRandomDeploymentFileName(String suffix) |
static <T> T |
getProperty(Object properties,
String path,
Class<T> type) |
static String |
removeVariables(String value)
Remove variables (in the form $VAR or ${VAR}) from the given string.
|
static ByteArrayInputStream |
replaceMacro(InputStream original,
hudson.EnvVars envVars,
boolean enabled) |
static String |
replaceVariables(String value,
String replacement)
Replace each of the variables (in the form $VAR or ${VAR}) from the given string with the given replacement.
|
public static String generateRandomDeploymentFileName(String suffix)
public static String escapeSingleQuote(String arg)
For example, let's go
will be quoted to let'"'"'s go
. If this is fed as a singly
quoted argument, it will be 'let'"'"'s go'
, that is, the concatenation of 'let'
,
"'"
and 's go'
.
arg
- the command line argument which may have single quotepublic static String removeVariables(String value)
value
- the input stringpublic static String replaceVariables(String value, String replacement)
value
- the input stringreplacement
- the replacement for all the variablespublic static boolean checkURIForMarathon(String path)
Due to the limitation in the underlying Mesos fetcher used by Marathon, some special characters as well as the URI escaped sequences are not allowed in the file:// URI paths.
At the time of the implementation (Mesos 1.3.x), these limitations are still there, we need to warn the user of such problems.
path
- the URI path being checkedpublic static ByteArrayInputStream replaceMacro(InputStream original, hudson.EnvVars envVars, boolean enabled) throws IOException
IOException
Copyright © 2016–2021. All rights reserved.