KubernetesManifest task doesn't accept variable for kubernetesServiceConnection
See original GitHub issueQuestion, Bug, or Feature?
Type: Bug
Enter Task Name: KubernetesManifest
Environment
Azure Pipelines
Issue Description
When trying to store the kubernetesServiceConnection in a variable, it doesn’t appear to resolve the variable and fails.
Task:
- task: KubernetesManifest@0
displayName: Deploy
inputs:
kubernetesServiceConnection: $(KubernetesServiceConnection)
namespace: default
manifests: '$(Pipeline.Workspace)/service.yml'
containers: '$(ContainerRegistry)/$(ImageName):$(Build.BuildNumber)'
This results in the error in the Error Logs section below, regardless of whether I try and include it from a variable group at the pipeline level ie this at the top of the file:
variables:
- group: myVarGroup
or from a variable group inside the stage or job, or as a direct variable in either place, ie this:
variables:
- name: KubernetesServiceConnection value: MyServiceConnectionName
If I replace the variable with the actual name, using: kubernetesServiceConnection: MyServiceConnectionName
it works as expected. Is this expected to work with variables, and if so is there anything obvious I’m doing wrong?
Task logs
Task doesn’t start so no logs
Error logs
There was a resource authorization issue: "The pipeline is not valid. Job Job1: Step input kubernetesServiceConnection references service connection $(KubernetesServiceConnection) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (2 by maintainers)
Top GitHub Comments
@clpalmer can you try
${{ variables.kubernetesServiceConnection }}
. It is working for me. Also all my variables are defined in yaml variable files.2022 and worked with this work around.
` jobs: - deployment: release_api displayName: Deploy API Development pool: vmImage: ‘ubuntu-latest’ environment: Development variables: - group: Group - Development # Defined variable Kubernetes.ServiceEndpointName