简体   繁体   中英

Run Azurite with Azure DevOps Pipelines on windows image

I'm trying to run and connect to azurite from Azure DevOps pipelines. 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?

As you use the shared Microsoft windows agent you cannot perform ports connectivity as it is prohibited from Microsoft for these resources. 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 -ano | findstr "LISTENING"

在此处输入图像描述

Attaching same answers:

How to open TCP port on localhost on VSTS build agent?

Azure Devops azure pipelines agents TCP connection failing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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