2016-09-16 00:49:32 +03:00
|
|
|
import vscode = require('vscode');
|
2017-03-02 04:49:54 +03:00
|
|
|
import { ImageItem, quickPickImage } from './utils/quick-pick-image';
|
|
|
|
import { reporter } from '../telemetry/telemetry';
|
2017-08-11 09:17:33 +03:00
|
|
|
import { DockerNode } from '../explorer/dockerExplorer';
|
2017-03-04 04:13:14 +03:00
|
|
|
const teleCmdId: string = 'vscode-docker.image.push';
|
2016-09-16 00:49:32 +03:00
|
|
|
|
2017-08-11 09:17:33 +03:00
|
|
|
export async function pushImage(context?: DockerNode) {
|
|
|
|
let imageToPush: Docker.ImageDesc;
|
|
|
|
let imageName: string = "";
|
2017-06-06 03:55:05 +03:00
|
|
|
|
2017-08-11 09:17:33 +03:00
|
|
|
if (context && context.imageDesc) {
|
|
|
|
imageToPush = context.imageDesc;
|
|
|
|
imageName = context.label;
|
|
|
|
} else {
|
|
|
|
const selectedItem: ImageItem = await quickPickImage();
|
|
|
|
if (selectedItem) {
|
|
|
|
imageToPush = selectedItem.imageDesc;
|
|
|
|
imageName = selectedItem.label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (imageToPush) {
|
|
|
|
const terminal = vscode.window.createTerminal(imageName);
|
|
|
|
terminal.sendText(`docker push ${imageName}`);
|
2017-06-06 03:55:05 +03:00
|
|
|
terminal.show();
|
|
|
|
if (reporter) {
|
|
|
|
reporter.sendTelemetryEvent('command', {
|
|
|
|
command: teleCmdId
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2016-09-20 19:47:56 +03:00
|
|
|
}
|