【问题标题】:AzureDevOps Duplicate dist folder in pipelines build ? Why?Azure DevOps 在管道构建中重复 dist 文件夹?为什么?
【发布时间】:2019-11-09 14:18:37
【问题描述】:

AzureDevOps -> Pipelines 生成的工件中有一个 dist 文件夹的副本,该副本是 /dist 文件夹和 /drop/dist 文件夹。编辑:完整的 azure-pipeline.yml 文件

# Node.js with Angular
# Build a Node.js project that uses Angular.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

# Major modification referencing
# https://dev.to/thisdotmedia/continuously-integrating-angular-with-azure-devops-2k9l

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

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

# Build angular app area
- script: npm install
  displayName: 'npm install'

- script: npx ng build --prod
  displayName: 'npm build'

# Testing area
- script: npm install puppeteer --save-dev
  displayName: 'Installing puppeteer (Headless browser for testing)'

- script: npx ng test --watch=false --codeCoverage=true
  displayName: 'Running Tests'

- task: PublishTestResults@2
  condition: succeededOrFailed()
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/TEST-*.xml'
  displayName: 'Publish Test Results'

# Publishing items
#   deploy.psl (Powershell script to deploy)
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'deploy.ps1'
    ArtifactName: 'drop'
    publishLocation: 'Container'

#   Firebase.json
- task: PublishBuildArtifacts@1    
  displayName: 'Publish Artifact: Firebase.json'
  inputs:
    PathtoPublish: 'firebase.json'
    ArtifactName: 'drop'
    publishLocation: 'Container'

#   App
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'dist'
    ArtifactName: 'drop/dist'
    publishLocation: 'Container'
  displayName: 'Publish Artifacts'

#   Code Coverage Results
- task: PublishCodeCoverageResults@1
  condition: succeededOrFailed()
  inputs:
    codeCoverageTool: 'Cobertura'
    summaryFileLocation: '$(Build.SourcesDirectory)/coverage/ng-azure-devops/cobertura-coverage.xml'
  displayName: 'Publish Code Coverage Results'

- script: npx ng lint
  displayName: 'Code Analysis'

我已经尝试使用“drop”作为 ArtifactName,它不会在任何地方产生重复的文件夹工件。我很困惑为什么 'drop/dist' 会产生另一个 '/dist' 工件

【问题讨论】:

  • 我无法重现此问题,请您分享有关此问题的更多信息,例如构建日志或重现此问题的示例?
  • pastebin.com/7fQyTKJq 在这里记录

标签: azure-devops continuous-integration yaml


【解决方案1】:

AzureDevOps 在管道构建中重复 dist 文件夹?为什么?

我可以重现这个问题。

当我们将发布工件dist 文件夹与ArtifactName: drop/dist 一起使用时,Azure Devops 将首先创建一个新文件夹drop,然后将工件dist 文件夹发布到该文件夹​​@ 987654331@。

您可以从构建日志中获取此消息:

上传 '/home/vsts/work/1/s/dist' 到文件容器: '#/3620698/drop/dist'

但是,默认情况下,drop 文件夹已经存在。当我们使用ArtifactName: drop/dist发布dist文件夹时,有两个drop文件夹,那么Azure devops会将dist文件夹发布到这两个drop文件夹:

为了更清楚地理解这个问题,你可以在Preview featuresdisableMulti-stage pipelines,然后你会得到输出:

显然,这里有两个drop 文件夹,这就是你在管道构建中获得 Duplicate dist 文件夹的原因。

所以,为了解决这个问题,我们可以将ArtifactName: drop/dist 更改为ArtifactName: dropTest/dist

现在,重复的 dist 文件夹消失了。

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-21
    • 1970-01-01
    • 2020-01-11
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    相关资源
    最近更新 更多