1
votes

I have to build javascript app through build.yaml using Azuredevops and as per microsoft documentation https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops I'm unable to run it as I'm struck with "An error occurred while loading the YAML build pipeline. wrong number of segments" exception

pool:
  vmImage: 'ubuntu-latest'

trigger:
  batch: false
  branches:
    include:
    - '*'
  paths:
    exclude:
    - 'Currency/*'
steps:
- bash: |
    if [ -f Convertor.csproj ]
    then
        dotnet build Convertor.csproj --output ./bin
    fi
    npm install 
    npm run build --if-present
    npm prune --production
- task: ArchiveFiles@2
  displayName: "Archive files"
  inputs:
    rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
    includeRootFolder: false
    archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
    artifactName: 'drop'

This is my build.yaml

1
Can you share a screenshot of the error? with the yaml file.Shayki Abramczyk
should name: 'drop' be artifactName: 'drop' - docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/…Jaromanda X
@JaromandaX so I have chamnged the name to artifactName but it didn't helpedanuj khosla
My build.yaml is added in the description and error which I'm getting is "An error occurred while loading the YAML build pipeline. wrong number of segment"anuj khosla
have you checked that inputs in task: ArchiveFiles@2 are also correctJaromanda X

1 Answers

0
votes

The build.yaml of yours worked fine on my AzureDevops. You can try creating a new pipeline using the wizard in azure devops. And copy your build.yaml to the YAML editor, and check if the editor underlines something.

You can find an example here about building/testing/deploying JavaScript apps given by Microsoft.