You could try something like this

node {
  withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 
'mylogin',
                    usernameVariable: 'USERNAME', passwordVariable: 
'PASSWORD']]) {
    sh '''
      set +x
      curl -u $USERNAME:$PASSWORD https://private.server/ > output
    '''
  }
}

https://www.cloudbees.com/blog/workflow-integration-credentials-binding-plugin



On Wednesday, April 20, 2016 at 2:05:57 PM UTC+3, Onno van der Straaten 
wrote:
>
> Hi,
> I changed the example pipeline script a bit to test if it would work using 
> Subversion. The repository that I want to use does not allow anonymous 
> access. Is it possible to add credentials?
> Cheers,
> Onno
>
> node {
>    // Mark the code checkout 'stage'....
>    stage 'Checkout'
>
>    // Get some code from a GitHub repository
>    svn url: 'https://mysvnurl
>
>    // Get the maven tool.
>    // ** NOTE: This 'M3' maven tool must be configured
>    // **       in the global configuration.           
>    def mvnHome = tool 'Maven 3.2.5'
>
>    // Mark the code build 'stage'....
>    stage 'Build'
>    // Run the maven build
>    sh "${mvnHome}/bin/mvn clean install"
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/69a99ec8-19b4-4cc7-a519-92e96def8d02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to