Running scripts asynchronously in Azure DevOps

Viewed 46

I am implementing a pipeline where I want to deploy a lambda to SAM and then be able to hit the endpoint that was started, the problem is that when the pipeline runs the sam start local-api it succeeds but keeps waiting forever:

This is the steps that creates the YAML to run SAM:

  - script: |
      yarn local
      yarn sam:dev-api
    displayName: "SAM Deployment"
    workingDirectory: api-generator/helloworld-api

And here you can see how it gets stucked waiting for the ednpoint to be hit of pressing ctrl + c:

enter image description here

Is there a way in which I can run the sam start command and the continue the pipeline to test the endpoint (kind of a sam start non-blocking run)? or a tool recommended to kind of run a virtual bash that can run several instances at the same time in Azure DevOps?

Thanks in advance!

1 Answers

I suggest you can set a limit to end 'deployment part' in time and do other automation after that. An example:

trigger:
- none

pool:
  vmImage: ubuntu-latest

jobs:
- job: A
  timeoutInMinutes: 1 #Use this to end the deployment part, set the value based on your situation.
  displayName: Deployment
  steps:
  - bash: |
      echo "A"
      vi README.md
      #The deployment logic here, and stuck in this place.

- job: B
  continueOnError: true
  condition: always() #Use this to start the test step
  dependsOn: A
  displayName: Test
  steps:
  - bash: |
      echo "B"
      #The test logic here.
Related