【问题标题】:Azure build pipeline and release pipeline nodejsAzure 构建管道和发布管道 nodejs
【发布时间】:2021-08-22 09:49:52
【问题描述】:

我有一个天蓝色的构建管道和发布管道。我在发布构建工件中遇到问题。在构建管道中,发布构建工件正在默认的“drop”目录中正确创建。

当我在发布管道中下载该工件时,发布文件正在下载到服务抛出错误的home/wwwroot/apservicename/drop

您无权查看此目录或页面。

这意味着我的发布工件没有下载到“home/wwwroot”目录中。

构建管道

   # Node.js
   # Build a general Node.js project with npm.
   # Add steps that analyze code, save build artifacts, deploy, and more:
   # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
   
   trigger:
   - main
   
   pool:
     vmImage": ubuntu-latest
   
   steps:
   - task: NodeTool@0
     inputs:
       versionSpec: '12.x'
     displayName: 'Install Node.js'
   
   - script: |
       npm install
     displayName: 'npm install and build'
   
   - task: ArchiveFiles@2
     inputs:
       rootFolderOrFile: '$(Build.BinariesDirectory)'
       includeRootFolder: true
       archiveType: 'zip'
       archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
       replaceExistingArchive: true
   - task: PublishBuildArtifacts@1
     inputs
       PathtoPublish: "."
       publishLocation: Container"
   
   

发布管道

   steps:
   - task: DownloadBuildArtifacts@0
     displayName: 'Download Build Artifacts'
     inputs:
       "buildType": specific
       project: 'f736e2aa-631d-4bc0-a468-f8c8d1b3713a'
       "pipeline": 15
       "downloadType": specific
       "downloadPath": .
       "extractTars": false

我错过了什么?

【问题讨论】:

  • 您能否添加更多有关设置的详细信息?如果这是整个发布管道,那么代理是否在托管应用程序的服务器上运行?
  • @nimatt 你需要什么信息更详细,我应该分享截图吗?
  • @nimatt 您无权查看此目录或页面。我每次进行部署时都会收到此消息,这就是为什么我知道我的文件没有放在 wwwrootd 中。
  • @nimatt 我的工件正在 wwwroot/myproject/drop 中下载,而它应该在 wwwroot 目录中下载
  • 为什么您的downloadPath 只是. 而不是您要下载它们的目录?

标签: javascript node.js azure azure-pipelines devops


【解决方案1】:

工件名称将始终是路径的一部分,因为可以想象,在此部署之前的构建可能会发布多个工件。

因此,您的部署作业将需要提供工件路径,但您可以尝试这样做 - 在您的变量部分:

变量: ... 工件名称:'APP-FE' 然后在您的发布阶段:

      - task: PublishBuildArtifacts@1
        displayName: "Upload Artifacts"
        inputs:
          PathtoPublish: 
     '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
          ArtifactName: $(artifactName)
          publishLocation: 'Container'

【讨论】:

猜你喜欢
  • 2020-03-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-22
  • 2020-12-23
相关资源
最近更新 更多