Azure devops中的角度项目CI给出错误“发布构建工件失败,并显示错误:”

懒人

我在托管于GitHub的一个项目中应用了CI / CD。该项目分为两个子文件夹,其中一个包含在asp.net核心Web API项目中,另一个则是一个有角度的项目。我已经为asp.net核心项目成功构建了ci / cd,但是当我为角度项目构建ci / cd时,CI部分给出了错误

##[error]Publishing build artifacts failed with an error: Not found 
PathtoPublish: /home/vsts/work/1/s/dist

我的pipline yml脚本是:

    trigger:
    - master

    pool:
      vmImage: 'ubuntu-latest'

    steps:
    - task: NodeTool@0
      inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'

    - script: |
        pushd tritronFrontend
        npm install -g @angular/[email protected]
        npm install
        ng build 
      displayName: 'npm install and build'

    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: 'dist'
      ArtifactName: 'dist'
      publishLocation: 'Container'

但是,当我在互联网上看到一些教程时,有如下建议添加存档文件部分:

    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(Build.BinariesDirectory)'
        includeRootFolder: true
        archiveType: 'zip'
        archiveFile:'$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        replaceExistingArchive: true

但这是触发错误

    ##[error]Publishing build artifacts failed with an error: Not found 
    PathtoPublish: /home/vsts/work/1/s/dist

我已经尝试添加存档文件部分,但是没有用。

懒人

如果有人想在github上的任何特定文件夹中部署一个角度应用程序,那么在我的情况下,他必须推送这些特定角度的文件夹,我已经用下面的likes脚本解决了我的问题:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    pushd tritronFrontend
    npm install -g @angular/[email protected]
    npm install
    npm run build
    ng build --prod
  displayName: 'npm install and build'

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: 'tritronFrontend/dist'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true    
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Azure DevOps:如何从发布管道中的PowerShell脚本从构建Azure管道中检索构建工件?

如何在Azure DevOps管道中管理构建工件?

azure devops:复制和发布构建工件 - 按构建编号重命名工件

将最新的构建工件从“ LOCAL” Jenkins发布到Azure DevOps发布管道?

Dotnet 在 docker 中的 linux 错误上发布(Azure DevOps 构建)

通过build.cake而不是Azure Devops发布构建工件

当将Azure DevOps CI / CD用于Linux Web应用程序时,如何仅将构建工件压缩并发布为zip文件,而不是复制到目录中

VSTS:将构建工件发布到Azure文件存储

Azure DevOps 构建工件存储在哪里

请参阅使用YAML管道在Azure DevOps中构建工件

如何将 Azure DevOps 构建工件复制到同一管道中的 Docker 映像构建?

修复VS Mobile Center错误:发布构建工件失败,并显示错误:找不到PathtoPublish

VSTS错误:“发布构建工件失败,并显示错误:无法创建目录'{p}'

Azure Devops - 发布管道工件:构建 ID 无效

想要从 azure devops 构建管道中已发布的工件中读取 xml 文件

如何从Azure Pipelines下载构建工件?

Azure DevOps 管道中的 NG 构建失败:错误:找不到模块“../internal/operators/audit”

Azure Devops未在发布配置中构建

Azure CLI 脚本变量给出错误

Azure devops CI CD 部署中的访问被拒绝错误

如何在构建工件文件中注入 Azure DevOps 管道运行号?

Azure DevOps中的发布管道工件的文件模式

Azure Pipelines for Gradle项目失败,导致发布发布构件失败,并出现错误:找不到PathtoPublish

Azure Devops Pipelines 中的工件

构建失败的 Azure Devops 管道能否在使用 CI 触发时显示上次提交的用户?

Azure功能发布失败错误消息

Azure DevOps - Maven Pipeline 发布工件

Azure 构建和发布工件命名?

如果没有可发布工件的新数据,如何参考之前的任务并停止在 azure devops 中的构建