Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format of SVN "Included Regions" in Jenkins

When setting up "included Regions" on a Jenkins project, the help text mentions this:

If set, and Jenkins is set to poll for changes, Jenkins will ignore any files and/or folders that are not in this list when determining if a build needs to be triggered. Each inclusion uses regular expression pattern matching, and must be separated by a new line.

This is useful when you need to check out an entire resource for building, but only want to do the build when a subset has changed.

/trunk/myapp/c/library1/.*
/trunk/myapp/c/library2/.*

If /trunk/myapp is checked out, the build will only occur when there are changes to either the c/library1 and c/library2 subtrees. If there are also excluded regions specified, then a file is not ignored when it is in the included list and not in the excluded list.

It's still not quite clear to me what this "resource" is supposed to be.

Let's assume I check out part of a repository: https://svn.mydomain.com/repos/projects/myfancyproject/trunk

And let's also assume I check it out to a folder called "theproject"

Now, let's assume I only want the build to get triggered if something changes in the "documents/cat-pictures/" folder of the repo.

Am I supposed to put in:

  1. /trunk/documents/cat-pictures/.*
  2. /documents/cat-pictures/.*
  3. /repos/projects/myfancyproject/trunk/documents/cat-pictures/.*
  4. documents/cat-pictures/.*
  5. trunk/documents/cat-pictures/.*

Or even: Number 1 through 5 with a "theproject/" prefix

?

like image 423
Marc Seeger Avatar asked Sep 01 '11 13:09

Marc Seeger


People also ask

Does Jenkins work with SVN repository?

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't want to create a new project manually for every new branch in SVN.

How to perform polling on the Jenkins master using Subversion?

Version 1.21 of the Subversion plugin can perform the polling on the Jenkins master if the hudson.scm.SubversionSCM.pollFromMaster system property is set to true. The Subversion SCM plugin exports the svn revisions and URLs of the build's subversion modules as environment variables.

How do I export SVN revisions and URLs from subversion?

The Subversion SCM plugin exports the svn revisions and URLs of the build's subversion modules as environment variables. These are $SVN_REVISION_n and $SVN_URL_n, where n is the 1-based index of the module in the configuration.

How to configure subversion plugin to release from trunk or branches?

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?


2 Answers

If your repository is

https://svn.mydomain.com/repos/projects/myfancyproject/trunk

and you only want to build if something changes in documents/cat-pictures, you add the following to your inclusions list:

/trunk/documents/cat-pictures/*

which is 1 on your list.

In subversion, "trunk", "tags" and "branches" are only folders, and while they have seem to become standard names, they could be called "cats", "dogs", and "birds" if you wanted.

The root of your repository is at https://svn.mydomain.com/repos/projects/myfancyproject/, and so you put /trunk/documents/cat-pictures as your included region.

At least this is my understanding.

like image 118
Sagar Avatar answered Sep 28 '22 10:09

Sagar


Sagar's answer (#1 on your list) did not work for me. What did work was the entire Relative URL path (everything after the Repository Root), which are the changed paths you can see in svn log -v.

So my Jenkins Included Regions, to include only "RC" tags:

/code/products/foo/tags/.*RC.*

And two example revisions, showing changed paths that do and don't match:

> svn log -v -l2 svn+ssh://svn.foo.com/svnroot/code/products/foo/tags
------------------------------------------------------------------------
r175564 | joe | 2016-04-20 09:21:34 
Changed paths:
   A /code/products/foo/tags/1.1-RC1 

1.1 Release Candidate 1
------------------------------------------------------------------------
r175530 | jane | 2016-04-19 09:40:18
Changed paths:
   A /code/products/foo/tags/1.0

1.0 Release
------------------------------------------------------------------------

You can also find Relative URL in svn info:

> svn info svn+ssh://svn.foo.com/svnroot/code/products/foo/tags
Path: tags
URL: svn+ssh://svn.foo.com/svnroot/code/products/foo/tags
Relative URL: ^/code/products/foo/tags
Repository Root: svn+ssh://svn.foo.com/svnroot
like image 29
wallheater Avatar answered Sep 28 '22 08:09

wallheater