Home > Software design >  pushing the helm chart to azure container registry fails
pushing the helm chart to azure container registry fails

Time:01-13

I get the below error when I try to push the chart to ACR. Can you suggest the steps to be done here?

"This command is implicitly deprecated because command group 'acr helm' is deprecated and will be removed in a future release. Use 'helm v3' instead."

I followed this article to create helm chart

https://cloudblogs.microsoft.com/opensource/2018/11/27/tutorial-azure-devops-setup-cicd-pipeline-kubernetes-docker-helm/

These articles also describe the issue, but I don't understand what needs to be done to fix it. https://github.com/Azure/azure-cli/issues/14498 https://gitanswer.com/azure-cli-az-acr-helm-commands-not-working-python-663770738 https://github.com/Azure/azure-cli/issues/14467

Here is the yaml script which throws error

- bash: |
    cd $(projectName)
    chartPackage=$(ls $(projectName)-$(helmChartVersion).tgz)
    az acr helm push \
        -n $(registryName) \
        -u $(registryLogin) \
        -p '$(registryPassword)' \
        $chartPackage



 Chart.yaml
         apiVersion: v1
         description: first helm chart create 
          name: helmApp
          version: v0.3.0

CodePudding user response:

Export the variable HELM_EXPERIMENTAL_OCI=1 as part of the bash script. Azure Chart Museums in ACR are OCI registries and therefore need this ENV variable set in order to push.

Upon closer examination of the question You should ise the built in task for this

- task: HelmDeploy@0
  displayName: Helm save
  inputs:
    command: save
    chartNameForACR: '<chart_name>:<tag>'
    chartPathForACR: <chart_dir>
    azureSubscriptionEndpointForACR: $(SERVICE_CONNECTION)
    azureResourceGroupForACR: $(REGISTRY_RESOURCE_GROUP)
    azureContainerRegistry: $(REGISTRY_NAME)
```

CodePudding user response:

Azure has deprecated the support managing Helm charts using the Az Cli. So you will need version Helm client 3.7.1 to push the Helm charts to ACR.

To push the Helm charts to ACR, follow the next steps:

  1. Enable OCI support

    export HELM_EXPERIMENTAL_OCI=1
    
  2. Save your chart to a local archive

    cd chart-dir
    helm package .
    
  3. Authenticate with the registry using helm registry login command

    helm registry login $ACR_NAME.azurecr.io \
      --username $USER_NAME \
      --password $PASSWORD
    
  4. Push chart to the registry as OCI artifact

    helm push chart-name-0.1.0.tgz oci://$ACR_NAME.azurecr.io/helm
    

You can use the above steps in the Azure DevOps pipeline and it will work as expected. For more info on pushing helm charts to ACR, refer to this doc.

  •  Tags:  
  • Related