Skip to content

Conversation

@hugo4715
Copy link

Correctly detect and handle AWS partition (aws, aws-cn, aws-us-gov) from role ARNs when assuming roles. This ensures that region selection aligns with the appropriate partition defaults.

Closes #121

Testing done

Tested and validated on Jenkins LTS 2.516.1

Steps done:

  • Add an AWS key pair in the jenkins credentials page, in advanced specify an IAM role with a china arn in format "arn:aws-cn:iam::$ACCOUNT:role/$ROLE"
  • Observe the credentials page correctly find the key pair is working in china
  • Validate the pipeline can get valid credentials from AWS china

The following snippet was used:

withCredentials([aws(accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'jenkins-china', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')]) {
    sh 'env'
    sh 'aws sts get-caller-identity'
    sh 'aws s3 ls'
}

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Correctly detect and handle AWS partition (aws, aws-cn, aws-us-gov) from role ARNs when assuming roles. This ensures that region selection aligns with the appropriate partition defaults.

Closes jenkinsci#121
@hugo4715 hugo4715 force-pushed the fix-partition-detection branch from 25279af to 9716cb0 Compare August 11, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support for STS Endpoints in AWS Non-Commercial (China / GovCloud) Partitions

1 participant