0

I have developed an Azure Pipeline task to generate a Kustomize file, which functions correctly on my laptop but not on Azure. It used to work before, but something has changed in Azure that has caused it to stop functioning. Can anyone provide guidance on how to resolve this issue or identify the changes in Azure that may have caused it to fail? Thank you

- task: KubernetesManifest@0
  displayName: Generate kustomize
  name:  Generate kustomize
  inputs:
      action: 'bake'
      renderType: 'kustomize'
      kustomizationPath: '$(Build.SourcesDirectory)'


##[error]error: invalid Kustomization: json: cannot unmarshal string into Go struct field Kustomization.patches of type types.Patch

Azure consistently raises an error whenever there are patches present. By removing patches from the Kustomize file, I was able to resolve the issue. I don't know what wrong with Kustomization.patches

# kustomize patched file
resources:
  - ../base
namespace: prod
patches:
  - patch.yaml
Martinez
  • 172
  • 4
  • 17

1 Answers1

0

I have got same error due to non compatible yaml format (old), check if you are using same kustomize versions in your laptop and Azure.

Couple solutions that worked for me:

Add path prior to file in patches

# kustomize patched file 
resources:
  - ../base
namespace: prod
patches:
  - path: patch.yaml

Replace patches with patchesStrategicMerge (deprecated but seems to work)

# kustomize patched file 
resources:
  - ../base
namespace: prod
patchesStrategicMerge:
  - patch.yaml
Santi
  • 29
  • 4