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

Made command dropdown optional in Kubernetes V0 and V1 task #8931

Merged
merged 7 commits into from
Dec 3, 2018
Merged
10 changes: 6 additions & 4 deletions Tasks/KubernetesV0/src/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async function run(clusterConnection: ClusterConnection, registryAuthenticationT
{
var secretName = tl.getInput("secretName", false);
var configMapName = tl.getInput("configMapName", false);
var command = tl.getInput("command", false);

if(secretName) {
await kubectlSecret.run(clusterConnection, registryAuthenticationToken, secretName);
Expand All @@ -63,13 +64,14 @@ async function run(clusterConnection: ClusterConnection, registryAuthenticationT
if(configMapName) {
await kubectlConfigMap.run(clusterConnection, configMapName);
}

await executeKubectlCommand(clusterConnection);

if (command) {
await executeKubectlCommand(clusterConnection, command);
}
}

// execute kubectl command
function executeKubectlCommand(clusterConnection: ClusterConnection) : any {
var command = tl.getInput("command", true);
function executeKubectlCommand(clusterConnection: ClusterConnection, command: string) : any {
var result = "";
var ouputVariableName = tl.getInput("kubectlOutput", false);
var telemetry = {
Expand Down
6 changes: 3 additions & 3 deletions Tasks/KubernetesV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 0,
"Minor": 1,
"Patch": 36
"Patch": 37
},
"demands": [],
"preview": "false",
Expand Down Expand Up @@ -66,8 +66,8 @@
"name": "command",
"type": "pickList",
"label": "Command",
"defaultValue": "apply",
"required": true,
"defaultValue": "",
"required": false,
"options": {
"apply": "apply",
"create": "create",
Expand Down
6 changes: 3 additions & 3 deletions Tasks/KubernetesV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 0,
"Minor": 1,
"Patch": 36
"Patch": 37
},
"demands": [],
"preview": "false",
Expand Down Expand Up @@ -66,8 +66,8 @@
"name": "command",
"type": "pickList",
"label": "ms-resource:loc.input.label.command",
"defaultValue": "apply",
"required": true,
"defaultValue": "",
"required": false,
"options": {
"apply": "apply",
"create": "create",
Expand Down
8 changes: 5 additions & 3 deletions Tasks/KubernetesV1/src/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tl.setResourcePath(path.join(__dirname, '..' , 'task.json'));
tl.cd(tl.getInput("cwd"));

var registryType = tl.getInput("containerRegistryType", true);
var command = tl.getInput("command", true);
var command = tl.getInput("command", false);

var kubeconfigfilePath;
if (command === "logout") {
Expand Down Expand Up @@ -53,8 +53,10 @@ async function run(clusterConnection: ClusterConnection, command: string)
if(configMapName) {
await kubectlConfigMap.run(clusterConnection, configMapName);
}

await executeKubectlCommand(clusterConnection, command);

if(command) {
await executeKubectlCommand(clusterConnection, command);
}
}

// execute kubectl command
Expand Down
6 changes: 3 additions & 3 deletions Tasks/KubernetesV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 15
"Patch": 16
},
"demands": [],
"releaseNotes": "What's new in Version 1.0:<br/>&nbsp;Added new service connection type input for easy selection of Azure AKS cluster.<br/>&nbsp;Replaced output variable input with output variables section that we had added in all tasks.",
Expand Down Expand Up @@ -127,8 +127,8 @@
"name": "command",
"type": "pickList",
"label": "Command",
"defaultValue": "apply",
"required": true,
"defaultValue": "",
"required": false,
"options": {
"apply": "apply",
"create": "create",
Expand Down
6 changes: 3 additions & 3 deletions Tasks/KubernetesV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 15
"Patch": 16
},
"demands": [],
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down Expand Up @@ -127,8 +127,8 @@
"name": "command",
"type": "pickList",
"label": "ms-resource:loc.input.label.command",
"defaultValue": "apply",
"required": true,
"defaultValue": "",
"required": false,
"options": {
"apply": "apply",
"create": "create",
Expand Down