This commit is contained in:
Krishna Aditya 2016-03-18 12:23:19 +05:30
Родитель 6580793bc3
Коммит b1da8b26d9
6 изменённых файлов: 30 добавлений и 5 удалений

Просмотреть файл

@ -14,5 +14,5 @@ export function runCommand(): void {
var cmd = new docker.DockerCommand(commandLine);
cmd.dockerConnectionString = dockerConnectionString;
cmd.registryConnectionString = registryConnectionString;
cmd.execSync();
cmd.exec();
}

Просмотреть файл

@ -26,7 +26,7 @@ export function dockerBuild(): void {
cmd.context = context;
cmd.imageName = imageName;
cmd.additionalArguments = additionalArgs;
cmd.execSync();
cmd.exec();
}
function copyDockerFileToContextFolder(dockerFile: string, context: string): string {

Просмотреть файл

@ -45,6 +45,31 @@ export class DockerCommand {
return result;
}
public exec(): any {
this.writeCerts();
if (this.connectToHub) {
var loginCmd = this.getCommand("login");
loginCmd.execSync();
}
var command = this.getCommand(this.commandName);
return command.exec()
.then(function(code) {
tl.setResult(tl.TaskResult.Succeeded, "");
})
.fail(function(err: string) {
tl.setResult(tl.TaskResult.Failed, err);
})
.fin(function() {
if (this.connectToHub) {
var logoutCmd = this.getCommand("logout");
logoutCmd.execSync();
}
this.clearCerts();
});
}
private getCommand(commandName: string): tr.ToolRunner {
var command = this.getBasicCommand();

Просмотреть файл

@ -18,7 +18,7 @@ export function dockerPublish(): void {
publishCmd.registryConnectionString = registryConnectionString;
publishCmd.imageName = imageName;
publishCmd.additionalArguments = additionalArgs;
publishCmd.execSync();
publishCmd.exec();
if (removeImageAfterPublish) {
var rmiCmd = new docker.DockerCommand("removeImage");

Просмотреть файл

@ -31,7 +31,7 @@ export function dockerRun(): void {
cmd.ports = ports;
cmd.envVars = envVars;
cmd.additionalArguments = additionalArgs;
cmd.execSync();
cmd.exec();
}
function removeConflictingContainersByName(containerName: string, dockerConnectionString: string): void {

Просмотреть файл

@ -109,7 +109,7 @@
"type": "boolean",
"label": "Remove image after publish",
"defaultValue": "false",
"visibleRule": "action = publish image",
"visibleRule": "action = publish image && action = always hide for now because of async publish",
"helpMarkDown": "When true the image is force removed after publishing."
},
{