making docker actions async
This commit is contained in:
Родитель
6580793bc3
Коммит
b1da8b26d9
|
@ -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."
|
||||
},
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче