Skip to end of metadata
Go to start of metadata

Plugin Information

View Pre SCM BuildStep on the plugin site for more information.

This plugin allows build step to run before SCM checkouts so that you perform any build step action on the the workspace, (cleanup, add a file with some settings for the SCM, etc) or call other scripts that need to be run before checking out from the SCM.

Configuration example

This plugin was written to provide a build step point where a perl script can be run after detecting changes in the polling but before the SCM does the checkout. To make it more usable and flexible it was decided to allow any number of build steps to be added and called.

Warnings on the use of this plugin

Be Careful

  • The SCM may modify or remove any files that are in the workspace, before the main build steps.
  • Enviroment variables may not exist at this point, if they are created by other plugins, check using a shell script and the env (unix) or equivalent for your executor system.

Warning

  • IMPORTANT: Failed build steps will not cause the job to fail at this point, and all build steps will be called regardless of the result.

History

Version 0.2 (Feb 19, 2012)

Version 0.1 (Aug 23, 2011)

  • First release

12 Comments

  1. It is possible to inject environment variables and access them in the pre-scm-buildstep with EnvInject plugin.

  2. It should be possible but I don't know at which point the environment variables are added, if they are added before the perform method they will be available.

    You can give it a try and print the list of variables in a shell or windows script build step to see what is available, 

    1. It's not a question but an assertion.
      You are able to use the EnvInject plugin to inject environment variables and execute scripts before the pre-scm-buildstep execution.

  3. I use this plugin to map a network drive on a slave machine before checking out from the SCM on that network drive. Very useful plugin!

    Everything works fine as long as it is not the first time the job runs on a slave machine, because the plugin tries to execute (in my case, a windows batch command) from the job's workspace, which has not been created yet.

    It would be nice if the plugin would create the workspace folder if it doesn't exist and the perform its tasks.

    Thanks!

    1. I have exactly the same problem in a linux environment.

      The first time the job is run, the workspace does not exist (as it is apparently created during the SCM phase). The problem is that using this plugin, ANY scripts that are run will fail because they use the workspace as the current directory. So I can't even write a shell command/script to create the directory.

      Overall this plugin is really useful for us but it would really help if you could release a fix for this issue.. because right now it really doesn't look good when the first build is failing.. in an environment like ours with a lot of build agents this creates a lot of disruption (and headaches for me!)

      I have raised this as a bug in jira:

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

    2. Additionally, I suggest that you should look at the EnvInject plugin.
      This plugin enables you to prepare an environment and the job startup, and this issue is resolved.

  4. Thanks you so much ! It's exactly what I needed !

  5. Hello,

    I'm encountering what I believe is a defect with this plugin. However, I'm still a Jenkins newbie, so can't say for certain it's not something stupid on my end.  Steps I do to reproduce every time are as follows:

    ------------
    1.) Add a "Conditional steps (multiple)" item to the Prebuild section of my multiple configuration job.
    2.) Use "Strings Match" as the type (don't think this matters).
    3.) "Add step to condition".  Select one or more steps to put under this condition.
    4.) Click "Save" button and exit the job.
    5.) Re-"Configure" the Job.  The steps added under the multi-conditional step are now gone.  No matter what I do, I am unable to add steps under the multiple conditional step.
    Note: I am able to add multi-conditional steps to my project in the normal "build" location.

    Any help resolving this would be greatly appreciated.  If this is indeed a defect, I'll gladly raise it as a bug in jira.

    Thanks!

    1. Can you raise this as an issue, as I have reproduced it, but do not have the time to see if it is this plugin or the conditional buildstep one.

      as checking the config.xml for this shows that the <conditionalbuilders/> is empty in this case, so might be in how the conditional build step store this information.

  6. Is there a workaround to this issue?

    • IMPORTANT: Failed build steps will not cause the job to fail at this point, and all build steps will be called regardless of the result.

    Or can anyone recommend a different plugin to use?  Thanks for any help.

  7. Is there a possibility to run other Jenkins Jobs before checking out SCM?