Hello, my Jenkins is setup on ECS Fargate. We trigger builds using Jenkins ECS Plugin which launches a docker agent and runs jobs on it. The issue sounds similar where it seems to keep picking the Master Role rather then the Agent Role with Codebuild Plugin.
When I run sh 'aws sts get-caller-identity'. I get the right role information. As soon as I run the Codebuild plugin, it starts seeing the Master Role. Not sure how Codebuild plugin is picking up Master Role when running "aws sts get-caller-identity' right before shows the correct Agent Role.
JadyLiu had a similar issue here #16.