Pipeline hangs after starting Azurite

Viewed 287

Hanging pipeline

I used the following yml content. Used Azurite 3.15 and 3.9. But no luck. Then I tried as separate jobs. Still unable to pass the integration test.

 stages:
    - stage: Publish
      displayName: 'Build and Publish Artifacts'
      jobs:
      - job: 'NGKMediaManagementAPI'
        steps:
        - task: NodeTool@0 
          inputs:
             versionSpec: 13.x
        - script : npm install -g azurite@3.9.0
        - script : mkdir azurite
        - script : azurite
2 Answers

Solved the hanging issue and Passed the Init tests(based on Azurite) in pipeline. use the following command in your yml file. Most importantly start /B azurite will remove the hanging issue !!!

 - task: NodeTool@0 
      inputs:
         versionSpec: 13.x
    - script : npm install -g azurite
      displayName: Install Azurite
    - script : start /B azurite
      displayName: Start azurite

below is success the pipeline enter image description here

When starting Azurite, the default is for it to block the command prompt you're running it on which makes the pipeline appear to hang.

Run the command from PowerShell and Use the background operator to start a background job.

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      npm install -g azurite
      azurite &

More information: Run automated tests by using Azurite - Run tests on Azure Pipelines. In this example they use the & operator in Bash which also directs the shell to run the command in the background.

Other interesting commands around this are Get-Job, Stop-Job and Remove-Job.

Related