How to pass down variables to credential parameters in JenkinsFiles?
So after testing different things a friend solved this in sub 5 minutes. Quotation mark types matter in Groovy Script
Changing
sshagent (credentials: ['${params.SSH_lower}']){
To
sshagent (credentials: ["${params.SSH_lower}"]){
Solved the issue.
Better to use environment step in pipeline.
pipeline { agent any environment { AN_ACCESS_KEY = credentials('an_access_key_id') } stages { stage('Example') { steps { sh 'printenv' } } }}
And credentials should exist in jenkins with id an_access_key_id
Take a look at official documentation here