Azure-pipelines-tasks: [Feature Request] - KubernetesV1 - Don't force commands to use '-o' json/yaml

Created on 1 Aug 2019  路  3Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Feature

Enter Task Name: Kubernetes

list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/blob/866830aecf96e48e2610c8876ec1d27b0767644f/Tasks/KubernetesV1/src/kubernetescommand.ts

@Environment

Azure Pipelines

  • Agent - Hosted

Issue Description

The Kubernetes task will per default add -o json to the command unless outputFormat input variable is used to change it to yaml.

My issue is that, at times, you do not wish to see the output so verbose at all. For example, applying configmaps with JSON in them used for dashboards by Grafana, these becomes massive and pollutes the output.

It would be nice to have the option to choose not to use any -o at all so all that remains is just the "applied" message.

As a side note, with this kind of usage, since the output steam becomes so big, we get warnings:

Error logs

[warning]Output variable not set as kubectl command output exceeded the maximum supported length. Output length: 290661, Maximum supported length: 32766

Release enhancement

Most helpful comment

Agreed.

This is necessary for us to avoid leaking secrets. See https://github.com/microsoft/azure-pipelines-tasks/issues/8885 too.

Our task looks like this:

- task: Kubernetes@1
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(serviceConnectionName)
    azureResourceGroup: $(deployResourceGroupName)
    kubernetesCluster: $(deployKubernetesName)
    command: apply
    arguments: -f $(Agent.TempDirectory)/kubernetes.json
    outputFormat: name

It works. It complains that outputFormat is an invalid value, but the pipeline runs anyway. We have secrets in our kubernetes.json, so yaml/json output actually spits out those secrets for some silly reason. We avoid it by setting output to name.

All 3 comments

Agreed.

This is necessary for us to avoid leaking secrets. See https://github.com/microsoft/azure-pipelines-tasks/issues/8885 too.

Our task looks like this:

- task: Kubernetes@1
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(serviceConnectionName)
    azureResourceGroup: $(deployResourceGroupName)
    kubernetesCluster: $(deployKubernetesName)
    command: apply
    arguments: -f $(Agent.TempDirectory)/kubernetes.json
    outputFormat: name

It works. It complains that outputFormat is an invalid value, but the pipeline runs anyway. We have secrets in our kubernetes.json, so yaml/json output actually spits out those secrets for some silly reason. We avoid it by setting output to name.

Any update for this?

If you set outputFormat: '' like this.. it won't add -o to the commands!

Was this page helpful?
0 / 5 - 0 ratings