Azure SQL DB DevOps 部署

Azure SQL DB DevOps Deployment

我正在尝试通过 DevOps 管道部署 Az SQL dacpac:

代码:

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.Repository.LocalPath)/ADFConfig/Deploy/ADFConfig.dacpac'
    ArtifactName: 'drop'

- task: DownloadBuildArtifacts@0  
  inputs:
    buildType: 'current'
    downloadType: 'single'
    ArtifactName: 'drop'
    downloadPath: '$(System.ArtifactsDirectory)'


- task: SqlAzureDacpacDeployment@1
  displayName: 'Azure SQL DacpacTask'
  inputs:
    azureSubscription: 'ServiceConnection-arm-iv-ea-${{ variables.subCode }}-dw-${{ variables.environmentToDeploy }}-rg-01'
    ServerName: 'iv-ea-${{ variables.subCode }}-sql-dw-${{ variables.environmentToDeploy }}.database.windows.net'
    DatabaseName: ADFConfig
    SqlUsername: dwadmin
    SqlPassword: $(sqladminpassword)
    DacpacFile: '$(Pipeline.Workspace)/drop/ADFConfig.dacpac'

下载工件位于:

Downloading drop/ADFConfig.dacpac to D:\a\a\drop\ADFConfig.dacpac
Downloaded drop/ADFConfig.dacpac to D:\a\a\drop\ADFConfig.dacpac

SqlAzureDacpacDeployment 错误是:

##[error]No files were found to deploy with search pattern D:\a\drop\ADFConfig.dacpacCheck

哪里做错了?

好吧,您从 $(Build.Repository.LocalPath) 发布,然后下载到 $(System.ArtifactsDirectory),然后要求部署任务查看 $(Pipeline.Workspace ) 目录。

将 $(Pipeline.Workspace) 更改为 $(System.ArtifactsDirectory).