Jenkins global AWS credentials not working via `withAWS` step
The error message indicates the credentials named "jenkins" do not exist:
java.lang.RuntimeException: Cannot find Jenkins credentials with name jenkins
The pipeline step that uses the "jenkins" credentials is:
withAWS(credentials:'jenkins') {
// DOES NOT WORK!
s3Upload bucket: "my-bucket", path: "foo/text.txt"
}
According to the documentation for the "withAWS" pipeline step, https://jenkins.io/doc/pipeline/steps/pipeline-aws/#withaws-set-aws-settings-for-nested-block, the credentials should be a type of "Username/Password" credentials.
credentials (optional)
Use standard Jenkins UsernamePassword credentials. Note: the username
should be your Access Key ID, and the password should be the Secret Access Key.
The credentials screenshot shows an "AWS" credentials type with "Access Key ID" and "Secret Access Key" fields.
Create a new credential type of "Username/Password" and use it with the withAWS
pipeline step.
I think you are writing your credentials in a different way than I. This way it should work for you.
withAWS(region: 'us-east-2', credentials: 'Nour') {
s3Upload(file: 'generate.html', bucket: 'nouran.portfolio', path: 'generate.html')
}