我们有一个在自托管的 Azure DevOps Pipeline 上运行,没有并行性,但未运行其部署作业或步骤。
我在下面发布的版本将有两个阶段,但请注意,我已经尝试过删除第二阶段并将整个阶段转换为作业,但结果仍然相同。我还应该注意到,我有多个管道和多个运行良好的作业,这似乎是特定部署作业的问题。
第二阶段永远停留在 Pending 状态(“Job is Pending”)。它永远不会继续开始运行。
这个阶段也无法取消,按照上图,已经卡了两个月了。 我还应该注意,我已将其提交给位于developercommunity.visualstudio.com 的Azure 开发者社区,但我认为他们已经放弃了我的票。
我确信 Azure DevOps 中有许多成功的 CI/CD 部署,但我只是不知道我在这里做错了什么。我正在手动运行的单独发布管道中使用一种工作方法。
以下是受影响的管道,我们将不胜感激。
trigger: none
variables:
ArtifactPackageName: 'app.zip'
DeploySite.IISDeploymentType: 'IISWebsite'
DeploySite.ActionIISWebsite: 'CreateOrUpdateWebsite'
DeploySite.WebsiteName: 'REDACTED'
DeploySite.WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\REDACTED'
DeploySite.AddBinding: false
DeploySite.VirtualPathForApplication: '/REDACTED'
DeploySite.AppPoolName: 'REDACTED'
DeploySite.VirtualApplication: 'REDACTED'
DeploySite.Package: $(Pipeline.Workspace)/drop/$(ArtifactPackageName)
DeploySite.RemoveAdditionalFilesFlag: true
DeploySite.TakeAppOfflineFlag: true
DeploySite.XmlTransformation: false
DeploySite.XmlVariableSubstitution: true
DeploySite.SetParametersFile: $(Pipeline.Workspace)/drop/REDACTED.SetParameters.xml
DeploySite.JSONSettingsFiles: '**/appsettings.json'
stages:
- stage: 'Build'
displayName: 'Build'
jobs:
- job: 'Build'
displayName: 'Build'
pool:
name: REDACTED
variables:
Solution: '**/*.sln'
BuildPlatform: 'Any CPU'
BuildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet Tools'
- task: NuGetCommand@2
displayName: 'Restore NuGet Packages'
inputs:
restoreSolution: '$(Solution)'
- task: VSBuild@1
displayName: 'MSBuild'
inputs:
solution: '$(Solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(Build.ArtifactStagingDirectory)\$(ArtifactPackageName)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Build Artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: drop
publishLocation: 'Container'
- stage: 'Deploy'
displayName: 'Deploy'
dependsOn: 'Build'
jobs:
- deployment: 'Deploy'
displayName: 'Deploy'
continueOnError: false
timeoutInMinutes: 10
workspace:
clean: all
pool:
name: REDACTED
environment:
name: SERVER-DEV
resourceType: VirtualMachine
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: 'Download Artifact'
artifact: drop
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'Stop IIS App Pool'
continueOnError: false
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StopAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
continueOnError: false
inputs:
WebSiteName: '$(DeploySite.WebsiteName)'
VirtualApplication: '$(DeploySite.VirtualApplication)'
Package: '$(DeploySite.Package)'
RemoveAdditionalFilesFlag: $(DeploySite.RemoveAdditionalFilesFlag)
SetParametersFile: $(DeploySite.SetParametersFile)
TakeAppOfflineFlag: $(DeploySite.TakeAppOfflineFlag)
XmlTransformation: $(DeploySite.XmlTransformation)
XmlVariableSubstitution: $(DeploySite.XmlVariableSubstitution)
JSONFiles: $(DeploySite.JSONSettingsFiles)
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'Start IIS App Pool'
continueOnError: true
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StartAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
- deployment: Deploy
重命名为
- deployment: Deployment
...它开始起作用了。的舞台上遇到了同样的错误。 成功的解决方法是将
部署作业替换为常规作业。但是,此方法不会保留您的部署历史记录或允许部署策略。 在您的情况下,
Deploy
将是:
- stage: 'Deploy'
displayName: 'Deploy'
dependsOn: 'Build'
jobs:
- job: 'Deploy'
displayName: 'Deploy'
continueOnError: false
timeoutInMinutes: 10
workspace:
clean: all
pool:
name: REDACTED
steps:
- download: current
displayName: 'Download Artifact'
artifact: drop
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'Stop IIS App Pool'
continueOnError: false
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StopAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
continueOnError: false
inputs:
WebSiteName: '$(DeploySite.WebsiteName)'
VirtualApplication: '$(DeploySite.VirtualApplication)'
Package: '$(DeploySite.Package)'
RemoveAdditionalFilesFlag: $(DeploySite.RemoveAdditionalFilesFlag)
SetParametersFile: $(DeploySite.SetParametersFile)
TakeAppOfflineFlag: $(DeploySite.TakeAppOfflineFlag)
XmlTransformation: $(DeploySite.XmlTransformation)
XmlVariableSubstitution: $(DeploySite.XmlVariableSubstitution)
JSONFiles: $(DeploySite.JSONSettingsFiles)
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'Start IIS App Pool'
continueOnError: true
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StartAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'