Last active
August 15, 2017 15:34
-
-
Save austbot/8fdf424708dbb6025da15263d099ea5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Proprietary info removed | |
public class DockerRunTask { | |
public static DockerRunContainerTask get(String name, String image, String command, Optional<String> args) { | |
String name = String.format("&s - %s", name, command); | |
DockerRunContainerTask drt = new DockerRunContainerTask() | |
.description(name) | |
.containerName(name) | |
.containerCommand(String.format("%s", command)) | |
.imageName(image) | |
.containerWorkingDirectory("/data") | |
.clearVolumeMappings() | |
.appendVolumeMapping("${bamboo.working.directory}", "/data"); | |
String addArgs = "--user=${bamboo.BAMBOO_USER_ID} -e HOME=/data -e CI=true"; | |
if (args.isPresent()) { | |
addArgs = addArgs.concat(args.get()); | |
} | |
drt.additionalArguments(addArgs); | |
return drt; | |
} | |
public static DockerRunContainerTask get(String command) { | |
return get(command, Optional.empty()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment