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

Scriptler API - SyncUtil.syncDirWithCfg not working

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • scriptler-plugin
    • Jenkins version 2.479.3
      JDK 21
      Scriptler plugin version 384.387.vb_5cb_a_f774857

      I have scripts under 

      /var/jenkins_home/scriptler/scripts

      and a valid configuration file -

      /var/jenkins_home/scriptler/scriptler.xml

      I am running the following - 
       

      import org.jenkinsci.plugins.scriptler.SyncUtil
      import org.jenkinsci.plugins.scriptler.config.ScriptlerConfiguration
      import org.jenkinsci.plugins.scriptler.ScriptlerManagement
      
      def scriptDirectory = ScriptlerManagement.getScriptDirectory2()
      def cfg = ScriptlerConfiguration.getConfiguration()
      SyncUtil.syncDirWithCfg(scriptDirectory, cfg)

      Nothing happens and the scripts are still not presented in Jenkins UI (Scriptler tab).
       
      Reboot fixes the issue (meaning, scripts are presented in UI), but this issue is a blocker for us and very critical.

      On version - 374.vd80c089c9164 it worked properly (ScriptlerManagement.getScriptDirectory() instead of ScriptlerManagement.getScriptDirectory2()) it worked properly.

       

      The following script also not working -

      import org.jenkinsci.plugins.scriptler.SyncUtil
      import org.jenkinsci.plugins.scriptler.config.ScriptlerConfiguration
      import org.jenkinsci.plugins.scriptler.ScriptlerManagement
      import java.nio.file.Path
      
      Path homeDirectory = ScriptlerManagement.getScriptlerHomeDirectory2()
      Path scriptDirectory = ScriptlerManagement.getScriptDirectory2()
      ScriptlerConfiguration cfg = ScriptlerConfiguration.load()
      SyncUtil.syncDirWithCfg(scriptDirectory, cfg)
      cfg.save() 

      As well as the following-

      import org.jenkinsci.plugins.scriptler.SyncUtil
      import org.jenkinsci.plugins.scriptler.config.ScriptlerConfiguration
      import org.jenkinsci.plugins.scriptler.ScriptlerManagement
      import java.nio.file.Path
      import org.jenkinsci.plugins.scriptler.ScriptlerLoadingTasks
      
      ScriptlerLoadingTasks.synchronizeConfig() 

          [JENKINS-75133] Scriptler API - SyncUtil.syncDirWithCfg not working

          Mark Waite added a comment - - edited

          Could you check an incremental build of PR-139 of the Scriptler plugin to see if it fixes your issue?

          Download link:

          Plugin Installation Manager input format: (documentation)

          scriptler:incrementals;org.jenkins-ci.plugins;397.v5c033988276c
          

          That incremental build is fixing JENKINS-75019 and hopefully you can confirm that it also resolves this issue.

          Mark Waite added a comment - - edited Could you check an incremental build of PR-139 of the Scriptler plugin to see if it fixes your issue? Download link: scriptler Plugin Installation Manager input format: (documentation) scriptler:incrementals;org.jenkins-ci.plugins;397.v5c033988276c That incremental build is fixing JENKINS-75019 and hopefully you can confirm that it also resolves this issue.

          Tomer added a comment -

          markewaite 

          Please provide me a fix for Jenkins version 2.479.3 as I'm not able to install 
          scriptler:incrementals;org.jenkins-ci.plugins;397.v5c033988276c
          on Jenkins version 2.479.3.

          Tomer added a comment - markewaite   Please provide me a fix for Jenkins version 2.479.3 as I'm not able to install  scriptler:incrementals;org.jenkins-ci.plugins;397.v5c033988276c on Jenkins version 2.479.3.

          Mark Waite added a comment -

          I compiled a version of that pull request with the requirement for Jenkins 2.482 removed. Can you try scriptler.zip and report your results?

          Mark Waite added a comment - I compiled a version of that pull request with the requirement for Jenkins 2.482 removed. Can you try scriptler.zip and report your results?

          Tomer added a comment -

          markewaite It didn't work. Same behavior.

          Tomer added a comment - markewaite It didn't work. Same behavior.

            Unassigned Unassigned
            tomer9000 Tomer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: