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
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 6 additions & 4 deletions Tasks/KubernetesV0/src/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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 @@ -64,13 +65,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 outputVariableName = 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": 39
"Patch": 40
},
"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": 39
"Patch": 40
},
"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);
const environmentVariableMaximumSize = 32766;

var kubeconfigfilePath;
Expand Down Expand Up @@ -54,8 +54,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": 18
"Patch": 19
},
"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": 18
"Patch": 19
},
"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