处理文件后,Azure Pipeline部署有时会失败而没有错误代码

发布于 2025-02-12 07:14:57 字数 2515 浏览 1 评论 0原文

部署失败没有任何明显的原因。有时它在重试后起作用(我会自动添加)

它是一个nodejs react应用程序

,这是我的yaml文件


stages:
- stage: Build
  displayName: Build stage
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

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



    - script: |
       npm i
       cd client
       npm i
       npm run-script build
      displayName: "build"


    
    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        replaceExistingArchive: true

    - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: $(environmentName)
    pool:
      vmImage: $(vmImageName)
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureRmWebAppDeployment@4
            retryCountOnTaskFailure: 2
            displayName: ****
            inputs:
              ConnectionType: 'AzureRM'
              azureSubscription: ****
              appType: 'webAppLinux'
              WebAppName: ****
              packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              RuntimeStack: 'NODE|16-lts'
              StartupCommand: 'pm2 start server.js --no-daemon'

,在这里我们可以从Azure Pipeline中进行日志。如您所见,它实际上并没有说明为什么失败,我也找不到更多的日志

...
Processed 108412 files...
Processed 109760 files...
An unknown error has occurred. Check the diagnostic log for details.
##[error]Failed to deploy web package to App Service.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
##[debug]Deployment Failed with Error: Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]task result: Failed
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]Processed: ##vso[task.issue type=error;]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.```

the deploy fails without any apparent reason. Sometimes it works after retrying (which I added automatically)

it's a nodejs react app

this is my yaml file


stages:
- stage: Build
  displayName: Build stage
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

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



    - script: |
       npm i
       cd client
       npm i
       npm run-script build
      displayName: "build"


    
    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        replaceExistingArchive: true

    - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: $(environmentName)
    pool:
      vmImage: $(vmImageName)
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureRmWebAppDeployment@4
            retryCountOnTaskFailure: 2
            displayName: ****
            inputs:
              ConnectionType: 'AzureRM'
              azureSubscription: ****
              appType: 'webAppLinux'
              WebAppName: ****
              packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              RuntimeStack: 'NODE|16-lts'
              StartupCommand: 'pm2 start server.js --no-daemon'

and here we have the logs from the azure pipeline. As you can see it doesn't actually tell anything about why it fails and I also cannot find any more logs on this

...
Processed 108412 files...
Processed 109760 files...
An unknown error has occurred. Check the diagnostic log for details.
##[error]Failed to deploy web package to App Service.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
##[debug]Deployment Failed with Error: Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]task result: Failed
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]Processed: ##vso[task.issue type=error;]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文