Skip to content

Instantly share code, notes, and snippets.

@gouravtiwari
Created May 1, 2018 05:05
Show Gist options
  • Save gouravtiwari/e3d0381ddb4b82cc275f5588f71af239 to your computer and use it in GitHub Desktop.
Save gouravtiwari/e3d0381ddb4b82cc275f5588f71af239 to your computer and use it in GitHub Desktop.
Get task definition via Ruby thread in shell of Jenkins job
SERVICES=`aws ecs list-services --cluster ABCD`
CLUSTER="ABCD"
ruby <<EOM
require "open3"
ecs_service_name = 'abcd-ecs-service-stack-ABCDApplication-XXXXXXXXXXXXX'
puts ecs_service_name
# sleep 2
task_definition = Open3.popen3("aws ecs describe-services --cluster $CLUSTER --services #{ecs_service_name} --query services[*].taskDefinition --output text"){ |i, o| p o.read }
puts "task_definition: #{task_definition}"
EOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment