Home > OS >  Azure DevOps Pipeline Capture Output of AWS CLI Task to use in next Task
Azure DevOps Pipeline Capture Output of AWS CLI Task to use in next Task

Time:09-25

I'm deploying a Lambda layer via the AWS CLI Task type and I'd like to capture the output this AWS CLI command so that I can grab the version # and use it as a variable in the next task.

enter image description here

I was hoping to use Output Variables but that doesn't seem to do the trick. Is this feasible with my current setup?

CodePudding user response:

I'm not sure about this task, but if you use regular CLI commands than you can use variables:

steps:
- bash: |
    step_function_state=`aws stepfunctions list-executions --state-machine-arn $(stateMachineArn) --status-filter RUNNING |  jq -r '.executions[]|.status' | head -1`
    echo "State machine RUNNING status: ${step_function_state}"
    echo "##vso[task.setvariable variable=sfs;]$step_function_state"
  displayName: "Test Script"
  env:
    AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
    AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)
    AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
  • Related