Search code examples
azure-devopsazure-pipelinesazure-artifacts

Packages failed to publish due to TypeError: Cannot read property 'toLowerCase' of null


In my azure devops pipeline. A conda package is build firstly and published via UniversalPackages@0 task.

The build and upload code snippet is shown below

- stage: build_upload_package 
  displayName: Build and upload package
  pool:
    name: Private Agent Eve 
  jobs:
  - job: build_upload_package
    displayName: Build and Upload Package
    condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/release'))
    container:
      image: <azureacr_repo.io>/conda:latest   //modified to remove the information
      endpoint: NameOfTheServiceConnection     //modified to remove the information
    steps:

      - bash: |
          echo "##vso[task.prependpath]$CONDA/bin"
          conda build . --output-folder $(Build.ArtifactStagingDirectory)
        displayName: Build Package
      - bash: echo "##vso[task.setvariable variable=packageName]$(basename $(gitRepoName))"
        displayName: Set Package Name


      - task: UniversalPackages@0  //Error appears here
        displayName: Upload to Azure Universal Packages
        inputs:
          command: publish
          publishDirectory: '$(Build.ArtifactStagingDirectory)'
          vstsFeedPublish: 'project_1/feed_1'   //modified to remove the information
          vstsFeedPackagePublish: '$(packageName)'
          versionOption: patch
          packagePublishDescription: 'upload a Conda Package'

The error for Universal UniversalPackages task is show below

2020-11-24T17:54:48.9628862Z ##[section]Starting: Upload to Azure Universal Packages
2020-11-24T17:54:48.9645737Z ==============================================================================
2020-11-24T17:54:48.9646470Z Task         : Universal packages
2020-11-24T17:54:48.9647068Z Description  : Download or publish Universal Packages
2020-11-24T17:54:48.9647636Z Version      : 0.175.0
2020-11-24T17:54:48.9648154Z Author       : Microsoft Corporation
2020-11-24T17:54:48.9648809Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks
2020-11-24T17:54:48.9649526Z ==============================================================================
2020-11-24T17:54:49.4896147Z SYSTEMVSSCONNECTION exists true
2020-11-24T17:54:50.1267511Z Downloading: https://08wvsblobprodsu6weus73.vsblob.vsassets.io/artifacttool/artifacttool-linux-x64-Release_0.2.172.zip?sv=2019-02-02&sr=b&sig=FvnCFjIg7ZBmIapFcCcWDC1%2F7pajvzvgo0fR2Y3YYeU%3D&spr=https&se=2020-11-24T18%3A54%3A51Z&sp=r&P1=1606243791&P2=11&P3=2&P4=1nPT99OOlNXc9xNzoCS6LpVATo%2bW4fIskTJ8u6olWMk%3d
2020-11-24T17:54:56.4979070Z Caching tool: ArtifactTool 0.2.172 x64
2020-11-24T17:54:56.7183832Z SYSTEMVSSCONNECTION exists true
2020-11-24T17:54:58.7313555Z ##[error]TypeError: Cannot read property 'toLowerCase' of null
2020-11-24T17:54:58.7323845Z ##[error]Packages failed to publish
2020-11-24T17:54:58.7641267Z ##[section]Finishing: Upload to Azure Universal Packages

Question:

How can I solve this issue?


Solution

  • I think I found the error, gitRepoName is a template parameter, it should be accessed as ${{ gitRepoName }} not the $(gitRepoName)