jenkinsci / ec2-fleet-plugin

The EC2 Fleet plugin launches EC2 instances as worker nodes for Jenkins CI server, automatically scaling the capacity with the load.
https://plugins.jenkins.io/ec2-fleet/
Apache License 2.0
111 stars 81 forks source link

3.10.0 does not assume role from credentials #420

Open sneely333 opened 1 year ago

sneely333 commented 1 year ago

Issue Details

AWS Credentials plugin allows you to identify credentials or a role to assume and store them in Jenkins Credentials. In the ec2-fleet-plugin < 3.10.0, you can set a role in Credentials (utilizing AWS Credentials plugin). Specify these credentials for the ec2 fleet and the plugin will assume the correct role.

In 3.10.0, the plugin does not recognize IAM roles to be assumed in the credentials and will fail with permission errors.

Example: Account A runs jenkins with an instance role that permits 'assumerole' to Account B credentials. Jenkins Credentials are configured to identify Account B role and ec2 fleet plugin set to use this credential. In 3.10.0, when this is done, the plugin tries to use the account A instance role (i.e. no assumerole is run) In =<3.0.2, when this is done, the plugin assumes Account B role and works correctly

Downgrading to 3.0.2 fixes the issue. Upgrading to 3.10.0 breaks it immediately.

To Reproduce

  1. utilize AWS Roles in Credentials
  2. upgrade to 3.10.0
  3. attempt to access asg via role credentials etc.

Environment Details

Plugin Version? 3.10.0

Jenkins Version? 2.430

Spot Fleet or ASG? ASG

Label based fleet? <Yes/No>

Linux or Windows? Linux

EC2Fleet Configuration as Code Paste only eC2Fleet part from plugin configuration. Mask all security concerning details. You can download it from Manage Jenkins > Configuration as Code > Download Configuration

Anything else unique about your setup? No