Configure Jenkins to work with SVN branches

前端 未结 3 1582
慢半拍i
慢半拍i 2021-02-01 06:58

I am currently setting up Jenkins to work with SVN repository. Currently it works fine for the trunk. Now I want to set up Jenkins to take care of newly created branches. I don\

相关标签:
3条回答
  • 2021-02-01 07:01

    Also check my extend answer if you are not very familiar with jenkins.

    It provides a step by step solution with screenshots.

    The subversion plugin is installed by default in recent versions(as for Sep 2015).

    Then you should configure your project as following:

    1. check "This build is parameterized"
    2. choose "List subverion tags (and more)"
    3. in the name field, set a varaiable name which can be referenced later in the svn url. I choose svnbranch here.
    4. in the Repository URL field, give it your project URL (which needs to contain trunk, branches, and tags)
    5. fill other field as your needs
    6. in source code management, reference the variable defined before in your repository url.

    check following screenshots:

    0 讨论(0)
  • 2021-02-01 07:20

    The Subversion plugin should include a drop-down build parameter option. You can include your base repository and then select either the branches, tags, or trunk.

    Check this out: How to configure a single Jenkins job to make the release process from trunk or branches?

    And more info here: https://issues.jenkins-ci.org/browse/JENKINS-10678

    0 讨论(0)
  • 2021-02-01 07:23

    We have a job for each branch and truck. If we have 30 projects, we have 30 trunk projects, and 30 projects for each branch we are currently using. That can be over a 150 jobs, but we use views to help separate them out. Very simple to use a branch (or even a tag) in Subversion: Simply use the URL that contains the branch.

    I copy my jobs manually whenever we create a new branch. I usually abhor a manual process (manual process => making a mistake => majorly messing up => getting fired => working in Walmart), but there's really only two changes that must be made in my job. I have to change the Subversion URL, and the description. Everything else is set to use Jenkin's defaults. No wacky working directory, no funky copying of build artifacts (we store those in Jenkins). We have about 30 or so jobs, and I can duplicate all of them in less than a half hour.

    I've simply had problems with the automation, and if I have to go through all the jobs anyway to make sure everything is fine, I might as well do it manually.

    You could parameterize your builds. That is, have the user enter the branch's name (or select it from a drop down list. This means creating a single job for all of your branches. However, that defeats the continuous build aspect of Jenkins since you have to manually trigger each job.

    Some sites have scripts that can mass produce a new branch. You simply need to copy the config.xml (and a few other files) from under one job and modify it. Some sites have created template jobs that make this a bit easier. The template jobs are disabled, and thanks to the REST API, it's easy to enable jobs via wget. They simply duplicate their template jobs, modify a few parameters, and then reenable all of those jobs.

    There's a JobCopy builder Plugin that allows you to define template build projects, and then replace strings in the template to create actual jobs.

    There's also an Ant script on the Jenkins Wiki that duplicates jobs for you.

    0 讨论(0)
提交回复
热议问题