简体   繁体   English

在 windows 图像上使用 Azure DevOps 管道运行 Azurite

[英]Run Azurite with Azure DevOps Pipelines on windows image

I'm trying to run and connect to azurite from Azure DevOps pipelines.我正在尝试从 Azure DevOps 管道运行并连接到 azurite。 This is how my pipeline looks like这就是我的管道的样子

trigger:
  - '*'

stages:
  - stage: 'test'
    displayName: 'test'
    jobs:
     - job: 'Build_job'
       displayName: 'Build job'
       pool:
         vmImage: 'windows-2022'
       steps:
              
          - task: NodeTool@0
            displayName: 'Use Node.js'
            inputs:
              versionSpec: '16.*'

          - task: PowerShell@2
            displayName: 'Install and launch Azurite'
            inputs:
              targetType: 'inline'
              script: |
                npm install -g azurite 
                mkdir c:/azurite
                Start-Job -ScriptBlock { azurite --silent --location c:\azurite --debug c:\azurite\debug.log  }
              pwsh: true

          - task: PowerShell@2
            displayName: 'Check Azurite availability'
            inputs:
              targetType: 'inline'
              script: |
                curl 127.0.0.1:10000
                curl localhost:10000
              pwsh: true

It fails on the availability check.它在可用性检查中失败。 在此处输入图像描述

The same pipeline works fine on the ubuntu image, but my project has some dependencies on Windows. How can I connect to azurite on windows image?相同的管道在 ubuntu 图像上工作正常,但我的项目对 Windows 有一些依赖性。如何连接到 windows 图像上的 azurite?

As you use the shared Microsoft windows agent you cannot perform ports connectivity as it is prohibited from Microsoft for these resources.当您使用共享的 Microsoft windows 代理时,您无法执行端口连接,因为 Microsoft 禁止这些资源。 You will need to install the tooling on a private agent to perform the same tasks.您将需要在专用代理上安装该工具才能执行相同的任务。

You can verify this by taking the output from.netstat about listening ports.您可以通过从 .netstat 获取有关侦听端口的 output 来验证这一点。

netstat -ano | findstr "LISTENING"

在此处输入图像描述

Attaching same answers:附上相同的答案:

How to open TCP port on localhost on VSTS build agent? 如何在 VSTS 构建代理的本地主机上打开 TCP 端口?

Azure Devops azure pipelines agents TCP connection failing Azure Devops azure 管道代理 TCP 连接失败

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM