node.js - 如何将 Azure DevOps 构建管道连接到专用终结点
问题描述
我正在尝试通过 Azure DevOps 构建管道对托管在 Azure App Service 中的 node.js 应用程序执行 mocha 测试。下面是我正在使用的发布管道代码
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- Test
pool:
vmImage: 'vs2017-win2016'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.14.1'
displayName: 'Install Node.js'
- script: |
npm install
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'npm run local
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'test-results.xml'
- task: ArchiveFiles@2
displayName: 'Archive $(System.DefaultWorkingDirectory)'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/node.zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
当我运行构建时,我收到以下错误
{"name":"xxxx","hostname":"xxxx","pid":xxxx,"level":50,"msg":"Error while connecting sql database xxxx-dev","time":"2020-11-17T11:37:26.852Z","v":0}
[0] {"name":"xxxxx","hostname":"xxxxxx","pid":xxxx,"level":50,"err":{"message":"Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (https://docs.microsoft.com/azure/azure-sql/database/connectivity-settings#deny-public-network-access). To connect to this server, use the Private Endpoint from inside your virtual network (https://docs.microsoft.com/azure/sql-database/sql-database-private-endpoint-overview#how-to-set-up-private-link-for-azure-sql-database).","name":"ConnectionError","stack":"ConnectionError: Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (
[0] {"name":"xxxx-device-controller","hostname":"xxxxx","pid":xxxx,"level":50,"msg":"Error while attempting to complete call","time":"2020-11-17T11:37:26.852Z","v":0}
有没有办法直接在 App 服务中运行测试?或者如何建立连接
解决方案
推荐阅读
- swift - 静态@state 字符串字段
- dataframe - 如何使用 pyspark 遍历/迭代数据框?
- java - 如何为从 Gmail 服务器读取电子邮件的 Java 应用程序设计故障转移
- azure - 在 Azure 中的应用程序网关的 ARM 中获取动态 IP
- python - 关于用 Pandas 替换和 Dtypes 的说明
- php - PHP - 接收返回类作为参数的魔术方法的自动完成
- docker - 运行 Docker 后无法删除文件
- python - 多处理进程中的 Python AsyncIO
- css - 在移动版本中创建相等的列高
- c# - 使用 Post 而不是 Get 的 OData 查询