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

Job DSL runs brefore Gitea servers are loaded

XMLWordPrintable

      When using Configuration as Code to setup Jenkins with a Gitea server and a mult-branch pipeline, the Job DSL will be run before the Gitea servers are added and it will error that it cannot find the Gitea server when running the first scan, this requires you to manually scan on startup.

      Relevant jenkins.yaml:

      unclassified:
        giteaServers:
          servers:
            - serverUrl: "SERVER_URL"
              displayName: "Gitea Server"
              credentialsId: "gitea_login"
      
      jobs:
        - script: >
            multibranchPipelineJob('JOB') {
              branchSources {
                branchSource {
                  source {
                    giteaSCMSource {
                      id('12312313')
                      credentialsId('gitea_login')
                      repoOwner('USER')
                      repository('REPO')
                      serverUrl("SERVER_URL")
                      traits {
                        cloneOptionTrait {
                          extension {
                            noTags(false)
                            shallow(false)
                            reference("")
                            timeout(10)
                          }
                        }
                        wipeWorkspaceTrait()
                      }
                    }
                  }
                }
              }
              configure { node ->
                def traits = node / sources / data / 'jenkins.branch.BranchSource' / source / traits
                traits << 'org.jenkinsci.plugin.gitea.BranchDiscoveryTrait' {
                  strategyId('3')
                }
              }
            }

       Log:

      [Wed Jan 29 02:33:55 GMT 2020] Starting branch indexing...
      ERROR: [Wed Jan 29 02:33:55 GMT 2020] Could not update folder level actions from source 12312313
      hudson.AbortException: Unknown server: SERVER_URL
      	at org.jenkinsci.plugin.gitea.GiteaSCMSource.gitea(GiteaSCMSource.java:570)
      	at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieveActions(GiteaSCMSource.java:395)
      	at jenkins.scm.api.SCMSource.fetchActions(SCMSource.java:848)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:598)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:164)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:427)
      [Wed Jan 29 02:33:55 GMT 2020] Finished branch indexing. Indexing took 8 ms
      FATAL: Unknown server: SERVER_URL
      Finished: FAILURE
      

            jetersen Joseph Petersen
            thebrokenrail Connor Nolan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: