Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rutusamai/Run a Build Task #71

Merged
merged 41 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a7fa2fa
Show build task works through input bar
rsamai Aug 23, 2018
5539aaf
added run build task
rsamai Aug 23, 2018
cb6aec3
Right click not working on BuildTaskNode. Works through command palette
rsamai Aug 24, 2018
4017141
quick fixes
rsamai Aug 25, 2018
31de4a5
quick fix to enable context menu on buildTaskNode
northtyphoon Aug 26, 2018
438e253
comamnd not sending via right click
rsamai Aug 27, 2018
73b1978
working from right click now. trying to do show in json
rsamai Aug 27, 2018
e3b7007
Acquire properties in JSON format internally, works
rsamai Aug 29, 2018
c129a29
Now shows organized task jsons on right click
rsamai Aug 29, 2018
5e251aa
import
rsamai Aug 29, 2018
94adfb7
to do
rsamai Aug 29, 2018
46f23f8
issues with getImagesByRepository
rsamai Aug 29, 2018
991f902
try catch build step
rsamai Aug 30, 2018
16037b6
acrTools
rsamai Aug 30, 2018
5624edc
small refactor
rsamai Aug 31, 2018
23e1b35
Show build task works through input bar
rsamai Aug 23, 2018
d83fde5
added run build task
rsamai Aug 23, 2018
4ae8341
Right click not working on BuildTaskNode. Works through command palette
rsamai Aug 24, 2018
b87446d
quick fixes
rsamai Aug 25, 2018
f0af25b
quick fix to enable context menu on buildTaskNode
northtyphoon Aug 26, 2018
4ae9bfd
comamnd not sending via right click
rsamai Aug 27, 2018
a32e764
working from right click now. trying to do show in json
rsamai Aug 27, 2018
1e7a756
Acquire properties in JSON format internally, works
rsamai Aug 29, 2018
f97e39d
Now shows organized task jsons on right click
rsamai Aug 29, 2018
da4143a
import
rsamai Aug 29, 2018
525b9b1
to do
rsamai Aug 29, 2018
f0059c1
issues with getImagesByRepository
rsamai Aug 29, 2018
d5f04bf
try catch build step
rsamai Aug 30, 2018
3976e4d
acrTools
rsamai Aug 30, 2018
f024901
small refactor
rsamai Aug 31, 2018
0cdb02e
Merge branch 'rutusamai/run-and-show-BuildTasks' of https://github.co…
rsamai Aug 31, 2018
e33f373
Show is working- final
rsamai Aug 31, 2018
7267ca6
run is working for right click
rsamai Aug 31, 2018
e68bca6
run build task works through command pallette. added success notifica…
rsamai Aug 31, 2018
a4ba6c1
removed show build task
rsamai Aug 31, 2018
427389f
cleanup- matched quickpick buils task and tasknode withshow build tas…
rsamai Sep 1, 2018
9f1c66e
removed showTaskManager
rsamai Sep 1, 2018
1d73cb8
spacing
rsamai Sep 1, 2018
44a3d0e
outputChannel and null icon
rsamai Sep 4, 2018
6e0df8b
merge to update with dev
Sep 7, 2018
ea43f12
Merge branch 'azurecr/dev' into azurecr/rutusamai/-run-a-buildtask
northtyphoon Sep 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions commands/azureCommands/run-buildTask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { BuildTaskBuildRequest } from "azure-arm-containerregistry/lib/models";
import { Registry } from "azure-arm-containerregistry/lib/models";
import { ResourceGroup } from "azure-arm-resource/lib/resource/models";
import { Subscription } from "azure-arm-resource/lib/subscription/models";
import vscode = require('vscode');
import { BuildTaskNode } from "../../explorer/models/taskNode";
import { ext } from '../../extensionVariables';
import * as acrTools from '../../utils/Azure/acrTools';
import { AzureUtilityManager } from "../../utils/azureUtilityManager";
import { quickPickACRRegistry, quickPickBuildTask, quickPickSubscription } from '../utils/quick-pick-azure';

export async function runBuildTask(context?: BuildTaskNode): Promise<any> {
let buildTaskName: string;
let subscription: Subscription;
let resourceGroup: ResourceGroup;
let registry: Registry;

if (context) { // Right Click
subscription = context.subscription;
registry = context.registry;
resourceGroup = await acrTools.getResourceGroup(registry, subscription);
buildTaskName = context.task.name;
} else { // Command Palette
subscription = await quickPickSubscription();
registry = await quickPickACRRegistry();
resourceGroup = await acrTools.getResourceGroup(registry, subscription);
buildTaskName = (await quickPickBuildTask(registry, subscription, resourceGroup)).name;
}

const client = AzureUtilityManager.getInstance().getContainerRegistryManagementClient(subscription);
let buildRequest: BuildTaskBuildRequest = {
'type': 'BuildTask',
'buildTaskName': buildTaskName
};

try {
await client.registries.queueBuild(resourceGroup.name, registry.name, buildRequest);
} catch (err) {
ext.outputChannel.append(err);
}
vscode.window.showInformationMessage(`Successfully ran the Build Task, ${buildTaskName}`);

}
2 changes: 1 addition & 1 deletion commands/azureCommands/show-buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function showBuildTaskProperties(context?: BuildTaskNode): Promise<
let buildTask: string;

if (context) { // Right click
subscription = context.susbscription;
subscription = context.subscription;
registry = context.registry;
resourceGroup = await acrTools.getResourceGroup(registry, subscription);
buildTask = context.task.name;
Expand Down
2 changes: 2 additions & 0 deletions dockerExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { deleteAzureImage } from './commands/azureCommands/delete-image';
import { deleteAzureRegistry } from './commands/azureCommands/delete-registry';
import { deleteRepository } from './commands/azureCommands/delete-repository';
import { pullFromAzure } from './commands/azureCommands/pull-from-azure';
import { runBuildTask } from './commands/azureCommands/run-buildTask';
import { showBuildTaskProperties } from './commands/azureCommands/show-buildTask';
import { TaskContentProvider } from './commands/azureCommands/task-utils/showTaskManager';
import { buildImage } from './commands/build-image';
Expand Down Expand Up @@ -235,6 +236,7 @@ function registerDockerCommands(azureAccount: AzureAccount): void {
registerAzureCommand('vscode-docker.create-ACR-Registry', createRegistry);
registerAzureCommand('vscode-docker.queueBuild', queueBuild);
registerAzureCommand('vscode-docker.pullFromAzure', pullFromAzure);
registerAzureCommand('vscode-docker.run-ACR-BuildTask', runBuildTask);
registerAzureCommand('vscode-docker.show-ACR-buildTask', showBuildTaskProperties);
}

Expand Down
2 changes: 1 addition & 1 deletion explorer/models/taskNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class BuildTaskNode extends NodeBase {
constructor(
public task: ContainerModels.BuildTask,
public registry: ContainerModels.Registry,
public susbscription: SubscriptionModels.Subscription,
public subscription: SubscriptionModels.Subscription,
public parent: NodeBase

) {
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"onCommand:vscode-docker.explorer.refresh",
"onCommand:vscode-docker.show-ACR-buildTask",
"onCommand:vscode-docker.delete-ACR-Registry",
"onCommand:vscode-docker.run-ACR-BuildTask",
"onCommand:vscode-docker.delete-ACR-Repository",
"onCommand:vscode-docker.delete-ACR-Image",
"onCommand:vscode-docker.connectCustomRegistry",
Expand Down Expand Up @@ -239,6 +240,10 @@
"command": "vscode-docker.delete-ACR-Image",
"when": "view == dockerExplorer && viewItem == azureImageNode"
},
{
"command": "vscode-docker.run-ACR-BuildTask",
"when": "view == dockerExplorer && viewItem == buildTaskNode"
},
{
"command": "vscode-docker.show-ACR-buildTask",
"when": "view == dockerExplorer && viewItem == buildTaskNode"
Expand Down Expand Up @@ -626,6 +631,11 @@
"title": "Browse in the Azure Portal",
"category": "Docker"
},
{
"command": "vscode-docker.run-ACR-BuildTask",
"title": "Run a Build Task",
"category": "Docker"
},
{
"command": "vscode-docker.show-ACR-buildTask",
"title": "Show Build Task Properties",
Expand Down