【问题标题】:Need to build javascript app using build.yaml in Azuredevops需要在 Azure Devops 中使用 build.yaml 构建 javascript 应用程序
【发布时间】:2020-01-12 07:13:29
【问题描述】:

我必须使用 Azuredevops 通过 build.yaml 构建 javascript 应用程序,并且根据微软文档 https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops 我无法运行它,因为我很震惊 “加载 YAML 构建管道时出错。段数错误”异常

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'

这是我的 build.yaml

【问题讨论】:

  • 你能分享错误的截图吗?使用 yaml 文件。
  • 应该 name: 'drop'artifactName: 'drop' - docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/…
  • @JaromandaX 所以我把这个名字改成了 artifactName 但它没有帮助
  • 我的 build.yaml 被添加到描述中,我得到的错误是“加载 YAML 构建管道时发生错误。段数错误”
  • 您检查过inputs 中的task: ArchiveFiles@2 是否也正确

标签: javascript build azure-devops yaml


【解决方案1】:

你的 build.yaml 在我的 AzureDevops 上运行良好。您可以尝试使用 azure devops 中的向导创建新管道。并将您的 build.yaml 复制到 YAML 编辑器,并检查编辑器是否在某些内容下划线。

您可以找到由 Microsoft 提供的关于构建/测试/部署 JavaScript 应用程序的示例 here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-22
    • 2020-09-14
    • 2022-08-07
    • 2020-03-02
    • 2022-09-29
    • 2019-06-03
    相关资源
    最近更新 更多