Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg infamousjoeg/Jenkinsfile
Last active Jun 26, 2019

Embed
What would you like to do?
Example of using cURL to list Conjur resources in a Groovy DSL Jenkinsfile
pipeline {
agent { label 'master' }
environment {
def loginToken = '3m184cf1ygzfcd24ct5a93wwjzfwm4r2gx36vykyc2er5qz01se0th3'
def username = 'dba01'
def auth_token = sh (script: "curl -k --data ${env.loginToken} https://master1.yoba.net/authn/Kramerica/dba01/authenticate | base64 | tr -d '\\r\\n'", returnStdout: true).trim()
//println("curl returned: ${auth_token}")
}
stages {
stage('Get Resources') {
steps {
script {
//What it should look like...
//def response = sh(script: 'curl -k -H "Authorization: Token token=\'eyJwcm90ZWN0ZWQiOiJleUpoYkdjaU9pSmpiMjVxZFhJdWIzSm5MM05zYjNOcGJHOHZkaklpTENKcmFXUWlPaUk1TmpWbE5tUTVOR1l5Wm1Fek16TmhPRGRtTXpJME5qYzNaVGRWm1KaVl5SjkiLCJwYXlsb2FkIjoiZXlKemRXSWlPaUpWW1Fd01TSXNJbWxoZENJNk1UVTJNVFUxTkRMU5IMD0iLCJzaWduYXR1cmUiOiJSZTN1ZE1ZSdTUVVzNHByUm13T3lJMkVvcC11eThpZ2tOT2pZUElWZkpEXzhsdUN1Vkw2UkJEaVk5a3BZTThXdUtIbktxWU9YbTZJZRpUDVHaUxhTERoY2QwVUFkSm9hNM1X2JHdHpDRkMwMEpwdzdTRh4RkVOWWVPNlFqdF9lMUtKZFlvVjdjZ3Y1R0IzQ2xNZ0MyRjI0Tl9wUlZOYlpNYkg4ZzZZdFpzWW80d1BtbG9TT3lWN0dTDZDM01CY2E5MFBHem81Y0Z3UEFadWlUUjhpcXhVS0QzU1RFNVhsRXF1X0heVozZmV6bHd6dFNVNVNGT2lOODlldW9JMWRjLXk3cG5JS3hQekNMOFBZZGJhcWNoT1VlU1ZpVFNBS3RXZmRPcmtaWDQ0TGVZTHNyMG5oMFhGTEthemZUd05hT2hYS2hxTlJPclJ2Y3ltVVM2TWlWQkExVUFMbmRhcVh2dUY1eVFoZXFwT0xTV0tyWmpIVF9MT0ViWFNaTE8ifQ==\'" https://master1.yoba.net/resources/Kramerica/', returnStdout: true)
def response = sh(script: "curl -k -H 'Authorization: Token token=\'${env.auth_token}\'' https://master1.yoba.net/resources/Kramerica/", returnStdout: True)
echo '=========================Response===================' + response
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.