Child pages
  • Managed Script Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View Managed Scripts on the plugin site for more information.

Managed scripts are shell scripts which are managed centrally by an administrator and can be referenced as a build step within jobs.

Description

The scripts are managed by the Config File Provider Plugin, go to the "Manage Jenkins" screen and click on the "Managed files" item.

After installing the "Managed Scripts" plugin, you have a new option to create a managed script in the type list.

Now you get to the screen to create your script. You're able to give it a name and a small description. In addition, you have the option to define a list of arguments you want to inform the users about. These arguments will be shown to the user as a hint and within the script you're able to reference these as if you would pass in arguments on the command line ($1, $2,...). Every environment variable from within a build will be visible to the script, too. 

Within the job, a user is able to select the required script from a drop-down menu. The defined parameters are shown in respect to the selected script. The link enables the user to have a read-only look at the script.

Version History

1.4 (August 15, 2017)

  • fix JENKINS-45399 View selected scripts doesn't show correct script
  • fix JENKINS-42888 Missing argument labels when adding managed script as build step

1.3 (Dec. 27, 2016)

  • update to latest Config File Provider Plugin (1.5) and therefore now supports CloudBees Folders Plugin
    the update of the config file provider plugin causes the configuration to be migrated to a new format and therefore a rollback to the former version will not be supported!

1.2.4 (Sep. 10, 2016)

  • add support for custom script ids to ease reuse of scripts with pipeline integration of config-file-provider-plugin

1.2.1 (May 18, 2015)

  • add support for tokenizing of shell script arguments; allows decomposing the given value of each argument into multiple arguments by splitting via whitespace.

1.2 (May 11, 2015)

  • add support for PowerShell PR #5

1.1.2 (July 18, 2014)

  • integrate PR #4  set codemirror mode based on shebang line (thanks to domruf)
  • integrate PR #3 correct spelling mistake (thanks to stevehollaar)

1.1.1 (Dec. 12, 2013)

  • integrate pull #2: show script argument labels (thanks to Ann Campbell)

1.1 (May 19, 2013)

1.0.2 (March 10, 2013)

1.0.1 (Oct 11, 2012)

  • fix issue when Jenkins is running with a different root context - details of scripts could not be opened

1.0 (15. April 2012)

  • New Feature JENKINS-12365: Add support for managed .bat scripts for Windows

0.2.0 (20. Jan. 2012)

0.1.0 (31. Dec. 2011)

0.0.1 (10. Nov. 2011)

  • initial

Help and Support

 

For Help and support please use the Jenkins Users mailing list.
The comment list below is not monitored.

type key summary

Data cannot be retrieved due to an unexpected error.

View these issues in JIRA

18 Comments

  1. Hi,

    I found the plugin feature to be really useful for my build setup. I tried configuring my Jenkins jobs using the plugin, but if I am using IE 7 browser to configure the config files, i am not able to save my changes. Looks like the issue persists with other versions of IE as well. Though when I tried in mozilla it works great.

    Thanks

    -Dev

  2. One minor UI tweak would be really helpful: To make the Argument fields (under the "Define script arguments" option) wider - so that they would be just as wide as text fields for other build phases. Currently they're so narrow that they hide part of argument values.

  3. Hi,

    I use this plugin to build a project using a parameterized job and it works fine on ALL nodes. BUT when I run the job on the nodes at the same time (parallel) some builds fails.

    Console output:/bin/sh: Can't open build_step_template8175713510991411679.sh
    or
    /bin/sh: build_step_template8175713510991411679.sh no such file or directory.

    The file is in the workspace on the node.

    Has any one similar problems?

    Thanks.

  4. Maybe this is really obvious, and I'm just overlooking it, but once I create a reusable groovy script, how can I call that in a build step?  When I selected managed scripts, it's not an option.  Any advice?

    edit:
    Looks like the reusable groovy script actually comes from the Config File Provider plugin, so i'll go down that route.

    1. It is not clear to me... does this plugin also allow for Groovy programs to be shared across build steps? 

      The UI shows that I can create a "reusable groovy script"; however, I have not been able to get it to work.

  5. Lost section "Managed script file" and all saved scripts after Jenkins upgrade!
    See issue https://issues.jenkins-ci.org/browse/JENKINS-13369

  6. Critical issue with managed scripts is resolved in released v0.3.

    But version 0.3 still has some issues with management sections. See
    JENKINS-13392. Config File Management shows broken icon and missing section descriptions.

  7. Hello.  I'd like to make a request.  Would it be possible to log the script execution?  If I do a normal script via "Execute Shell" then the entire script execution is logged in my job log.  But putting the script in "Managed Script Plugin" only logs:executing script 'PreTest'
    workspace $ /bin/sh /tmp/build_step_template7628074047393554615.sh FALSE

    It would be much better for debugging if it's logged fully.

    Thanks.

    1. Seems that I cannot edit my post.  Just clarifying what's logged;

      executing script 'PreTest'
      workspace $ /bin/sh /tmp/build_step_template7628074047393554615.sh FALSE
      
    2. Never mind.  I just added "set -vx" to the beginning of my script and that did the trick.  I guess Jenkins adds something like that when it builds it's temp .sh file for execution.

  8. Is there a way for a managed script to call another managed script? The only way I can think of is using "Provide configuration files" to copy the script, and pass its path to the other script. This requires additional configuration in all my jobs, however. If there was a way to directly call another script, it would make things easier.

    I'm using mostly windows batch files at the moment.

  9. Does anybody figured out how and where to use 'Groovy file - a reusable groovy script'?| Tried to get it work unsuccessfully with Groovy Postbuild plugin. Please help.  || |

  10. Awesome plugin! How do I use it in a pipeline job though?

    1. you can get hold of any managed script via the Config File Provider Plugin - and then e.g. execute with a normal shell step

  11. Hi,

    We have been using this plugin for a while, but we miss the ability to pass password parameters. Right now we can only pass clear text passwords to the managed scripts.

    Can this be made?

    1. We need the same feature.

  12. Please help me how can I do bulk sharing using the plugin and thank for learning about Managed scripts plugins and I totally get help from Config File Provider Plugin. 

    custom essay writers UK

  13. Would be great if could run Groovy as Build step rather than "Build Environment" (ex: possible alternative to Scriptler) 

Write a comment…