Question about credentialsId in marathon request

16 views
Skip to first unread message

Samuel Mutel

unread,
Feb 14, 2018, 4:38:02 AM2/14/18
to Jenkins Users
Hello,

In the jenkins documentation I found this way to specify the credentials in marathon deployment:
credentialsId: '{"uid":"jenkins","login_endpoint":"https://leader.mesos/acs/api/v1/auth/login","scheme":"RS256","private_key":"-----BEGIN RSA PRIVATE KEY-----\nMIIEpAI..."}'

It works fine but ... is it possible to store these credentials in the credentials part of jenkins and use a credential id in the pipeline?

Thanks.
Regards.

Samuel Mutel

unread,
Feb 15, 2018, 3:21:34 AM2/15/18
to Jenkins Users
I found a way with "withCredentials" function ...

withCredentials([
 
string(credentialsId: 'XX-XX-XX-XX-XX-XX', variable: 'DCOS_PRIVATE_KEY')
]) {
  marathon
(
    url
: 'http://XX.XX.XX.XX:8080',
    forceUpdate
: false,
    credentialsId
: '{"uid":"cicd","login_endpoint":"${env.DCOS_ENDPOINT}","scheme":"RS256","private_key":"$DCOS_PRIVATE_KEY"}',
    filename
: 'Marathon.json'
 
)
}
Reply all
Reply to author
Forward
0 new messages