Reputation: 7620
I am trying to run python script which has code to access s3 using boto3 sdk. I have created default profile in my windows machine.
I am trying to automate it through jenkins. It is failing and complaining about Invalid token.
For testing purpose i ran following command in jenkins job.
aws sts get-caller-identity --debug
ClientError: An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid 2019-06-17 18:09:06,513 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid Build step 'Execute Windows batch command' marked build as failure
I tried following
injecting AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_ACCESS_KEY_ID, but no success.
Added S3 profile plugin in jenkins and tried both option IAM role and by providing access token and secret.
Its not working.
I observed that jenkins is running on System User but i have created profile in window user.Is this the problem ?
Upvotes: 2
Views: 1481
Reputation: 2823
The issue was with the USERPROFILE with which jenkins was running.
The default user profile creds were not loaded because the configurations was done for local user and not SYSTEM USER.
Adding .credentials under SYSTEM USER Jenkins worked fine.
Upvotes: 2