处理文件后,Azure Pipeline部署有时会失败而没有错误代码
部署失败没有任何明显的原因。有时它在重试后起作用(我会自动添加)
它是一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论