【发布时间】:2020-06-14 20:35:56
【问题描述】:
我正在构建我的发布管道,其中包含将迁移部署到我自己的服务器上的 SQL Server 数据库的阶段。构建管道生成.sql 脚本并将其发布到迁移文件夹中
在发布管道中,我添加了一个名为 SQL Server database deploy 的任务并将路径设置为 .sql 文件
现在,如果我运行该管道,它会遇到错误
[error]No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
所以一定是提供了错误的路径,但是我找不到,可能是正确的路径。
这是调试输出
2020-06-14T21:00:46.9140268Z ##[debug]Evaluating condition for step: 'Deploy using : sqlQuery'
2020-06-14T21:00:46.9142671Z ##[debug]Evaluating: succeeded()
2020-06-14T21:00:46.9143229Z ##[debug]Evaluating succeeded:
2020-06-14T21:00:46.9144608Z ##[debug]=> True
2020-06-14T21:00:46.9145556Z ##[debug]Result: True
2020-06-14T21:00:46.9146106Z ##[section]Starting: Deploy using : sqlQuery
2020-06-14T21:00:46.9277557Z ==============================================================================
2020-06-14T21:00:46.9277903Z Task : SQL Server database deploy
2020-06-14T21:00:46.9278185Z Description : Deploy a SQL Server database using DACPAC or SQL scripts
2020-06-14T21:00:46.9278427Z Version : 0.3.23
2020-06-14T21:00:46.9278632Z Author : Microsoft Corporation
2020-06-14T21:00:46.9278995Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/sql-dacpac-deployment-on-machine-group
2020-06-14T21:00:46.9279376Z ==============================================================================
2020-06-14T21:00:48.0530812Z ##[debug]VstsTaskSdk 0.8.2 commit
2020-06-14T21:00:48.2649638Z ##[debug]Entering D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Main.ps1.
2020-06-14T21:00:48.2752917Z ##[debug]Loading resource strings from: D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Task.json
2020-06-14T21:00:48.3003693Z ##[debug]Loaded 6 strings.
2020-06-14T21:00:48.3288927Z ##[debug]SYSTEM_CULTURE: 'en-US'
2020-06-14T21:00:48.3289509Z ##[debug]Loading resource strings from: D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Strings\resources.resjson\en-US\resources.resjson
2020-06-14T21:00:48.3331827Z ##[debug]Loaded 6 strings.
2020-06-14T21:00:48.3607995Z ##[debug]INPUT_TASKTYPE: 'sqlQuery'
2020-06-14T21:00:48.3663637Z ##[debug]INPUT_DACPACFILE: 'D:\a\r1\a'
2020-06-14T21:00:48.3665646Z ##[debug]INPUT_SQLFILE: 'D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql'
2020-06-14T21:00:48.3680833Z ##[debug]INPUT_EXECUTEINTRANSACTION: 'false'
2020-06-14T21:00:48.3721277Z ##[debug] Converted to bool: False
2020-06-14T21:00:48.3755339Z ##[debug]INPUT_EXCLUSIVELOCK: 'false'
2020-06-14T21:00:48.3778148Z ##[debug] Converted to bool: False
2020-06-14T21:00:48.3809928Z ##[debug]INPUT_APPLOCKNAME (empty)
2020-06-14T21:00:48.3882461Z ##[debug]INPUT_INLINESQL (empty)
2020-06-14T21:00:48.3919370Z ##[debug]INPUT_TARGETMETHOD: 'server'
2020-06-14T21:00:48.3954451Z ##[debug]INPUT_SERVERNAME: '88.198.44.249'
2020-06-14T21:00:48.3990602Z ##[debug]INPUT_DATABASENAME: 'Stage.TimeService'
2020-06-14T21:00:48.4026165Z ##[debug]INPUT_AUTHSCHEME: 'sqlServerAuthentication'
2020-06-14T21:00:48.4050818Z ##[debug]INPUT_SQLUSERNAME: 'Zoo-Director'
2020-06-14T21:00:48.4083226Z ##[debug]INPUT_SQLPASSWORD: 'Daniel#2019!newS'
2020-06-14T21:00:48.4112120Z ##[debug]INPUT_CONNECTIONSTRING (empty)
2020-06-14T21:00:48.4138318Z ##[debug]INPUT_PUBLISHPROFILE (empty)
2020-06-14T21:00:48.4172155Z ##[debug]INPUT_ADDITIONALARGUMENTS (empty)
2020-06-14T21:00:48.4205938Z ##[debug]INPUT_ADDITIONALARGUMENTSSQL (empty)
2020-06-14T21:00:48.4240088Z ##[debug]Loading module from path 'D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psd1'.
2020-06-14T21:00:48.4269587Z ##[debug]Loading module from path 'D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psm1'.
2020-06-14T21:00:48.4423108Z ##[debug]NonInteractive: False
2020-06-14T21:00:48.6017509Z ##[debug]Exporting function 'Invoke-DacpacDeployment'.
2020-06-14T21:00:48.6044940Z ##[debug]Exporting function 'Invoke-SqlQueryDeployment'.
2020-06-14T21:00:48.6091408Z ##[debug]Adding exceptions types.
2020-06-14T21:00:50.8081584Z ##[debug]Importing function 'Invoke-DacpacDeployment'.
2020-06-14T21:00:50.8099297Z ##[debug]Importing function 'Invoke-SqlQueryDeployment'.
2020-06-14T21:00:50.8847884Z ##[debug]Processed: ##vso[telemetry.publish area=SqlDacpacDeploymentOnMachineGroup;feature=SqlDacpacDeploymentOnMachineGroup]{"serverName": "56531c73afc443fce9712faf6ea6473e2b28f77562757d20dc806bf6549c3b0e","databaseName": "a44f4ee78fc10bbef97ea36bc9819a0a47d0e11f6a0aa5cedd395548086fa4e5"}
2020-06-14T21:00:50.9277590Z ##[debug]Finding files with pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:50.9331163Z ##[debug]Entering Find-VstsFiles.
2020-06-14T21:00:50.9388734Z ##[debug] LegacyPattern: 'D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql'
2020-06-14T21:00:50.9831065Z ##[debug]Entering Get-MatchingItems.
2020-06-14T21:00:50.9873935Z ##[debug] IncludePatterns: 'D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql'
2020-06-14T21:00:50.9931616Z ##[debug] ExcludePatterns: ''
2020-06-14T21:00:50.9981552Z ##[debug] IncludeFiles: 'True'
2020-06-14T21:00:51.0003180Z ##[debug] IncludeDirectories: 'False'
2020-06-14T21:00:51.0031742Z ##[debug] Force: 'False'
2020-06-14T21:00:51.2179973Z ##[debug]No paths.
2020-06-14T21:00:51.2213869Z ##[debug]Leaving Get-MatchingItems.
2020-06-14T21:00:51.2233073Z ##[debug]Total found: 0
2020-06-14T21:00:51.2257660Z ##[debug]Leaving Find-VstsFiles.
2020-06-14T21:00:51.2275406Z ##[debug]Matched files =
2020-06-14T21:00:51.3304392Z ##[debug]Write-Exception error:
2020-06-14T21:00:51.3348086Z ##[debug]No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:51.3538650Z ##[debug]Caught exception from task script.
2020-06-14T21:00:51.3575755Z ##[debug]Error record:
2020-06-14T21:00:51.4275609Z ##[debug]No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:51.4293155Z ##[debug]At D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Main.ps1:51 char:13
2020-06-14T21:00:51.4294350Z ##[debug]+ throw (Get-VstsLocString -Key "Nofileswerefoundtodeploywi ...
2020-06-14T21:00:51.4295348Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-06-14T21:00:51.4307202Z ##[debug] + CategoryInfo : OperationStopped: (No files were f...DataContext.sql:String) [], RuntimeException
2020-06-14T21:00:51.4319906Z ##[debug] + FullyQualifiedErrorId : No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceD ataContext.sql
2020-06-14T21:00:51.4330337Z ##[debug]
2020-06-14T21:00:51.4356258Z ##[debug]Script stack trace:
2020-06-14T21:00:51.4395383Z ##[debug]at Get-SingleFile, D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Main.ps1: line 51
2020-06-14T21:00:51.4407230Z ##[debug]at <ScriptBlock>, D:\a\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.23\Main.ps1: line 175
2020-06-14T21:00:51.4422508Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-06-14T21:00:51.4440151Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-06-14T21:00:51.4454203Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-06-14T21:00:51.4478858Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-06-14T21:00:51.4497567Z ##[debug]Exception:
2020-06-14T21:00:51.4549822Z ##[debug]System.Management.Automation.RuntimeException: No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:51.4853912Z ##[error]No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:51.4865099Z ##[debug]Processed: ##vso[task.logissue type=error]No files were found to deploy with search pattern D:\a\r1\a/drop/migrations/TimeServiceDataContext.sql
2020-06-14T21:00:51.4867288Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-06-14T21:00:51.5269963Z ##[section]Finishing: Deploy using : sqlQuery
【问题讨论】:
-
您是否尝试使用 Debug 标志执行管道并查看可用路径?
-
其实没有,不过让我添加调试输出
-
工件恢复的位置包括你给它的名字:
D:\a\r1\a\**ATRIFACTNAME**\drop\migrations\TimeServiceDataContext.sql -
如果将斜杠字符 / 更改为反斜杠字符 \,会发生什么情况?
-
@AlwaysLearning 使用反斜杠时没有任何变化。 @jesshouwing 即使使用ArtifactName也不成功,还是一样的错误
标签: sql-server azure-devops azure-pipelines entity-framework-migrations