How to add some prebuild steps to jenkins?

11,714

Solution 1

Tell Jenkins about the SVN repository and it will check it out automatically when a new build is started. That should take care of 1. 2-5 would be build steps (i.e. execute shell commands). Basically, you can set up Jenkins to do exactly what you do on the command line, except that the first step is taken care of automatically if you tell Jenkins about the repository.

Solution 2

Rather than trying to do these sort of things in Jenkins, you'll likely save yourself some trouble if you make use of something like Ant or NAnt to handle the complexities for your build.

I've found that doing my builds this way gives me added flexibility (ie, if it can be done via the command-line, I can use it in my build, rather than needing a Jenkins plugin to support it), and makes maintenance easier as well (since my NAnt scripts become part of the project and are checked into the VCS system, I can go back if I make a change that doesn't work out.

Jenkins has some build-history plugins, but over time I've found it easier to keep the majority of my 'build' logic and complexity outside of the CI environment and just call into it instead.

Share:
11,714
jini
Author by

jini

Updated on June 15, 2022

Comments

  • jini
    jini almost 2 years

    I am a Jenkins newbie and need a little hand holding because we only maintain parts of our app in SVN. I have basic Jenkins install setup.

    This is what I do to get a local DEV environment setup and need that translated to Jenkins in order to make a build:

    1. DO SVN checkout (and get the 2 folders that are under SVN)
    2. Delete the folders
    3. Copy over the full app from FTP location
    4. Do SVN restore
    5. download sql file
    6. Import into MySQL

    How would I get the above mentioned steps in Jenkins? I know there are some post build steps that I can use. Just not sure how to put it all together. Any help will be much appreciated.