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

Checkout over SSH not working anymore after restarting jenkins

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • gitea-plugin
    • None
    • Jenkins 2.190.3
      gitea-plugin 1.1.2

      • Gitea organization configured with "Checkout over SSH"
      • Using a private key from the jenkins credential store or adding one (since "use build agents key" also not working :-/ )
      • Then it's Initially working
      • After a Jenkins restart git commands are falling back to https
      • When triggering "Scan Gitea Organization Now" it's working again till next restart

      Similar to JENKINS-46094

          [JENKINS-60331] Checkout over SSH not working anymore after restarting jenkins

          Christian Fochler added a comment - - edited

          Until there is a fix in the plugin, I setup an init hook script. The script is doing a rescan of all organizations after Jenkins starts up:

          import hudson.model.AbstractItem;
          import jenkins.model.Jenkins;
          
          for (item in Jenkins.instance.getAllItems(AbstractItem.class)) { 
            if (item instanceof jenkins.branch.OrganizationFolder) { 
              item.doBuild() 
              println("Triggered on-boot organization folder scan for " + item.fullName) 
            }
          }
          

          Christian Fochler added a comment - - edited Until there is a fix in the plugin, I setup an  init hook script . The script is doing a rescan of all organizations after Jenkins starts up: import hudson.model.AbstractItem; import jenkins.model.Jenkins; for (item in Jenkins.instance.getAllItems(AbstractItem.class)) { if (item instanceof jenkins.branch.OrganizationFolder) { item.doBuild() println( "Triggered on-boot organization folder scan for " + item.fullName) } }

          Is this a dupe of JENKINS-61996

          Stephen Connolly added a comment - Is this a dupe of JENKINS-61996

          Resolving with a status of Incomplete means that the reporter has a question to ask or missing information to provide. Please re-open if/when the answers to the questions or the missing information have been provided and there remains an open issue

          Stephen Connolly added a comment - Resolving with a status of Incomplete means that the reporter has a question to ask or missing information to provide. Please re-open if/when the answers to the questions or the missing information have been provided and there remains an open issue

          stephenconnolly: I just tested and this seems to still be an issue with the current plugin version. I'm seeing this issue with multibranch pipeline jobs and as mentioned by chrifo, doing a manual scan in Jenkins for the job 'fixes' the problem until the next restart.

          Janosch Hildebrand added a comment - stephenconnolly : I just tested and this seems to still be an issue with the current plugin version. I'm seeing this issue with multibranch pipeline jobs and as mentioned by chrifo , doing a manual scan in Jenkins for the job 'fixes' the problem until the next restart.

          Morten Kristiansen added a comment - - edited

          I have debugged this and the problem is located in GiteaSCMSource.

          It inherits jenkins.plugins.git.AbstractGitSCMSource which as has two retrieve methods that are overridden. One of the retrieve methods are called when an OrganizationFolder is scanned (and retrieves correctly repository data from Gitea and set the sshRemote variable for re-use.

          The other retrieve method is called when a Multibranch Pipeline job is executed. In this case no metadata is collected from Gitea and the sshRemote variable is not set. Hence the only way to have this set is to re-scan the OrganizationFolder.

          PR created: https://github.com/jenkinsci/gitea-plugin/pull/34

          Morten Kristiansen added a comment - - edited I have debugged this and the problem is located in GiteaSCMSource. It inherits jenkins.plugins.git.AbstractGitSCMSource which as has two  retrieve methods that are overridden. One of the retrieve methods are called when an OrganizationFolder is scanned (and retrieves correctly repository data from Gitea and set the sshRemote variable for re-use. The other  retrieve  method is called when a Multibranch Pipeline job is executed. In this case no metadata is collected from Gitea and the sshRemote variable is not set. Hence the only way to have this set is to re-scan the OrganizationFolder. PR created:  https://github.com/jenkinsci/gitea-plugin/pull/34

            Unassigned Unassigned
            catsem Christian Schmitt
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: