Azure-pipelines-tasks: Kubernetes Manifest task can't deploy baked files

Created on 10 Jul 2019  路  9Comments  路  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: Bug

Enter Task Name: KubernetesManifest

Environment

- If using Azure Pipelines, provide the account name, team project name, build definition name/build number:  fishandrichardson, IT Dev Internal Projects, ApplicationInsightsInjestor, 5556
  • Agent - Hosted or Private:

    • If using Hosted agent, provide agent queue name: Hosted Ubuntu 1604

Issue Description

If you use bake, then deploy with the manifests set to "$(bake.manifestsBundle)" you get the error below

Task logs

logs_5560.zip

Error logs

[error]No manifest file(s) matching %s was found.

Release bug

Most helpful comment

hi @benc-uk
I run in an error like you; bug?

      - task: KubernetesManifest@0
        name: 'bake'
        displayName: Create secrets
        inputs:
          action: bake
          renderType: kustomize
          kustomizationPath: manifests/secrets

      - task: KubernetesManifest@0
        displayName: Deploy to Kubernetes cluster
        inputs:
          kubernetesServiceConnection: bluegreen
          manifests:  $(bake.manifestsBundle)

==============
/usr/bin/kubectl apply -f --namespace default
error: must specify one of -f and -k

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/kubernetes/bake?view=azure-devops#kustomize-example

All 9 comments

Are you still facing this issue?
Could be related to this issue: https://github.com/microsoft/azure-pipelines-tasks/issues/10813#issuecomment-509933124

Same issue here. I'm getting ##[error]No manifest file(s) matching %s was found.

My tasks are running inside one of the new deployment jobs

jobs:
- deployment: deployToAKS
  displayName: Deploy to AKS ${{ parameters.envName }}
  environment: AKS-${{ parameters.envName }}

  pool:
    vmImage: Ubuntu-16.04

  strategy:
    runOnce:
      deploy:
        steps:
        - task: KubernetesManifest@0
          displayName: Bake manifests from Helm chart
          inputs:
            action: bake
            renderType: helm2
            releaseName: '${{ parameters.envName }}-$(Build.BuildId)'
            helmChart: kubernetes/helm/smilr
            overrides: |
              registryPrefix:$(acr-name).azurecr.io/
              dataApi.imageTag:$(image-tag)
              frontend.imageTag:$(image-tag)
              mongo.usePersistence:false

        - task: KubernetesManifest@0
          displayName: Deploy manifests
          inputs:
            kubernetesServiceConnection: $(aks-connection)
            namespace: ${{ parameters.envName }}
            manifests: $(bake.manifestsBundle)

I checked the variables and bake.manifestsBundle is never available or set

When I switch on debug logging I see

2019-07-17T15:18:24.7355821Z ##[debug]agent.tempDirectory=/home/vsts/work/_temp
2019-07-17T15:18:24.7356579Z ##[debug]set manifestsBundle=/home/vsts/work/_temp/baked-template-9f32b95b-10e7-4f2f-8420-5499275ddb2b.yaml
2019-07-17T15:18:24.7382783Z ##[debug]Processed: ##vso[task.setvariable variable=manifestsBundle;issecret=false;]/home/vsts/work/_temp/baked-template-9f32b95b-10e7-4f2f-8420-5499275ddb2b.yaml

Is this going to be fixed, because the task simply doesn't work right now

Setting manifestsBundle variable suffices here because it is an output variable

We're currently investigating the root cause of the issue, from the logs it looks like the bake.manifestsBundle didn't get extracted.

@benc-uk What's the agent version?

@ericsciple Is there any known issue with the agent?

I tried this

        - task: KubernetesManifest@0
          displayName: Deploy manifests
          inputs:
            kubernetesServiceConnection: $(aks-connection)
            namespace: ${{ parameters.envName }}
            manifests: $(manifestsBundle)

It got the same error :(

Current agent version: 2.154.1
Task version 0.154.5

I've found a work around. I ran printenv in my pipeline and spotted KUBERNETESMANIFEST_MANIFESTSBUNDLE was being set as an environmental variable with the value I needed. So to use it in the KubernetesManifest task I set/copy it to another variable called manifests and use that,

It's a cludge but seems to work

        - bash: echo "##vso[task.setvariable variable=manifests]$KUBERNETESMANIFEST_MANIFESTSBUNDLE"

        - task: KubernetesManifest@0
          displayName: Deploy manifests
          inputs:
            kubernetesServiceConnection: $(aks-connection)
            namespace: ${{ parameters.envName }}
            manifests: $(manifests)

I just noticed, your yaml is missing name: bake parameter in the task usage.

        - task: KubernetesManifest@0
          displayName: Bake manifests from Helm chart
          name: 'bake' # <== This parameter adds reference
          inputs:
            action: bake
            renderType: helm2
            releaseName: '${{ parameters.envName }}-$(Build.BuildId)'
            helmChart: kubernetes/helm/smilr
            overrides: |
              registryPrefix:$(acr-name).azurecr.io/
              dataApi.imageTag:$(image-tag)
              frontend.imageTag:$(image-tag)
              mongo.usePersistence:false

Ahhh! That fixed it

I've never needed or even seen the name parameter on a task before. This could do with better documentation I think

Thanks tho

hi @benc-uk
I run in an error like you; bug?

      - task: KubernetesManifest@0
        name: 'bake'
        displayName: Create secrets
        inputs:
          action: bake
          renderType: kustomize
          kustomizationPath: manifests/secrets

      - task: KubernetesManifest@0
        displayName: Deploy to Kubernetes cluster
        inputs:
          kubernetesServiceConnection: bluegreen
          manifests:  $(bake.manifestsBundle)

==============
/usr/bin/kubectl apply -f --namespace default
error: must specify one of -f and -k

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/kubernetes/bake?view=azure-devops#kustomize-example

Was this page helpful?
0 / 5 - 0 ratings