Search code examples
azure-pipelinesazure-pipelines-release-pipelineaws-ssm

Azure Release Pipeline task on AWS System Manger succeeds even when the job is in execution in background


I have AWS-Toolkit extension installed on Azure. In Azure Release pipelines, I have configured the System Manager Run Command task for executing a python script on a ec2-instance. The problem is that as soon as the SSM - Run command task is triggered, it gives "succeess" status (in 1 second) and moves on to perform next task in the stage. However, the job is still in execution on ec2-instance.

I want to know how should i make azure pipeline task to wait till the execution is really over and then provides the appropriate status of the script it executed.

For the same invocation on AWS SSM console, it shows the job(script) is in execution. Is this an issue with azure pipeline? my rest of the AWS tasks seems to be working fine in azure pipeline.

Note: Pipeline tasks are configured correctly as needed(since its doing what its supposed to do). Only issues is that this task should wait till job completion.

Edit 1: Adding the task performed in pipeline for more clarity:

  1. Spin up an EC2 using Terraform
  2. Get the code from repo and publish it (using Publish Artifact tasks)
  3. Archive (create zip) and then Upload it to S3
  4. Use AWS CodeDeploy service to get the code from S3 and "Install" it on the launched EC2 and then run some "After-Install" Scripts using CodeDeploy Hooks.
  5. Execute another script through SSM ( as it may take hours to complete, hence cant do it via CodeDeploy Hooks which has max timeout of 3600 )
  6. Once the script execution is done, use terraform destroy to terminate the instance.

Solution

  • Azure Release Pipeline task on AWS System Manger succeeds even when the job is in execution in background. Is this an issue with azure pipeline?

    It's not issue with azure pipeline. Try using official CMD task to run your python script. The official CMD task won't show Success status unless the script is executed successfully without error. (Your expected behavior.)

    Instead I think it's the issue of the third-party task itself. Azure Devops supports developing custom extensions, if you meet the issue from the task itself, you should try to contact the author of the third-party extension.

    You can try to contact them via the issues here. And here's one open issue related to that task, which is similar to the behavior you met. I suggest you track the issue there and ask for any update for that feature-request.