Skip to end of metadata
Go to start of metadata

Introduction

Syncs configuration files to a SCM repository and tracks changes done to them

Plugin Information

View SCM Sync Configuration on the plugin site for more information.

SCM Sync Configuration Jenkins/Hudson plugin is aimed at 2 main features :

  • Keep sync'ed your config.xml (and other ressources) jenkins/hudson files with a SCM repository
  • Track changes (and author) made on every file with commit messages

ATTN: JENKINS-32124 details an issue with the 0.0.9 version causing the UI to appear blank after Jenkins restart in both Windows and Linux environments.

Installation

To install SCM Sync Configuration Plugin, Go to the "plugin management" section in the administration Panel.
Latest released version will be available. Install it from there (you should need to restart Jenkins/Hudson after that).

To verify that the plugin is well installed, go to the Administration panel, then in the "System configuration" section : you should notice a "SCM Sync Configuration" section :

Usage

On the System configuration panel (seen above), you'll be prompted for a SCM type (as of this writing, Subversion or Git) and a repository URL for your SCM type.

When you'll complete this form section, and validate the form, the SCM Sync Configuration will compute every configuration file he is able to synchronize, and commit them, for initialization, on your SCM repository.
Warning : This first step can take a few minutes !

Once initialized, every time you'll submit a configuration view that can be sync'ed by the SCM Sync Configuration plugin, you'll be prompted for a comment that will be put on the commit message on your SCM Repository.

For now, supported configuration files are the following ones :

  • Job configuration files (/jobs/*/config.xml)
  • Global Jenkins/Hudson system configuration file (/config.xml)
  • Basic plugin configuration files (/hudson*.xml, /scm-sync-configuration.xml)
  • User-defined manual includes (see this dedicated page)

But more default configuration files are planned ! (see the Product Backlog for further informations)

On every pages, you will have some scm sync config status at the bottom of the page, saying if something went wrong :

Warning

To use a Git server with SSH, you have to accept the server SSH key before using the plugin (same for using Git in Jenkins jobs).

Troubleshootings

A page dedicated to Scm Sync Configuration troubleshoots has been created. Don't hesitate to participate on it by telling your stories.

What is synchronized, and when

Constraint

Target Configuration family

Target configuration files

Modes

version >= 0.0.1

Job & children configuration

/job/*/config.xml

Creation, Update

version >= 0.0.2

Jenkins/Hudson System configuration

/config.xml

Creation, Update

version >= 0.0.5

Jenkins configuration files located directly in JENKINS_HOME

/hudson*.xml

Creation, Update

version >= 0.0.6

Manual user-defined includes

Whatever you want

Creation, Update

version >= 0.0.7.2

Users config files

/users/*/config.xml

Creation, Update

Known issues

type key summary

Data cannot be retrieved due to an unexpected error.

View these issues in JIRA

Product backlog

When I am...

I should be able to ...

More details ...

Implemented ?

An administrator

Globally : Provide auth parameters to several SCM repository
types : subversion, cvs, git etc...

Jenkins/Hudson configuration files will be sync'ed with this
repository

Done !

An administrator

Globally : Tell what types of configuration files will be sync'ed :
job configurations, system configuration, views configurations,
user profiles

Each configuration type should be represented by
 a specific strategy

Not yet

An administrator

Globally : Should decide to initialize SCM repository with every current configuration files

 

Done !

An administrator

Globally : Should decide to retrieve (and override) every sync'ed
files (on initialization step for example)

 

Coming soon !

An administrator

Globally : call a REST-like URL allowing to commit files with a
comment from outside of Jenkins/Hudson behaviour

For example, when using groovy scripts which
modify config files

Not yet !

An administrator

Globally : Could check a "read-only" field allowing, for an
jenkins/hudson instance, to mirror another jenkins/hudson instance configuration

Read only flag will implies to never commit anything
(and don't prompt for commit message) but config
file update will be performed either automatically, or manually

Not yet

A privileged* user

Per type of sync'ed configuration file : Check if current file is
up-to-date with HEAD revision of the file in the SCM repository.

If not, propose to checkout last revision of the file
from the SCM repository, and replace the current one!

Coming soon !

A privileged* user

Per type of sync'ed configuration file : When submitting form,
input a commit message saying what sort modifications has
been done on form

New version of the file will be commited on SCM.
Current user id & message will be used in the commit
 message

Done !

A privileged* user

Per type of sync'ed configuration file : Consult commit history
for target configuration file

 

Not yet !

*Privileged user can be, for example, user having access to job configuration update when job configuration is sync'ed.

Releases

0.0.10 (August 3, 2016)

Bugfixes

  • SCM-772 Improve Git handling of file paths with spaces

0.0.9 (December 11, 2015)

Bugfixes

  • JENKINS-13593 Seems to not handle having builds in separate folder
  • JENKINS-15128 Renaming job doesn't work with git
  • JENKINS-16348 Trim & validate repository URL obtained from user
  • JENKINS-16378 All build logs added and committed when renaming job
  • JENKINS-16441 Scm sync fails completely if folder name starts with a hyphen
  • JENKINS-18401 java.lang.NoClassDefFoundError: hudson/maven/MavenReporter
  • JENKINS-19984 Groovy Postbuild Plugin does not like Jenkins Option: "Build Record Root Directory"
  • JENKINS-22540 Jenkins config files are not tracked
  • JENKINS-22666 No popup window when committing changes to job config for putting in commit message
  • JENKINS-24686 scm-sync-configuration fails if job name contains whitespace
  • JENKINS-24881 Rename job starts to sync workspace
  • JENKINS-24993 scm-sync-configration plugin keeps on adding directory structure scm-sync-configuration/checkoutConfiguration
    Many thanks to tomwolf who provided all the fixes in this release.

0.0.8 (August 24, 2014)

Tasks

  • Upgraded to maven scm api 1.9.1 (from 1.6)

Bugfixes

0.0.7.5 (July 5, 2014)

Bugfixes

  • JENKINS-23036 (major) : Fix root URL issue on reload link
    Thanks to Kiana Tennyson for her contribution PR #20

0.0.7.4 (February 12, 2014)

Improvements

  • Cloudbees folders support, thanks to ndeloof for his contribution PR #19

0.0.7.3 (July 24, 2013)

Bugfixes

  • JENKINS-18867 (major) : New link allowing to purge fail logs for scm-sync-configuration was breaking the page if jquery plugin was pulled on the instance

Improvements

  • Synchronized users config files

0.0.7.2 (July 20, 2013)

Bugfixes

Improvements

  • Allowing to reset scm sync status failing file, by clicking on an hyperlink (administrators only)
    Thanks to Joey Jiao for his contribution in PR #16

0.0.7.1 (May 24, 2013)

Bugfixes

  • JENKINS-17545 (critical) : On multimodules jobs, submodules' config.xml were constantly (on every build) commited on repository, resulting in lots of noise in commits history, and even blacklistings on github

0.0.7 (January 25, 2013)

This release should likely have been tagged 0.0.6.2 instead of 0.7.0, there isn't any big step by upgrading.

Bugfixes

  • JENKINS-14893 : scm sync configuration causes memory leak (thanks mhelff)
  • Not nesting RuntimeException into ServletException, fixing spring security redirection to login page (thanks ndeloof)

0.0.6.1 (October 28, 2012)

Bugfixes

  • JENKINS-14640 : Create view form was not handled correctly on 1.466 and above
  • JENKINS-15266 : Reducing SCM Sync commits logs to FINEST level (instead of INFO)
  • JENKINS-15285 : Fixed blocking bug on Windows installations where plugin didn't start correctly

0.0.6 (September 18, 2012)

Improvements

  • User defined files being committed (JENKINS-8225 which implies JENKINS-14642, JENKINS-14812, JENKINS-15018) : Now, you can add user-defined custom paths to synchronize on the system page. Don't hesitate to share yours on the dedicated page.
  • Commits should be made asynchronously (JENKINS-14214 which implies, I think, JENKINS-9166 and JENKINS-10967) : now, commiting files is not blocking but postponed into an asynchronous queue. This will lead in performance improvements on large jenkins instance + lower the chance to have concurrent modifications on files (file content to commit is saved).
  • Bulk transactional commit (JENKINS-13613) : before v0.0.6, 1 file modified = 1 commit. Prior to 0.0.6, if during an HTTP request, you modify several files, they will all be committed into a single commit.
    It should greatly improve the commit readability, and lead to atomic commits.
    Note that "automatic" (ie "non manual") file changes will remain commited one by one (this is difficult to identify a "system-wide transaction").
  • Allowing to reload configuration files from SCM : added an hyperling on global Jenkins configuration page for doing this
  • Commit messages improved (JENKINS-14568) : now, deleted / renamed / updated files are labeled into the commit "technical part" of the message

Bugs

  • JENKINS-14582 : Fix issue when your jenkins webapp has a context path (not the context root)

Known Bugs on this release

  • If you're using Git, job rename won't work as expected. This is related to JENKINS-15128 which relies on a bug in maven scm api. Once the bug will be fixed in maven scm api, I'll align on it and it will fix the problem in the plugin.
  • A regression has been identified (JENKINS-15221) concerning the initial check in when jenkins starts.
    In previous version, if some files in jenkins_home were not present in the scm, these files were added. In 0.0.6 it isn't the case and should considered as a major regression.

0.0.5 (April 25, 2012)

Improvements

  • Added Git support – Big thanks to Bertrand Paquet
  • *Allowing to display latest synchronization status * (configurable in jenkins configuration screen) – thanks to Bertrand Paquet
  • Saving every Jenkins configuration files located directly in JENKINS_HOME – thanks to Bertrand Paquet
  • Allowing to use a repository without credentials – thanks to Bertrand Paquet
  • Added checkbox to disable commit prompt, forever – thanks to Bertrand Paquet
  • Fixed JENKINS-11817 and JENKINS-10858 : Allow to provide a commit message formatter (you will be able to add prefixes to your commit messages, with issue id for example)
  • Fixed JENKINS-10802 : In relation to previous bugfix, provide a commit message on initial upload of config.
    Note that you will have to make a trick to make this work, as I described in this comment
  • Fixed JENKINS-11106 : Automatically set focus to commit message field when prompt appear

Tasks

  • Welcome Bertrand Paquet aboard ! (smile)

0.0.4 (March 9, 2011)

Bugfixes

  • Fixed JENKINS-8453 : NPE after updating to 0.0.3 (data migration problem)
  • Fixed JENKINS-8890 : SCM Sync plugins 0.0.3 throws NPE when called before having been initialized (for example when using shelve plugin in correlation with scm-sync-configuration plugin)

Improvements

  • JENKINS-8259 Added "don't bother me" checkbox on commit message popup
  • Added log when credentials have not been entered when trying to connect to scm
  • Provided Data migration layer allowing to migrate scm-sync-configuration.xml data from 0.0.2 -> 0.0.3 -> 0.0.4 -> ...
  • Replaced use of Embedder by DefaultPlexusContainer to ensure compliance of the plugin with Hudson/Jenkins versions greater than 1.395 (apparition of sisu)
  • Replaced "<" and ">" by "[" and "]" (the ones are hidden when used in log console)

Tasks

  • Moved sources to Github !
  • Lots of Unit tests added (especially about data migration between plugin versions)
  • Refactored unit tests to use Mockito instead of EasyMock

0.0.3 (January 4, 2011)

Bugfixes

  • JENKINS-8197 Using jenkins/hudson SVN credentials to authenticate against subversion server instead of the ones in your .subversion cache !
    This is more relevant with the UI, prompting for scm credentials and storing them in jenkins/hudson credentials.
  • JENKINS-7762 Only /jobs//config.xml are commited (instead of /jobs/*/config.xml) – This fixes some plugin files (example : M2Release plugin files) which were unintentionally synchronized with scm
  • JENKINS-7982 Fixed NPE around ScmSyncConfigurationPlugin:59

Improvements

  • Deleting svn hierarchy on job deletion
  • Renaming svn hierarchy on job renaming
  • Comment message prompted on "configure" job screen .. even if configuring a job through a view
  • Improved logging
  • JENKINS-8259 Provided "no synchronisation" radio in system configuration page, allowing to disable scm synchronisation after having enabled it
  • Changed scm-sync-configuration.xml file representation (SCM is no more an enum type, and become an abstract classes with subclasses) + provided data migrator from 0.0.2 & 0.0.1 file representations

Tasks

  • Provided plugin description for plugin rss feed
  • Provided unit tests harness for testing scm synchronizations (~50% test coverage) + refactored code to improve testability

0.0.2 (October 15, 2010)

Bugfixes

  • JENKINS-7241 : Critical bug: IE8 users wasn't able to submit their configuration form due to a JS error.

Improvements

  • Jenkins/Hudson System configuration is now sync'ed
  • scm-sync-configuration v0.0.2 has been tested with IE8, Chrome 5, FF 2 under windows 7
  • Added JS exception catching in order to not block the process if a JS error occurs (because of an incompat with non tested browser)
  • Some little refactorings on config files initialization in scm repository

Tasks

  • Provided name & wiki url to the POM. These information are used on several pages of jenkins-ci/hudson-ci (especially RSS feeds)

0.0.1 (October 12, 2010)

Warning

This is an alpha release ! Don't use it in production, especially if you are using M2Release jenkins/hudson plugin

Improvements

  • SCM Repository configuration in system panel
  • Prompt for commit message each time a Job Configuration is modified

Roadmap (future versions)

v0.1

  • (done) Provide a "commit everything modified with following comment" button on system page (Will be useful if you want to globally edit your config files (via a groovy console script for example) and commit everything with a comment)
  • Provide first strategy implementation allowing to backup every of your job configuration files (when submitting job configuration form) with a personnal commit message
  • Refactor the SCM access layer, dropping usage of maven scm api in favour to jenkins scm API which will allow credentials sharing

v0.2

  • Provide up-to-date checker for the first implementation, allowing to replace current job configuration with a newer one commited on the SCM
  • (done) Provide several new strategies to sync various configuration files : views, system, users related : JENKINS-8225
  • (done) Allow administrator to select which of configuration type should be sync'ed (or not)

v0.3

  • Provide configuration history on each configuration type page
  • (done) Provide new SCM connection implementations : cvs, git, others?

Current bugs to solve before v0.1

  • Replace special linux characters ( " for example) when syncing
  • Check if updated repository on system config page is empty and display a warning if not

Greetings to our sponsors

I'm a proud user of .
Feel free to download and test this IDE, it's worth a try !

136 Comments

  1. This plugin looks very useful, I can't wait to see Perforce SCM support in it. Maybe it is a good idea to try to use the Hudson SCM implementation for implementing this instead of reimplementing support for each SCM.

    1. This is the idea (wink)

      Both using maven-scm-api (for implementation) and Hudson SCM (for saved credentials) is planned (smile)

  2. This thing looks exactly like what i need here!

    However I don't seem to get it running :-/

    I did:

    - "Manage Jenkins"

    - "Configure System"

    - "SCM Sync configuration" - radio button to Subversion and added a repository (however for testing i did an different repos on a different machine than where my project sources reside)

    - click "Save"

    nothing happens, i'd expect a box asking for credentials.

    Is there some log somewhere (sorry i'm new to jenkins so i don't know if there is some standard place to look)

    1. Hi Patrick !

      From Hudson Home, go to "Manage Hudson" > "System log" and there, add a new log recorder.
      Put the name of your choice in this recorder, and add the logger "hudson.plugins.scm_sync_configuration" with log level "all".

      Then you will be able to see logs generated by the SCM Sync configuration plugin.

      This was for the log part.
      For the other part, some questions :
      - Are you using http / https / file svn protocol ? If yes, that's fine. If you're using svn+ssh protocol, there is an issue on the 0.0.3 (see disclaimer on top of this page)
      - When you browse your HUDSON_HOME/scm-sync-configuration/checkoutConfiguration/ directory, is there a .svn directory inside it ?
      - When you look into your HUDSON_HOME/hudson.scm.SubversionSCM.xml, is there your repository and your encrypted credentials in it ?
      - When you look into your HUDSON_USER_HOME/.subversion/auth/ directory, is there some subdirectories where reside some SVN credentials allowing to connect to your svn repository where configuration files will be synced ?

      1. I just installed the plugin and it almost works, perhaps its working as its supposed to? Here is what is happening:

        I get a pop up for -m option of SVN and I can submit. All seems to be well at this point except the commit to svn does not take place....

        In the $JENKINS_HOME/scm-sync-configuration/checoutConfiguration I see .svn directories

        When I do "svn status" I see my changes (additions, modifications)

        From here I can do svn commit to "sync" jenkins with  SVN, but that's what I'd hope this plugin would do.

        ------------

        Here is additional information, answers to the 4 questions you had for Patrick:

        I am using http

        I do have .svn directories

        I don't have my repository in the hudson.scm.SunversionSCM.xml file! what exactly should in this file? How does this file get updated?

        I do have a .subversion directory. 

        1. Hi Ali !

          Have you looked at the troobleshooting page ? SubversionSCM.xml will be filled when you enter scm credentials when prompted (see red message when entering your repository url either in a job or in the scm configuration section in global jenkins configuration page)

          1. Thanks for your help.... We're up and running

  3. " If you are trying to synchronize your configuration file with a SVN repository using another protocol than http/https, synchronization won't occur.
    This is related to issue #8871 "

    I'm using svn protocol. Peliminary sync with SCM was correct (all config.xml created correctly), but others config's modifications weren't sync with SCM (no any new commits, plugin not asked about commit message and there is no any errors in plugin's log), that's correct?

    I supposed that svn protocol won't work at all in this plugin.

    1. Hi Andrey,

      The svn protocol limitation appeared in v0.0.3 with issue JENKINS-8197. This issue wasn't taking into account SVN credentials entered via Hudson/Jenkins. Instead, svn credentials located in your ~/.svn/auth/ directory were used to sync your files (that is ... really not user friendly to debug)

      To fix JENKINS-8197 I had to change maven scm provider from svnexe (which relies on your $PATH/svn command) to javasvn (implementation based on java API svnkit).
      Problem is : with svnjava, only http / https / file protocols are supported (see the "NOTES" on svnjava home page)
      As soon as svn (or others) protocol will be supported in svnjava, only thing I'll have to do is upgrade my version to be compliant.

      Finally, what are your log level for scm-sync-configuration ? I think when credentials are not set, I only put a warning message (and not an error one).

  4. Hello! I am using SCM sync configuration plugin v. 0.0.4. But I can't run it.

    I created a local svn repository.

    file:///home/nikita/NetBeansProjects/svn/project1/

    I added this repository to "Configure System" page (Subversion for SCM sync configuration plugin).

    I pressed "Save" button. Nothing happens. Log:

    Mar 16, 2011 12:12:57 PM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
    WARNING: SCM Repository has not yet been initiated !

    Mar 16, 2011 12:12:24 PM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
    WARNING: SCM Repository has not yet been initiated !

    Mar 16, 2011 12:11:54 PM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
    WARNING: SCM Repository has not yet been initiated !

    Mar 16, 2011 12:11:54 PM hudson.plugins.scm_sync_configuration.SCMManipulator scmConfigurationSettledUp
    INFO: Creating scmRepository connection data ..

    How to solve this problem?

    1. Hi Nikita !

      Have you activated some sort of credentials in your local svn repository ? (I don't think it will be the case, but I want to be sure)

      What is your log level ? "All" ?

      Frédéric

      1. My log level is "All".

        I activated credentials.I added

        [general]
        anon-access = read
        auth-access = write
        password-db = passwd

        to svnserve.conf. And i added

        [users]

        nikita = 12345

        to passwd file. I tried to use svn://localhost/project1/ . It don't work too. The same messages

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
        WARNING: SCM Repository has not yet been initiated !

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
        WARNING: SCM Repository has not yet been initiated !

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
        WARNING: SCM Repository has not yet been initiated !

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
        WARNING: SCM Repository has not yet been initiated !

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator expectScmRepositoryInitiated
        WARNING: SCM Repository has not yet been initiated !

        Mar 17, 2011 11:13:07 AM hudson.plugins.scm_sync_configuration.SCMManipulator scmConfigurationSettledUp
        INFO: Creating scmRepository connection data ..

        1. Ok !

          Could you try, in a first time, by disabling credentials, to see if it works ?

          Then, if it works, re-enable credentials, then go to your hudson system page (http://JENKINS_ROOT/configure) then :

          • Cut the scm url content
          • Quit the scm field
          • Re-enter the field and paste your url
          • Wait for 3-4s : is Hudson/Jenkins prompting you for credentials ? If not : what is your Hudson/Jenkins version ? (there is maybe a bug in your version)

          If you don't have any credential prompt for your svn local repo, try to manually go to the following url : http://JENKINS_ROOT/scm/SubversionSCM/enterCredential?file://localhost/project1/

          Ensure that your credentials are correctly stored for your realm by opening file JENKINS_HOME/hudson.scm.SubversionSCM.xml

          Then, go back to the http://JENKINS_ROOT/configure screen, switch to "no scm", validate form, go back to form and switch to "subversion scm", enter your scm url file://localhost/project1/ then validate.

          Does it work ? :-)

          1. I tried to disable credentials. Still it doesn't work. I can't understand what is wrong. :-(

            I found https repository. It works perfectly. So i will use this variant.

            Thank you very much for help!

  5. I am also getting the "WARNING: SCM Repository has not yet been initiated" message in the log. The SVN repository is the same as what all my other jobs use to poll SVN, and those are all working beautifully. Still, this plugin just refuses to do anything, and gives absolutely no explanation why.

    My SCM URL is using "svn+ssh://" (with SSH private key authentication), which the SubversionSCM plugin itself has no problems at all with (all jobs that use SVN are using this exact same base URL, and they all work perfectly). I even removed all of my previously saved subversion-credentials, reloaded, and rentered what was needed. On the System Configuration screen, I see that it attempts to login in order to verify credentials, and succeeds. But upon saving any configuration files, I get no "commit message" popup, and my repository is still empty.

    I created the svn directory before configuring the plugin (svn mkdir --parents svn+ssh://svn.home/var/svn/config/jenkins/ -m'Initial commit'), and the directory is still empty (maybe I'm not supposed to create the directory first???). I haven't found anything obvious yet, that can explain what I'm doing wrong (sad) But it feels like either something is documented incorrectly, not documented clearly enough, there's a bug, or none of the above and I'm simply blind as a bat..?

    1. see JENKINS-8871

      And FYI, in the JIRA ticket, you never said you were authenticating through svn+ssh protocol ... everytime, you were speaking about http protocol.

      What is the truth about your subversion server coordinates ?

  6. I'm having problems using an svn: URL for backup, too. I'm at Jenkins 1.41 with SCM Sync configuration plugin v0.0.4.  I'm getting the "WARNING: SCM Repository has not yet been initiated" warning, too. as well as "WARNING: No credential (realm) found for url [svn://ravesvn/Rave/projects/tier2/trunk/jenkins] : it seems that you should enter your credentials in the UI at <a target='_blank' href='../../scm/SubversionSCM/enterCredential?svn://xxx/yyy/projects/tier2/trunk/jenkins'>this url</a>:

    The plugin seems to stall at "INFO: Creating scmRepository connection data .."

    I went to the enterCredential URL and entered my user ID and password.  No luck.  I've verified that I can su to Jenkins and create directories, files, etc. and commit them via svn to the svn: URL via the svn command line. 

    I can't use http: or https: to get to svn.

    Any ideas?

  7. As I said earlier, this is related to JENKINS-8871.

    I'm waiting for some testers with svn protocol .. if you mind it... (smile)

    1. What do I have to  do to test?

      1. On the issue, scm-sync-configuration-0.0.5-bugfix8871-1.hpi

  8. Is it possible to have the following behavior of the plugin ?

    If I install an empty jenkins and configure the scm-sync-configuration the first time to a scm path that contains a (valid) configuration tree,
    then checkout and restore this configuration and restart Jenkins to use the recovered configuration? 

    For emergency cases, a feature to recover a specific release from scm would be nice.

    1. Yup it is planned (see items 3 & 4 in the product backlog section) ... but not for now (since action could be performed "manually" by checkouting jobs and copying checkouted information in JENKINS_HOME)

      But it is in my personnal todolist to provide a UI for this (wink)

  9. This plugin seems to be exactly what we need, but unfortunately we do not use SVN, but git. Do you have a guesstimate on when git support will be added?

    I have worked a bit on Hudson plugins (nothing too complicated, just small additions and modifications to existing plugins), but if you're interested, maybe I can take a swing at implementing it?

    1. It would be great ! (smile)

      I'm not working on this feature for the time being, but things are already up to welcome a new SCM implementation (like the git one).

      scm-sync-configuration is based on maven-scm-api which provide a scm abstraction among every SCMs.
      Feel free to contact me by email if you want further informations / inputs to start this feature (smile)

  10. Hey everybody!

    I have a problem with this plugin. As fcamblor mentioned above:

    "- When you browse your HUDSON_HOME/scm-sync-configuration/checkoutConfiguration/ directory, is there a .svn directory inside it?"

    So that's my cause - by some strange reason all .svn folders are gone. Could someone tell me please how to fix it and what caused the problem?

    1. Hi,

      Can you try to put your SCM to "no scm" in scm sync configuration section
      Save
      Then, re-select your subversion scm and fill the scm coordinates.

      It will reset your repository (and then re-synchronize everything, then re-put your .svn).

      FYI, this could be happened if you changed your credentials on your SVN server, and didn't applied this change in jenkins.

      FYI, too, I'm planning to implement this feature of "resetting your current repository" in a future version of the plugin.

      1. Thank you very much for your reply.

        I updated it to last 0.0.5 version and it switched automatically to 'none' instead of my repository path at plugin settings.

        I switched it back to my repository, I saw hudson/home/scm-sync-configuration/checkoutConfiguration/jobs folder was deleted and created in short period of time.

        All job configurations and config.xml files was added to checkoutConfiguration folder but there was no .svn folders in it.

        I switched repository settings back to 'none' and saved the configuration - checkoutConfiguration folder was deleted.

        Then I switched settings back to my repository path, checkoutConfiguration was created, jobs and config.xml files was copied into it but not .svn folders again :-)

        1. But when I changed 'www.[myrepository].com' to '[myrepository].com' .svn folders was added to checkoutConfiguration automatically

          Note that I can access my repository with 'www.' and without it.

          1. I think the answer for this will reside in your JENKINS_HOME/hudson.scm.SubversionSCM.xml file.

            You will see, inside it, that every SVN credentials will be stored with a key which is your "svn realm"
            The svn realm is something I don't really catch personnaly, but it is a phrase describing your svn repository (and that is configured on the server side, in the apache configuration, it is configured with the "realm" routine)

            And I think in your case, the realm will differ between the 'myrepository.com' and the 'www.myrepository.com' urls so jenkins won't succeed to retrieve credentials for the second one.

            1. Thank you for your plugin and for help :-)

              I'll check the realm.

              Anyway without 'www' it works fine now.

          2. Note that you can add an entry in the hudson.scm.SubversionSCM.xml file by going to the following url : http://*<jenkins_root>*/descriptorByName/hudson.scm.SubversionSCM/enterCredential?http://www.repository.com

            1. At hudson.scm.SubversionSCM.xml I have both entries for www.myrepository and myrepository with the same correct credentials.

              I think for now it's ok for me just to remove 'www' from my repository url.

              Thank you once again.

  11. Thanks for this plug-in! However, I have a tiny problem with it: synchronization apparently works fine, but I'm never asked for a commit message. Any idea why that is?

    1. If you're not prompted, I'd say it doesn't work :)

      What makes you say synchronization works fine ? Did you read previous comments where I describe how to diagnose problem (particularly the ones where I speak about jenkins console) ?

      1. Wow, thanks for the fast reply!

        Well, I checked the SCM Sync pushes into my repository, and the changes are there - I take this as a hint that it works :-)

        I only briefly read through the comments (looking for "commit message"), but all related posts seemed to have more general problems (nothing gets committed).

        1. Wow ok ... commits are made though ...

          You're right, you're the first one facing this problem at the moment ...

          Could you provide me :

          • The browser you're using (and eventually trying with another browser if you face the same problem... I personnally developp using chrome)
          • Your jenkins url (even if it is in an intranet ... I just want to see if there isn't any special thing in your url)
          • Is you jenkins instance directly accessible ? Or are you behind an http server (like apache or nginx used as proxies) ?
          1. I have sent to you the according information by email, and I will later update this thread with the solution. Thanks for your efforts!

            1. I am having the same problem, did you find a solution ?.

              1. We had lots of discussions about this problem, without solving the problem

                Maybe should you file an issue in JIRA for this problem.

              2. Same problem here. The prompt was shown at first, but after using the 'Don't bother me for 5 min' option on commit dialog, the commit prompt dialog is not shown anymore. Restarting Jenkins or reloading configuration doesn't help. I've also tried to find the corresponding configuration in the scm_sync to no avail.

                However the actual subversion sync is working - no warnings/errors found in the log.

                1. Ok thanks Vlad for the feedback, I'll try to look at it...

  12. I notice mention of 0.0.5, is this available ? when will it be released ?

    Also how does this plugin interact with some of the user authentication plugins.  It would be nice to be able to login using LDAP and each user can set their own SVN credentials that this plugin uses to commit changes as.

    1. No planning for 0.0.5, it will be released when needed (I can't make any assumption since I work on the plugin only on my spare time (smile)).

      SCM Sync configuration plugins is not related to authentication plugin at all.
      I personally consider your feature as a corner case, plus it would be tough to implement (I'd prefer to spend effort on better valued items than this one).

  13. It seems I've followed all the recommendations in above comments, but still have a problem getting my configuration into SVN:

    The SCM Sync log says:

    Feb 12, 2012 7:32:45 AM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    SEVERE: checkinFiles Problem during commit of [config.xml] : svn: Commit failed (details follow):
    svn: MKACTIVITY /<my svn repo>/!svn/act/a78d0c70-3501-0010-a110-ff15c5cd16b4 failed

    For each config.xml for every job.
    We are using the https based SVN url, all the credentials are there in hudson.scm.SubversionSCM.xml and there are .svn files in /JENKINS_HOME/scm-sync-configuration/checkoutConfiguration
    What's missing?
    Jenkins: 1.413
    SCM Sync plugin: 0.0.4
     

    1. Solved. It was a SVN permission problem after all. 

  14. When do you plan to add sync with git repository?

    1. Bertrand Paquet implemented this feature, we need to take time to integrate it to master ;)

      Time needed on my side :(

  15. Thanks a lot for the plugin. Any chance of getting node configurations under SCM too?

    1. Bertrand Paquet should add a strategy allowing to sync lots of new configuration files.
      Nevertheless, his implementation won't provide commit message for this large amount of files.

      If you want to implement a strategy, it is barely simple :

      • First, look at ScmSyncStrategy here
      • You should provide your own implementation allowing to sync jenkins node. An implementation will consist of :
        • A set of regex urls where prompt will be provided to the user (in your case, something like ^computer/.*/configure$)
        • A model that should be looked for saving (I thinkg in your case, it should be hudson.model.Node)
        • Path to the synchronized file(s) for initial synchronization
      • Examples implementation are here and there.

      Don't hesitate to provide a pull request with a strategy if you have some time :-)

      1. Thanks for the fast answer. I had a look at the code and my Jenkins installation, and found that the nodes are stored in the main config.xml file. So it is already in SCM. The only problem is, that there are triggers for commit message missing when working with nodes.

        I think they should be added to JenkinsConfigScmSyncStrategy.java, right? I tried to add them like this:

            // Node configuration pages
            add(new PageMatcher("^computer/\[^/\]+/configure$", "config"));
            add(new PageMatcher("^computer/\[^/\]+/delete$", ""));
            add(new PageMatcher("^computer/createItem$", ""));
        

        But I hit the problem that the delete and create forms has no name. What should be passed to the PageMatcher in that case? Or do we need a patch to the core to add the name?

        1. You're right with PageMatcher :)

          Looking at page decorator, I think you will be in trouble if you don't provide any form name.

          As you said, maybe should we improve footer.jelly behaviour in order to pass a jquery selector allowing to locate target form !

          1. Well, this is getting well above my knowledge of Java and web technologies. I will have to wait and see if anyone more experienced with Jenkins programming finds the time :-(.

            Thanks for the help anyway...

            1. I just made changes to PageMatcher in order to replace targetFormName field by targetFormSelector.

              Now, you will just have to provide a css selector allowing to retrieve the submitted form on your page.

              Some examples :

              • "form[name='config']" <= that was the existing behaviour
              • "div#aContainer form" <= A form in a container

              CSS selectors should be "a la" jquery

            2. In latest v0.0.6 (I just released), user-defined sync'ed paths should be useful to you :-)

  16. 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
    PS: i did not know which page is the most appropriate so i posted this here too: https://wiki.jenkins-ci.org/display/JENKINS/ScmSyncConfig+Troubleshootings

    1. Hi,

      I'll let Bertrand answer your questions regarding the git repo requirements.

      For the "retrieve config files" feature, I invite you to watch, vote and eventually comment on this issue ... I think you're not the first waiting for this to be implemented ! ;-)

      Frédéric

      1. Hi Frédéric,

        and thanks for the quick answer! I will have a look at the issue you mention. It would suprise me to be the first one to desire such a feature!

        In our team, there are 3 people that can modify/configure Jenkins itself and the jobs, which can lead to confusion (who changed what wen?) so i thought it would be logical to have not only the atomic versioning of any change in the config, but also the restoring of a known-working config.

        Thanks again,

        Florent

    2. Hi

      There is only one requirement on the git repo : the unix user which run Jenkins must have access to the git repo.

      In my setup, the jenkins user has an ssh keys which is allowed to commit on a private github repo.

      Regards,

      1. Salut Bertrand,

        thanks for your answer. So i assume your setup is following:

        - Jenkins server running under Linux

        - Jenkins user communicating with git+ssh to the specified repo

        So let me add a question: what does the plugin do in the git repo when a config change has happend? a Git commit only? a Git commit + git push ?

        I am confused because the log file is not so verbose in that matter and i did not look into the source yet.

        Thanks

  17. If you are using the plugin with git and do also manual commits/pushes to the specified repo, you may come to a point, where the plugin is not able to push anymore. In this case, you have to do a manual pull + push. To do so, go to the directory $JENKINS_HOME/scm-sync-configuration/checkoutConfiguration/ and execute git pull followed by git push. If that was successful, you should delete the file $JENKINS_HOME/scm-sync-configurationfail.log.

    At least it worked for me (plugin-version 0.0.5).

    Maybe you can change the plugin, so that it always does a pull before a push?

  18. Has anyone else experienced this plugin causing massive performance problems?

    We had to uninstall the plugin because it was causing the garbage collector to run constantly which was pausing the application and making it unresponsive every few minutes.

    We have 2350+ jobs currently, FYI so modifying the master configuration also takes forever because of how it does the commits.

    1. You're right. I just raised JENKINS-14214 adressing this problem. 

    2. FYI, JENKINS-14214 is fixed in v0.0.6. If you want to have a look at async commit on your large instance, I would be happy to have your feedback.

  19. Have configured SCM Sync Plugin 0.0.5 with Jenkins, however keep getting commit failed when saving the configs and nothing gets committed to SVN.

    I do see .svn folder under scm-sync-configuration/checkoutConfiguration.

    We have SVN pre-commit hook set and hence have defined a commit message prefix as JIRA-xxx: [message].

    The error that I see in the logs is as below:

    Aug 9, 2012 10:54:44 AM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    SEVERE: [checkinFiles] Problem during commit of [[config.xml]] : svn: Commit failed (details follow):
    svn: MKACTIVITY /svn/repos/blahblah/!svn/act/92bace0a-3901-0010-a072-57cab3689e81 failed
    Aug 9, 2012 10:54:43 AM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    FINE: Checking in SCM files : [config.xml] ...
    Aug 9, 2012 10:54:43 AM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles

    Unable to determine, why the commit fails from the logs. Have configured the SVN credentials using username/password and its authenticated and  correctly appears in hudson.scm.SubversionSCM.xml

    Would appreciate any help on this.

    Thanks

    1. Have you followed things on the Troubleshoots page ?

      1. Hi,

        I have got this working by caching the svn username/password in .subversion folder. This obviosuly is just a work around and would look to find a proper resolution rather than having to use the cached password, since it could be overwritten anytime and the pasword is also stored in plain text.

        It looks like the plugin is using the unix user id (id used to start the jenkins process) rather than the id/password specified in the hudson.scm.SubversionSCM.xml. However since the logs do not print the user it is trying to use to check in I cannot confirm the same. As I understand from the forums and documentation v0.0.5 should be using the credentials from the xml file rather than the jenkins process, isnt it. The subversion plugin installed with Jenkins is v1.34 in case that helps as well.

        Our Jenkins setup does not have any authentication setup and all jobs run as anonymous user.

        Looking forward to hearing back from you

        Thanks

        1. Which subversion protocol are you using ? http | https | svn | svn+ssh ?

          If this is a protocol other than http/https, I think you're facing JENKINS-8871

          1. Thanks for the prompt response. I think the protocol we are using is http since we access the SVN using an HTTP URL. Am not sure though. Is there a way I can check and confirm the same.

            1. Simply have a look at your svn repository url : if it starts with http (as you stated), it should be http protocol :)

  20. Thanks for writing this plugin. I have used it successfully with SVN in the past, and it was very helpful. At my current job, I'm using it with git and have run into an issue. I am only able to get it working with a top level git repo. When I try to give it a git URL + subdir, it fails. IS there some way to get this working with a git subdir? Thanks - Carter

    1. Hi Carter,

      Unfortunately, there is no way, for the moment, to have this working.

      Maybe could you file an improvement on the Jenkins issue tracker ?

  21. I am unable to install the plugin on Jenkins 1.482: I use "Download now and install after restart", but the plugin is not present in the list of installed plugins after restart.

    Any idea?

    1. Maybe due to JENKINS-15285.

      I test scm sync config plugin only on LTS releases

      1. Thanks, this is indeed this issue.

        I was quite happy with 1.482 so far. I will try to revert to 1.466.2...

        1. I actually reverted to version 0.0.5 of the plugin, and it works.

          I only have one problem with the commit message pattern: where is it documented? My pre-commit hook is failing, and I'd like to see the actual commit message generated - it does not show up in the plugin logs, even with finest level.

          Thanks.

          1. Yup logs weren't big in 0.0.5

            You will have to use the special "[message]" identifier to place current message wherever you want.

            For instance, if you must prefix your messages with "XXX - ", you should define a commit message pattern like "XXX - [message]"

            1. The trick: I have to prefix my message with "[XXXX]" (e.g. a Jira id between brackets). I suppose I have to escape the brackets in this case. Is this supported? If yes, how can I do it?

              Thank you!

              1. Nope ... this is crappy implementation :-D

                I just hope you'll never have to display the string "[message]" as a prefix/suffix commit message for your issue tracker ;-)

                1. Not so crappy. Actually, it works fine and I managed to sync my conf.

                  Thanks a lot for your support.

  22. Plugin fails to start after install:

    Stacktrace removed
    1. Please look at issue tracker before posting stacktraces.

      Thanks

      1. My bad, thanks.

        Installed 0.0.5 for now.

        1. No problem.

          In any case, I added a disclaimer in the starting wiki page for this particular blocking issue :-)

  23. I just changed the URL to the svn repository I use to save the Jenkins conf: is there a way to tell the plugin to commit everything again?

    My new repo is empty for now.

    1. I think your problem is related to JENKINS-15221 which is a regression.

      Maybe could you switch to "No scm", save, then re-enable the subversion scm, on the global jenkins configuration page ?

      1. Thanks! That did the trick.

  24. We are using SCM Sync plugin version 0.0.6.1 on Jenkins 1.466.2 . It is configured to use our SVN repository (https based).

    It seems that SCM Sync plugin is using SVN client 1.7 even when Jenkins subversion plugin is configured to use the 1.6 subversion workspace version. While it is working even when our SVN server is 1.6, it still presents a problem for us, since we have no SVN 1.7 client installed on our Jenkins server.

    Since SVN client 1.7 has different file layout schema than 1.6 clients - it is impossible to use our SVN 1.6 client in case where a SCM Sync plugin reported problems need to be fixed manually.

    Is there any workaround for this problem, without installing 1.7 SVN client on Jenkins server ?

    Thanks

    Vlad.

    1. Hi Vlad,

      SCM Sync Config plugin relies on svn java v1.12 implementation.

      So it isn't compatible with svn 1.7 servers.

      => I don't think your assumption is right there (smile)

      How are you configuring SVN to access your svn repository ? Https with a certificate ?
      Wouldn't you facing JENKINS-14792 ?

      1. Thanks for quick reply.

        We are using Https.

        Probably I'm wrong of cause as you said, but that's what I'm seeing when using SVN 1.6 client:

        [checkoutConfiguration]$ pwd
        /jenkins-server/Home/scm-sync-configuration/checkoutConfiguration
        [checkoutConfiguration]$ svn --version
        svn, version 1.6.16 (r1073529)
        ...
        [checkoutConfiguration]$ svn info
        svn: The path '.' appears to be part of a Subversion 1.7 or greater working copy.  Please upgrade your Subversion client to use this working copy.
        

        What am I missing?
        BTW, on previous version of the plugin (0.0.6) this problem didn't exist, so we could our current svn client successfully 

  25. Not working for me with Git + SSH:

     Feb 14, 2013 6:47:50 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness queueChangeSet
    INFO: Queue of changeset     A hudson.scm.SubversionSCM.xml
        A hudson.plugins.git.GitSCM.xml
        A hudson.triggers.SCMTrigger.xml
        A hudson.plugins.git.GitTool.xml
        A hudson.plugins.ircbot.IrcPublisher.xml
        A scm-sync-configuration.xml
        A hudson.plugins.cmake.CmakeBuilder.xml
        A hudson.tasks.Mailer.xml
        A config.xml
        A hudson.tasks.Maven.xml
        A hudson.plugins.logparser.LogParserPublisher.xml
        A hudson.tasks.Shell.xml
     aborted (scm manipulator not settled !)
    

    Am I doing something wrong?

  26. Thanks for the plugin. It would be great if user's config.xml is saved too.

    1. You can, with custom includes (see here).

      Don't hesitate to share your own includes on this page (smile)

  27. Sorry, not sure if it is SCM sync related or not. For some reason "..modules/org.module.blah/config.xml" keeps changing. It keeps adding and removing <actions/>  on every build on every module. Is there a way to avoid this? So basically I am getting hammered with svn commits for modules that really haven't changes but for some reason the config.xml added or removed "<actions/>"

    1. Seems like you're hitting JENKINS-17545, fixed yesterday.

      I'm waiting for some testers for this fix

      1. Thanks for letting me know. Let me know if you need additional help testing this. Will keep a watch for the updated version.

        1. If you can download attached hpi of the plugin & install it on your instance, it would be great to let me know if this fixes the problem.

          I'm waiting for someone confirming this before releasing a new version including this fix.

          1. Tested the fix and it works great. No extra commits.

  28. Does this plugin support authentication modules? We are using the Assembla Auth Plugin and we are getting errors on the initial file check-in. Also, the usernames (and thus config files) have some special characters in them and that may also be causing a problem. The characters are '@', ' '(space), and '-'(hyphen).

    The errors are:Aug 05, 2013 2:40:19 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness processCommitsQueue
    SEVERE: Error while processing commit queue : Error while checking in file to scm repository
    Aug 05, 2013 2:40:19 PM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    FINER: THROW
    hudson.plugins.scm_sync_configuration.exceptions.LoggableException: Error while checking in file to scm repository
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.processCommitsQueue(ScmSyncConfigurationBusiness.java:213)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.access$000(ScmSyncConfigurationBusiness.java:29)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness$1.call(ScmSyncConfigurationBusiness.java:143)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness$1.call(ScmSyncConfigurationBusiness.java:141)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

    Aug 05, 2013 2:40:19 PM hudson.plugins.scm_sync_configuration.SCMManipulator checkinFiles
    SEVERE: checkinFiles Problem during SCM commit : svn: E175002: Commit failed (details follow):
    svn: E175002: MKACTIVITY /svn/cM4yhIeeur34JreJe5aVNr/!svn/act/f497fe4f-4001-0010-9fbf-dfeefd79ea9f failed
    Aug 05, 2013 2:40:19 PM hudson.plugins.scm_sync_configuration.SCMManipulator
    FINE: Checking in SCM files ...
    Aug 05, 2013 2:40:19 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness
    FINEST: Processing commit : Commit hudson.plugins.scm_sync_configuration.model.Commit@72d3f521 :

    1. Hi Jeff !

      Have you looked at the troobleshooting page ?

      If you go inside the JENKINS_HOME/scm-sync-configuration/checkoutConfiguration/ and try to manually commit these files (using regular svn command), what happens ?

      1. Yes, I did go through the troubleshooting page, setup logging, looked at the logs and the source code. But I couldn't find anything about how authentication is handled.

        And yes, I tried checking in the files manually and it worked without error.

        1. Could you please file an issue about your problem, this will be a better place to discuss about this.

          You could eventually describe, inside it :

          • Your jenkins version
          • Scm sync config plugin version
          • File the exact svn status of JENKINS_HOME/scm-sync-configuration/checkoutConfiguration/ folder when it fails to checkin

          Thanks in advance

  29. Hi All,I have installed and configured the scm-sycn-configuration plugin and I have modified the Jenkins configuration, Job configuration , and also modified the manage Jenkins page. 

    * If I modify a job configuration a config.xml is committed under folder <repository_root>\job_name

    * If I modify a Jenkins configuration like modifying nodes etc then a config.xml is committed under root.

    * If I modify anything in manage Jenkins then some Jenkins related files are committed under root.

    I need only config.xml under job_name folder. Is there any option to exclude other commits?
    Is there any option to commit the files in to a user defined path or subfolders of git repo like <repository_root>\jenkins?

    1. Hi !

      I think you might be interested in watching JENKINS-19659 & JENKINS-18187

  30. Hi,

    I think, there must be some concurrency issue with the plugin. We have a lot of jobs and slaves, so our Jenkins master has load. I happened to change several jobs the following way:

    1. opening several job config pages in several browser tabs

    2. doing small change in one job config

    3. pasting comment for saving the configuration of the job

    4. close the tab, and go to next job with step 2.

    I noticed, that the comment I defined is not always saved correctly. My name is always there, and the job name as well, but the comment not. I would tip on that the sync plugin commits to git in a separate thread, and somehow the commit comment "field" is somehow cleared, when the next job pops up the commit comment dialog. I am pretty sure, that it is a concurrency issue. 

    Anyone noticed this as well?

    My version of the plugin is 0.0.7.3, and Jenkins version is 1.544.

    Regards,

    Gábor Lipták

    1. Hi,

      You're right, there *might* be concurrency issues because of the way the plugin works.

      If you look at the ScmSyncConfigurationDataProvider class, you'll see I use the current user session to store & retrieve things (particularly commit comment).

      This is done in order to be able to plug the "commit comment" popup on every potential jenkins page.
      Typical workflow :

      1. You're on a configuration page eligible to the scm sync config commit popup
      2. You submit the form
      3. The commit comment popup is displayed, you enter the comment then submit the comment form
      4. Comment is sent to the server with an ajax call, and stored in the session
      5. Then your initial configuration form is submitted
      6. When model corresponding to your configuration form is persisted on server side, a hook triggers the scm sync config plugin which retrieve last comment persisted in the session and use it for the commit

      => That is to say, if another tab is submitted during steps 4 & 6 AND these tabs use the same user session as yours (that is to say : you submit another form on another tab) there might be cases where messages could be mingled.

      However, given my current jenkins plugin dev knowledge, I don't know how I could improve this .. for the time being, I think we should live with it.
      But I'm opened to any suggestion (smile)

      1. Hi,

        If there would be something like TAB ID, which would be appended to the session scope variable name, then we would have no such problem. I sadly have no idea, if any mechanism is in Jenkins to distinguish between browser tabs on server side. Maybe others know about this more.

        Till then maybe it is nice to state in the documentation, that this is a known issue with the plugin and the Jenkins infrastructure.

        Regards,

        Gábor

        1. Unfortunately I don't think it will work.
          If I were able to submit the tab id alongside the configuration form data (step 5), I would be able to submit the commit comment message as well.

          Problem is : I can't associate generically my data with every potential jenkins model data
          This is the reason why I make it in a 2-steps submission.

  31. Hi,

    I have a strange bug. I cannot save my changes to a job. If I change only the description and I save it, it works. If I delete a parameter, I click on save, the popup for the message comes, I click on submit, and nothing happens. I am still on the configuration page, and the save button does not have any effect anymore. The javascript console contains this:

    Uncaught TypeError: Cannot set property 'submit' of null codemirror.js:1531
    wrappedSubmit codemirror.js:1531
    (anonymous function) scm-sync-configuration-page-handler.js:104
    ajaxCallParams.onSuccess scm-sync-configuration-page-handler.js:70
    Ajax.Request.Class.create.respondToReadyState prototype.js:1657
    Ajax.Request.Class.create.onStateChange prototype.js:1600
    (anonymous function)

    Any idea?

    Regards,
    Gábor Lipták

    1. Saving once the description with "dont disturb me for 1 hour for any config" is a known workaround. Of course then I cannot define message.

  32. Hi there,

    First of all, thanks for your hard work. Very much appreciated :)

    I encountered some issues when trying to get it running though.

    My current setup is Jenkins 1.562 and SCM Sync configuration plugin version 0.0.7.4.

    I also have a bitbucket repository which I want to use for backing up the Jenkins' config with your plugin.

    I am having an issue with committing and pushing to the git repository. I did add the git repository url to the SCM Sync configs in *Manage Jenkins > Configure System *and I do get the pop up box asking for a comment. But once I submit the comment, the changes are not committed and pushed to the remote git repository. Here is the last log from the log recorder:

    Jun 19, 2014 2:20:12 PM FINE hudson.plugins.scm_sync_configuration.SCMManipulator
    
    Checking in SCM files ...
    Jun 19, 2014 2:20:12 PM FINE hudson.plugins.scm_sync_configuration.SCMManipulator
    Checked in SCM files !
    Jun 19, 2014 2:20:12 PM FINEST hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness
    Commit Commit hudson.plugins.scm_sync_configuration.model.Commit@389854f1 :
    Author : <Author>
    Comment : Jenkins configuration files updated by <Author> with following comment : Commit this
    Changeset :
    A hudson.scm.SubversionSCM.xml
    A hudson.tasks.Shell.xml
    A scm-sync-configuration.xml
    A hudson.plugins.git.GitTool.xml
    A hudson.scm.CVSSCM.xml
    A hudson.tasks.Mailer.xml
    A config.xml
    A hudson.tasks.Ant.xml
    A hudson.tasks.Maven.xml
    A hudson.plugins.git.GitSCM.xml
    A hudson.triggers.SCMTrigger.xml
    A hudson.plugins.emailext.ExtendedEmailPublisher.xml
    A hudson.maven.MavenModuleSet.xml
    
    pushed to SCM !
    

    As you can see above, the log is stating that the changes have been "pushed to SCM", and pardon my lack of knowledge, but although the changes were indeed saved into the $JENKINS_HOME/scm-sync-configuration/checkoutConfiguration, it hasn't been committed to the git repo.

    My question is: Is the plugin supposed to commit and push to the git repo as well? Or should I manually add a cron job to perform this operation?

    Ideally the plugin would be doing that after submitting the changes to SCM so that we do not have to have a cron job to check for differences and commit/push.

    Regards,

    Michael Loo

    1. I had the same problem...it's probably related to this:

      https://issues.jenkins-ci.org/browse/JENKINS-22820

      I downgraded my Jenkins VM git version to 1.7.10.msysgit.1, and the commits actually move up

  33. nice work!

    I found this plugin didn't trigger when I use Jenkins-API to create job(like 127.0.0.1:9080/jenkins/createItem?name=JobName), is there any way to force sync to SCM?

  34. Hi all,

    Thanks for the awesome plug in. I was looking for a plugin which integrated Perforce and the Job Config History Plugin so that the config files could be managed by Perforce.  Originally I was going to edit the job config history plugin source code to accomplish this but then I found this plugin. Has anybody tried modifying it to run with Perforce or are plans in the works to do this? Also, if anyone has any thoughts on the feasibility of doing this, I would appreciate you sharing them with me. 

    Thank you! 

  35. Hi,

    I can see my changes in job's config has been committed into

    1. jenkinsdata/scm-sync-configuration/checkoutConfiguration/.git

    2. Git repo in "configure system" setting.

    But still, prompt dialog did not show up to ask for commit message.

    the current commit message in both repos with format:

    Job <job_name> configuration update by <user>

    Thanks!

  36. I Am also very interested in this plugin but it's critical that it works with Perforce. I see that this plugin hasn't been updated in a while and was wondering on the current status of whether it's still being maintained or not?

    1. this problem was fixed.

  37. Could you link the "Product backlog" entries through to issues? For example, it seems "call a REST-like URL allowing to commit files with a comment from outside of Jenkins/Hudson behaviour" corresponds to this issue.

  38. DO NOT RENAME JOBS!  This plugin does not handle renaming Jenkins build jobs with Subversion (and there is a reopened ticket that says this applies to GIT as well).  The rename of the directory does not go well and you will spend hours trying to get things working again (if ever).  I'm looking at having to delete the plugin, wipe out the saved locations, and install the plugin again to get this working.  Nothing else I've tried has worked (including the suggested fixes in the bug tickets).

    1. With 0.0.10 version, it renames file if there is no additional changes, only rename:

      jobs/{test-scm-sync-plugin => test-scm-sync-plugin-new-name}/config.xml \| 0
      1 file changed, 0 insertions\(+), 0 deletions\(-)
      rename jobs/{test-scm-sync-plugin => test-scm-sync-plugin-new-name}/config.xml (100%)
  39. 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 class="hudson.plugins.scm_sync_configuration.scms.ScmSyncSubversionSCM"/>

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

        to just:

      <scm class="hudson.plugins.scm_sync_configuration.scms.ScmSyncNoSCM"/>

    * 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 class="hashtable">

        <entry>

          <string><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 class="hashtable"/>

    * 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.

  40. I just recently installed this plugin, and on the first commit, I noticed that it hadn't added the jobs subdirectory. I would have to go into each job via the Jenkins UI, and click save to invoke an add, commit, push. Is there a way around this that doesn't bypass the plugin or Jenkins UI? Of course, the better solution (that bypasses this plugin) is to cd to the jenkins home directory, copy paste the jobs into the scm-sync-configuration/checkoutConfiguration folder, delete everything that's not a *.xml file, and do an add, commit, push manually.

    1. Yes! There is a workaround:

      • Manage Jenkins >Configure System > SCM Sync configuration
        • Manual synchronization includes > Include: jobs/**/config.xml

      This configuration will force a first commit will all jobs!!

      If Folder Plugin is used, you will have to add other patterns.

  41. How do I make this work with a git repo that is accessible on an https URL?

    I followed you test setup process and created a free form project to clone from the same git repo I am using to store configuration. In the test project I pass credentials to git using the drop down (which I believe depends on the credentials plugin). I have no similar option in the SCM Synch plugin.

    Logged in as the jenkins userid I did the git config user.name myid; git config user.email my@email.com No luck ...

    1. I've got it with ssh://user@host:port/repository, because I have user's credentials stored previously when using Poll SCM in jobs.

      I hope be useful.

  42. If I destroy my Jenkins instance and hook this sync back up - will it work the other way too and repopulate Jenkins?

  43. How do I set this up to work with Bitbucket? When I put my repo url into the configuration I get the following error:

    "Repository <<>>. If youre sure it exists, verify that the OS user running Jenkins can actually access it. Check ssh keys, and verify that the OS user has user.name and user.email set."

  44. Hi Wasley,

    You have to add your SSH keys to you github account.

    look for details : https://help.github.com/articles/connecting-to-github-with-ssh/

    Thanks

  45. As others have said there are two bugs at play here:

    JENKINS-40375 - Getting issue details... STATUS

    JENKINS-27084 - Getting issue details... STATUS

    The proposed workarounds didn't work for me (Jenkins 2.70+, SVN 2.9)

  46. Hello!

    We are using this plugin and for now, we don't have major issues with it, even renaming jobs works as expected.

    But right now I want to add two additional files in configuration but I cannot manage to do that. I want to save files *custom-config-files.xml* and *groovy-config-files.xml* or even maybe all files that match "*-config-files.xml*.

     

    I tried many different patterns but none of them works. Are there any limitations on number of "custom includes" or something like that=

    Any help?

    Thanks, Primoz.

  47. 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://user-images.githubusercontent.com/21087997/35849029-e1771128-0b28-11e8-812e-d11632d74f35.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.

    1. https://i.imgur.com/uZhsQGJ.png
      Better picture of what the repo URL should look like.

  48. This plugin appears to have issues with the Bitbucket Multibranch/Pipeline plugin and how that one automatically creates/deletes jobs as it detects new branches on the remote. Our SCM Sync repository got in a bad state when this plugin started aborting syncs due to not finding the jobs/PipelineBranchjob/branches/OLDBRANCH and then when we manually tried deleting the parent job it started getting stuck on every attempted sync, to the point that it prevented login due to the number of errors on the screen, we had to "delete" the footer via Chrome DevTools to see the login screen and then we could login to have permissions to clear the sync errors (and disable the plugin while we cleaned up the repository).

    1. I just discovered this exact problem yesterday.
      What exactly did you do to clean up the repository?

      1. I haven't fully solved it yet, but this open bug seems promising,  JENKINS-37500 - Getting issue details... STATUS (and the large number of open/unanswered bugs will likely lead to us removing the SCM Sync plugin and simply managing a declarative instance of Jenkins where all changes are done via code and tested in Docker before applying to our critical instances).

  49. I'm getting this error. It actually checked in two files into the configured repository... config.xml (jenkins) and hudson.maven.MavenModuleSet.xml, but no others, even after hanging Jenkins for hours.

    Our jobs directory is quite large, is there any way to populate the repository offline?

    Mar 26, 2018 3:28:09 PM hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error
    WARNING: Failed to instantiate Key[type=org.jenkinsci.plugins.configfiles.ConfigFilesManagement, annotation=[none]]; skipping this component
    com.google.inject.ProvisionException: Unable to provision, see the following errors:

    1) Error injecting constructor, java.lang.IllegalStateException
    at org.jenkinsci.plugins.configfiles.ConfigFilesManagement.<init>(ConfigFilesManagement.java:62)

    1 error
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
    at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
    at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
    at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
    at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:477)
    at hudson.ExtensionList.load(ExtensionList.java:365)
    at hudson.ExtensionList.ensureLoaded(ExtensionList.java:303)
    at hudson.ExtensionList.iterator(ExtensionList.java:157)
    at jenkins.model.Jenkins.getDynamic(Jenkins.java:3626)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:372)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
    at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:49)
    at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:44)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationDataProvider.provideRequestDuring(ScmSyncConfigurationDataProvider.java:106)
    at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter.doFilter(ScmSyncConfigurationFilter.java:44)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)

Write a comment…