Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59751

Projects Created Through Pipeline DSL Plugin Do Not Pass Credentials Correctly When Connecting to Github

XMLWordPrintable

      When I create a project through the pipeline DSL plugin (code snippet below is for a multibranch pipeline) the credentials I created are not passed correctly through to Github and authentication fails.

      Once I navigate to the newly created project and click "Configure" and then "Save" the configuration, Jenkins then scans Github successfully and everything works as expected.

      I would like to spin up Jenkins completely through Chef and Groovy DSLs so that no manual intervention (like having to click "Save") is required.

      Here is the DSL script I'm using:

      UUID uuid = UUID.fromString("dd847135-8391-4f66-a54c-7f8781dc3119")
      multibranchPipelineJob('test3') {
        displayName "test3"
        description "test3"
        branchSources {
          github

      {       id(uuid.toString())        scanCredentialsId('gitusername_password')        repoOwner('my_user')        buildForkPRMerge(false)        repository("my-repo.git")     }

        }
      }
      queue("test3")

      Here is the relevant portion of the logs:

      [Fri Oct 11 14:56:44 UTC 2019] Starting branch indexing...
      14:56:44 Connecting to https://api.github.com using my_user/****** (gitusername_password)
      ERROR: [Fri Oct 11 14:56:45 UTC 2019] Could not update folder level actions from source dd847135-8391-4f66-a54c-7f8781dc3119
      hudson.AbortException: Invalid scan credentials when using my_user/****** (gitusername_password) to connect to my_user/my-repo.git on https://api.github.com

       

      My Jenkins version is: 2.190.1

      Job DSL Plugin version: 1.76

      OS:

      Operating System: Amazon Linux 2
      CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2
      Kernel: Linux 4.14.138-114.102.amzn2.x86_64

            phlogistonthegr8 Aaron Franssell
            phlogistonthegr8 Aaron Franssell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: