0
votes

I have an Asp.net Core project, and I'm trying to create an Azure DevOps Pipeline for Kubernetes Deployment using Helm 3.

The structure of the project is:

Server charts server Chart.yaml Controllers etc..

The current build pipeline, builds the docker image, and upload it to Azure Container Registry.

The error occurs at the HelmDeploy task 'package' => chartPath:

enter image description here

This is the Pipeline stage for Deployment:

  - stage: 'Deploy'
  displayName: 'Deploy the container'
  dependsOn: Build
  jobs:
  - deployment: Deploy
    displayName: Deploy
    pool:
      vmImage: 'ubuntu-latest'
    environment: 'staging'
    strategy:    
      runOnce:
        deploy:
          steps:        
          - task: HelmInstaller@0
            inputs:
              helmVersion: 'latest'
              installKubectl: true
          
          - task: HelmDeploy@0
            inputs:
              command: 'package'
              chartPath: Server/charts/server

          - task: HelmDeploy@0
            inputs:
              connectionType: 'Kubernetes Service Connection'
              kubernetesServiceConnection: 'Staging-592588480'
              namespace: 'staging'
              command: 'upgrade'
              chartType: 'FilePath'
              chartPath: $(Build.ArtifactStagingDirectory)/server

I tried many combinations without success:

chartPath: $(Build.Repository.LocalPath)/Server/charts/server
chartPath: $(Build.SourcesDirectory)/Server/charts/server
chartPath: **/Server/charts/server
chartPath: Server/charts/server/

According to the documentation, Helm 3 on azure pipelines do not need 'init' command, and the 'upgrade' command will install the charts if not exists.

1

1 Answers

4
votes

By default deployment jobs doesn't download source code so if you keep you charts in your source code please add checkout step at the beginning of deployment job

- checkout: self