2

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
6
  • can you paste the helm chart syntax(Chart.yaml)? Commented Jan 11, 2022 at 2:55
  • @LeiYang I added chart.yaml in the question Commented Jan 11, 2022 at 3:35
  • apiVersion: v1 should be helm2. in helm3, should be apiVersion: v2 Commented Jan 11, 2022 at 3:39
  • I changed to v2, that didn't fix the issue?? any other changes would be required? Commented Jan 11, 2022 at 3:40
  • i'm not sure. please try helm package to local tar.gz then some ways(there must be some) to upload to the azure restry? Commented Jan 11, 2022 at 3:44

3 Answers 3

5

Azure has deprecated the support managing Helm charts using the Az Cli. So you will need Helm client version 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Would be nice if they added a yaml task example for this using the integrated Service Connection instead of username/password variables.
1

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)
```

5 Comments

I tried setting the ADO variable HELM_EXPERIMENTAL_OCI=1 and run but still I have same issue
In that case, you need to do the following (this is what I do) - 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)
I tried using the built in task for publish the charts to ACR. But the ADO pipeline keeps throwing error unknown command "chart" for "helm" and this is the command it runs /usr/local/bin/helm chart save /home/vsts/work/1/s/charts. helm chart command is deprecated. How come it inbuilt task are using this command. Helm Version is v3.7.2+g663a896
Azure has not yet updated their built-in tasks for the breaking changes in 3.7. Set your helm version to 3.6.x and you'll be good to go.
@DerekWilliams how do I do that? I added a task before it but that didn't work: - task: HelmInstaller@0 displayName: Install Helm 3.6.x inputs: helmVersion: 3.6.3
0

Try with the below configuration; it worked for me.

  1. First, login to the registry with Helm Login extensions.
  2. Then, push Helm Chart with cmd bash, as it’s not working with the Help Push extension.
- task: HelmDeploy@1
  displayName: Helm login
  inputs:
    connectionType: 'Azure Resource Manager'
    azureSubscription: 'subscription_name'
    azureResourceGroup: 'rg_name'
    kubernetesCluster: 'clustername'
    namespace: 'namespace_name'
    azureSubscriptionForACR: 'subscription_name'
    azureResourceGroupForACR: 'acrname'
    azureContainerRegistry: 'registry_name'
    command: 'login'    

- task: Bash@3
  displayName: Helm Chart Push
  inputs:
    targetType: 'inline'
    script: |
      # Push to ACR Repository
       export HELM_EXPERIMENTAL_OCI=1
       helm  push path.tgz oci://registry_name -n namespace_name

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.