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

Scripts are not getting approved , when I post the updated config.xml with api using Admin credential and token

      with the script security plugin recent version - 1275.v23895f409fb_d , when we post confix.xml using REST API with Admin credential and token , the updated config.xml is not being approved automatically. 

      We have to go into the scriptApproval page and approve the scripts.

      Earlier the approval used to happen automatically using the Admin gui.

      It would be very helpful if there is a way to approve scripts without having to manually approve them using the GUI.

      Actually, we are working on a feature to add / remove a parameter from pipelines based on flags provided by user. so we need a way to automatically approve the config.xml of a pipeline without requiring manaul process with GUI.

      Jenkins version:- 2.426
      Operating system :- Oracle Linux Server 8.8

          [JENKINS-72239] Scripts are not getting approved , when I post the updated config.xml with api using Admin credential and token

          Markus Winter added a comment -

          You need to start Jenkins with -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true

          Markus Winter added a comment - You need to start Jenkins with -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true

          Daniel Beck added a comment - - edited

          The current behavior is deliberate: https://github.com/jenkinsci/script-security-plugin/releases/tag/1265.va_fb_290b_4b_d34

          You're asking for a new feature.

          Daniel Beck added a comment - - edited The current behavior is deliberate: https://github.com/jenkinsci/script-security-plugin/releases/tag/1265.va_fb_290b_4b_d34 You're asking for a new feature.

          Harsha added a comment -

          Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true

          How should I use this line, 
          In our jenkins installation we use the java below process 

          java -Djava.awt.headless=true  -jar /usr/share/java/jenkins.war --httpPort=8080 

          should it be added like below
          java -Djava.awt.headless=true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true  -jar /usr/share/java/jenkins.war --httpPort=8080 

          Harsha added a comment - Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true How should I use this line,  In our jenkins installation we use the java below process  java -Djava.awt.headless=true  -jar /usr/share/java/jenkins.war --httpPort=8080  should it be added like below java -Djava.awt.headless=true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true  -jar /usr/share/java/jenkins.war --httpPort=8080 

          Markus Winter added a comment -

          yes I just looked up the code and I think you will also need a second property:

          java -Djava.awt.headless=true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ALLOW_ADMIN_APPROVAL_ENABLED=true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED=true  -jar /usr/share/java/jenkins.war --httpPort=8080 

          Markus Winter added a comment - yes I just looked up the code and I think you will also need a second property: java -Djava.awt.headless= true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ALLOW_ADMIN_APPROVAL_ENABLED= true -Dorg.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.ADMIN_AUTO_APPROVAL_ENABLED= true  -jar /usr/share/java/jenkins.war --httpPort=8080

          Harsha added a comment -

          Thank you will try the give solution.

          Harsha added a comment - Thank you will try the give solution.

            Unassigned Unassigned
            harsha_vardhan_987 Harsha
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: