pipeline
{
agent { label 'master' }
stages
{
stage('check_credentials')
{
steps
{
withCredentials([usernamePassword(credentialsId: 'c1', usernameVariable: 'uname', passwordVariable: 'upass' )])
{
sh '''
echo "usernamePassword = $uname $upass" > test.txt
'''
}
withCredentials([usernameColonPassword(credentialsId: 'c1', variable: 'uname')])
{
sh '''
echo "usernameColonPassword = $uname" >> test.txt
'''
}
withCredentials([string(credentialsId: 't1', variable: 'TOKEN')])
{
sh '''
echo "string = $TOKEN" >> test.txt
'''
}
sh 'cat test.txt'
}
}
}
}