Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

This page is intended to centralize troubleshooting info about the ScmSyncConfiguration plugin configuration.

Lots of configuration types can be encountered, and lots of tricks can be made to help diagnose where the problem is.

First of all ...

Declare a logger for ScmSyncConfiguration plugin

To do so, just go to to the Jenkins System configuration screen, then on the System log section.

Here, create a new Log recorder with the name you want (for example : scm_sync_configuration) with logger hudson.plugins.scm_sync_configuration and log level all.

Save your logger.

Starting from here, everything logged by ScmSyncConfiguration plugin will be recorded in this logger (unfortunately, you cannot get back in the past for diagnosing previous problems : this is the reason why you should ensure you have the logger settled up before doing anything, in case you face problems).

Ensure you can access your Scm repository from Jenkins

There is a simple thing you can do to ensure you're repository is accessible from Jenkins (for various reasons, you could miss things like networks limitations, proxies or firewall).
To be sure you can access your repository, the easiest thing is to configure a temporary Jenkins job which will checkout your repository and echo an "Hello world".

To do this, create a new Freestyle Job and :

  • Ensure your job is run on your Jenkins master node (this is important : ScmSyncConfiguration plugin will be ran on the master only !)
  • Select your desired scm (svn for example) and configure the same url in the job you would configure in the Jenkins system page
    For example :

  • Eventually, you will be prompted to enter credentials for your repository (see previous screenshot). If this is the case, enter the credentials you will use and store them in Jenkins.
    Once done, you could be able to edit the <JENKINS_HOME>/hudson.scm.<YOUR_SCM> (for example : /var/lib/jenkins/hudson.scm.SubversionSCM.xml) to see if your repository url realm's credentials are there.
  • Then create a simple echo "hello world" bash script build step on your job.
  • Once done, you should be able to run your job. Verify that Jenkins succeeds to checkout sources located at http://path/to/repository/where/you/want/to/store/your/jenkins/config and then, echo "hello world"
    If so, you can freely remove the temporary job.

If everything goes well, go to the Jenkins global configuration screen, and configure ScmSyncConfiguration plugin, it should be ok !

If you use Git then you should use SSH key with default name. It's "id_rsa". SCM Sync does not have option to specify ssh key path. SCM Sync uses .ssh/id_rsa from home directory of the jenkins process owner.

  • No labels

11 Comments

  1. Unknown User (chantivlad)

    Hi,

    thank you firstly for the great work, i think this is what i need.

    I have 2 questions:

    * do you have an updated documentation on how to configure/use your plugin with a git repo + the requirements concerning this git repo?

    * is there a way to revert the backed up config files and reload them through the plugin ? For example someone screwed up the configuration of a job, i want to be able to use the plugin to revert to the version before his change.

    Thanks in advance for your answers

  2. Unknown User (chantivlad)

    Hi,

    let me share my experience with the 0.0.6 (on Jenkins 1.482) which is really good.

    I created an empty bare git repo: user@host:/some/path$ git init --bare --shared jenkins_config.gitThen under  "Manage Jenkins" -> "Configure System" -> "SCM Sync configuration" -> "SCM" -> "Git" -> "Repository URL", i made following tests:/some/path/jenkins_config.git : This works as the repo is accessible directly from the file system as an NFS share where the Jenkins server runs.
    ssh://host/some/path/jenkins_config.git : This works
    user@host:/some/path/jenkins_config.git : This does not work
    Is this expected behaviour?

    Checking out the repo with user@host:/some/path/jenkins_config.git worked fine in my ScmSyncConfiguration test job

  3. Unknown User (djin)

    I'm using 0.0.6 with jenkins 1.466.2, and I continue to have errors...

    [INFO] SVN commit directory: /var/lib/jenkins/scm-sync-configuration/checkoutConfiguration
    Sep 28, 2012 10:33:22 PM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    SEVERE: [checkinFiles] Problem during SCM commit : svn: E175002: Commit failed (details follow):
    svn: E175002: OPTIONS /svn/ms/breeze/jenkins/checkoutConfiguration failed
    Sep 28, 2012 10:33:22 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness processCommitsQueue
    SEVERE: Error while processing commit queue : Error while checking in file to scm repository
    

    I noticed this odd looking URL in scm-sync-configuration.xml. Is this the cause of my problem? If so what should it look like?

    <scmRepositoryUrl>scm:svn:https://svn2.assembla.com/svn/ms/breeze/jenkins/</scmRepositoryUrl>
    

    Thank you for your assistance in this matter.

    ...s

  4. Unknown User (bedge)

    What's the procedure for restoring a deleted job?

    Note, I just want one job back, not a full restore.

    1. Unknown User (bedge)

      I ended up digging the missing config.xml out of the git repo and manually copying it on top of a new empty job I created through jenkins then relaoding the config from disk.

      I strongly believe that this job that was accidentally purged was deleted by this scm plugin. There were no other mentions in the jenkins logs of this job, other than the scm delete messages. 

      Here's a sample of the suspect messages:

      INFO] Executing: /bin/sh -c cd /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs && git rm -r Content-build-cb-webapp-v4
      [INFO] Working directory: /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs
      Jul 01, 2014 1:47:06 PM hudson.plugins.scm_sync_configuration.SCMManipulator deleteHierarchy
      SEVERE: [deleteHierarchy] Problem during remove : The git command failed.
      [INFO] Executing: /bin/sh -c cd /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs && git rm Content-build-cb-webapp-v4
      [INFO] Working directory: /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs
      Jul 01, 2014 1:47:08 PM hudson.plugins.scm_sync_configuration.SCMManipulator deleteHierarchy
      SEVERE: [deleteHierarchy] Problem during remove : The git command failed.
      [INFO] Executing: /bin/sh -c cd /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs && git rm Content-build-cb-webapp-v4
      [INFO] Working directory: /u0/jenkins/scm-sync-configuration/checkoutConfiguration/jobs
      Jul 01, 2014 1:47:08 PM hudson.plugins.scm_sync_configuration.SCMManipulator deleteHierarchy

      there were dozens of the in the jenkins.log and there was no user action to delete this job.

      I'm open to suggestions to try to diagnose this.

  5. Unknown User (brianswilson)

    I got bit by the https://issues.jenkins-ci.org/browse/JENKINS-32124 bug (UI disappears after restart in version SCM Sync 0.0.9) in both Windows and Linux Jenkins instances.  This is definitely not a nice bug and can be difficult to trace since it only manifests on restart.  Initially the plugin works as expected and the config.xml files are stored in our Subversion repository as expected.  If you restart the Jenkins instance, the UI vanishes.  If you configure the plugin to use a repository, save the changes, and change the plugin status from using the repository back to "None" you can restart the system and the UI is still present.

    Upon further testing and some file differencing (thank heavens for BeyondCompare) I was able to restore the UI by making manual changes to the hudson.scm.SubversionSCM.xml and scm-sync-configuration.xml files.  The process I used is as follows (I used Linux, but this can be done on Windows as well):

    *  Exit the currently running Jenkins instance (e.g.  http:.../exit, kill -15, kill -9, whatever works).\

    * Open a command shell on the Jenkins server.

    * Become (i.e. change user to) the Jenkins process owner id.

    * Change directory to the Jenkins instance home directory (can't give you exact location because this is user installation dependent; but /data/jenkins or C:\jenkins is often used).

    * Copy the scm-sync-configuration.xml file to scm-sync-configuration.bak (you will want this later).

    * Open the scm-sync-configuration.xml file in a text editor.

    * Change the following lines:

      <scm/>

      <scmRepositoryUrl>scm:svn:https://svn.autotrader.com/svn/jenkins_admin/branches/taxi49427</scmRepositoryUrl>

        to just:

      <scm/>

    * Copy the hudson.scm.SubversionSCM.xml file to hudson.scm.SubversionSCM.bak (you will want this later also).

    * Open the hudson.scm.SubversionSCM.xml file in a text editor.

    * Change the following lines:

      <credentials>

        <entry>

          <string><https://svn.XXXX.com:443> (https://svn.xxxx.com:443>); CollabNet Subversion Repository</string>

          <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential>

            <userName>XXXXX</userName>

            <password>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=</password>

          </hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential>

        </entry>

      </credentials>

        to just:

      <credentials/>

    * Restart the Jenkins instance.

    Once I did this, I could see my UI again (but didn't have the SCM Sync configured any more of course) and could restart Jenkins with no further issues.

    To install the 0.0.8 SCM Sync plugin (or any other plugin for that matter) do the following process.

    * Exit the currently running Jenkins instance  (e.g.  http:.../exit, kill -15, kill -9, whatever works).

    * Change directory to the Jenkins instance home "plugins" subdirectory (still as the Jenkins process owner id).

    * Open the SCM Sync Archive (http://updates.jenkins-ci.org/download/plugins/scm-sync-configuration/).

    * Record the URL for the file version needed.   You can save the URL to download from in Windows by right clicking and selecting the "Copy Link Address..." menu option.

    * Copy the scm-sync-configuration.?pi file to scm-sync-configuration.bak

    * Download the scm-sync-configuration.hpi file (e.g. wget http://updates.jenkins-ci.org/download/plugins/scm-sync-configuration/0.0.8/scm-sync-configuration.hpi) to the plugins subdirectory.

    * Start the Jenkins instance.

    * Verify the SCM Sync version shown is the one expected.

    * Restart the Jenkins instance to verify the issue is resolved.

    You can restore your previous SCM configuration information by doing the following.

    * Change directory to the Jenkins instance home directory (e.g. cd ..).

    * Copy the scm-sync-configuration.bak file to scm-sync-configuration.xml.

    * Copy the hudson.scm.SubversionSCM.bak file to hudson.scm.SubversionSCM.xml

    * In the UI console, go to "Manage Jenkins and select the "Reload Configuration from Disk" option.

    * Go the the "Manager Jenkins", "Configure System" screen and verify the SCM Sync configuration has been restored.

    * Restart the Jenkins instance to verify the issue remains resolved.

    You should now see the previous version of the plugin is installed (don't update until this issue is resolved) and still have the Jenkins SCM Sync plugin configured and working.. This worked for me (using Jenkins 1.645).  I hope it works for others as well.

  6. Unknown User (generatz)

    @chanti vlad:

    I had same experience.

    It seems you must specify the protocol, whether it be ssh:, file:,  or http:/https:. Unfortunately, this is not well documented. So, for example:

    ssh://jenkins@hostname:/gitRepos/jenkins_cfg.git and not just jenkins@hostname:/gitRepos/jenkins_cfg.git

  7. Unknown User (samliddicott)

    After configuration errors; you might then get this in your log messages:

    Checking out SCM files into [/var/lib/jenkins/scm-sync-configuration/checkoutConfiguration] ...
    
    [checkout] Error during checkout : The git-clone command failed. || fatal: destination path '/var/lib/jenkins/scm-sync-configuration/checkoutConfiguration' already exists and is not an empty directory.

    So the answer is to rename-away the destination path and then try again.

     

  8. Unknown User (brandonpinske)

    WORKING AS OF FEB 20 2018

    Just got this working myself after a lot of misery.

    You need a github account that has write access to the repository you have chosen. Create a personal access token https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

    The remote repository should look something like this under https://i.imgur.com/uZhsQGJ.png
    https://<token>@github.com/org/jenkins_config.git

    Then log in to jenkins and under $jenkins_home/<repo_name> you need to issue two commands.Where github and github@domain.com are the credentials for the github account with the write access to your github repo.

    cd /var/jenkins_home/jenkins_config

    # git config user.name "github"
    # git config user.email "github@domain.com"

     


    If you use the jenkins helm chart for Kubernetes you can get a shell on a pod like this.

    k exec -it -n jenkins jenkins-jenkins-ff8f4db7c-8l96n -- /bin/sh

     

     

    This plugin sucks.

  9. Unknown User (kstutz1)

    We had the problem that the sync was not working due to missing Git global user.

    We put the following lines:

    [user]

    name = <GIT-USER>

    email = <GIT-EMAIL>

    into the following file:

    JENKINS_HOME/scm-sync-configuration/checkoutConfiguration/.git/config

    This finally worked.

    Cheers,

    Kathi

  10. Unknown User (robertoschwald)

    Is it possible to exclude certain Projects from SCM sync?

    I use the Job Generator plugin to generate / update several (currently 20) Jobs from a template job. On every run, the jobs get updated with the branch name, which pollutes the scm sync git repo with commits.