BuildMaster Documentation

Integrating BuildMaster with Subversion (SVN)

  • Last Modified: 2020-02-26

Before the introduction of Git, Apache Subversion was the industry standard for open-source source control systems. Although Git now dominates, Subversion (or SVN) is still very commonly used for many open-source projects by organizations around the world.

BuildMaster is designed to work with Subversion to provide a self-managed CI/CD solution and supports the following source control functionality:

OperationDescription
CheckoutChecks out a working copy from a repository
UpdateBring changes from a repository into a working copy
ExportGets the unversioned contents of a repository to a specified directory
CopyCreates a copy of a source path to facilitate branching and tagging
DeleteDeletes a file in a repository

See it live! See an example of Subversion integration by creating a new application using the SVN CI/CD template.

Installing the Subversion Extension

Simply navigate to the Admin > Extensions page in your instance of BuildMaster and click on the Subversion extension to install it.

If your instance doesn't have Internet access, you can manually install the Subversion extension after downloading the Subversion Extension Package.

Authenticating to a Subversion Repository

The simplest and recommended method to connect to a Subversion repository is by creating a "Subversion Repository" Secure Resource. If your repository requires authentication (most do), you can associate that secure resource with a Username & Password Secure Credential.

While each SVN operation supports supplying a repository URL, username, and password, we recommend creating a resource credential that includes the repository name, username, and password. This is not only more secure, but it is also more convenient, as the credentials are stored in one location.

SSH connections are not supported using the built-in Subversion integration in BuildMaster, so make sure to use the HTTPS endpoint when supplying the repository URL to the resource credentials or any operations. If your organization requires SSH to connect, you must install and configure the SVN CLI manually and then instruct BuildMaster to use the SVN CLI instead.

Source Control Integration

Subversion functions both for source control and continuous integration, and BuildMaster supports both. The most common use-case when working with Subversion is getting the latest source code (e.g., trunk) then building it and creating a build artifact.

Checking Out the Latest Source Code from a Subversion Repository

To check out the latest source code from SVN, you can use the Svn-Checkout operation within your plan:

Svn-Checkout(
    RepositoryUrl: https://github.com/inedo/inedox-subversion.git,
    SourcePath: trunk,
    To: ~\Sources
);

Note that, for illustrative purposes, this example is not using a Subversion Repository Secure Resource as we recommended.

This operation effectively runs the equivalent SVN command:

svn.eve checkout https://github.com/inedo/inedox-subversion.git

Note: the .git extension works in this case because GitHub also supports Subversion clients.

Checking Out Branches in Subversion

In Subversion, branches are simply separate paths in the source tree. Many organizations use branches to determine the specific code that will be built for a given release. Branches allow teams to work simultaneously on the same project without overwriting another team member's work or presenting risks to the source code.

In BuildMaster, checking out a branch is as easy as updating the SourcePath:

Svn-Checkout(
    RepositoryUrl: https://github.com/inedo/inedox-subversion.git,
    SourcePath: branches/v1.2.5,
    To: ~\Sources
);

A more general approach is using BuildMaster functions (e.g. SourcePath: branches/$ReleaseNumber), configuration variables, or even release template variable prompts that enable the branch to be selected at build time.

Branching and Tagging in Subversion

As noted earlier, branches are simply separate paths in source code. Branches could be created automatically at any stage during a pipeline, for example, to create a "release" branch for the next release in your application cycle.

To create a branch in Subversion, use the Svn-Copy operation:

Svn-Copy(
    RepositoryUrl: https://github.com/inedo/inedox-subversion.git,
    From: trunk,
    To: branches/v$ReleaseNumber
);

This operation executes the equivalent SVN command when run under the context of release 1.2.5:

svn.exe copy trunk branches/v1.2.5

Similarly, tagging in Subversion follows the same process of copying source paths; in SVN, "tagging" and "branching" function the same way (i.e., copying a path). Tags can be thought of as "read-only snapshots" of code in a repository at a particular moment in time where the tag is a descriptive identifier (e.g. Release-1.2.5).

To create a tag in Subversion, use the Svn-Copy operation:

Svn-Copy(
    RepositoryUrl: https://github.com/inedo/inedox-subversion.git,
    From: trunk,
    To: tags/Release-$ReleaseNumber
);

This operation runs the equivalent SVN command:

svn.exe copy trunk tags/Release-1.2.5

Because the branching/tagging operations require write access, they will likely require authentication with the repository.

Continuous Integration

Another SVN use-case is for CI, and BuildMaster's repository monitor smoothly integrates with SVN for continuous integration.

Automated Builds

BuildMaster supports automatically monitoring a Subversion repository for changes, no matter where it is hosted. Simply, BuildMaster regularly checks SVN to see if new revisions have appeared, and finding new changes, BuildMaster will automatically create a new build in BuildMaster.

To automatically create builds when developers commit to a Subversion repository, simply configure a Repository Monitor.

Note: a Subversion repository monitor requires BuildMaster v6.1 or later in combination with v1.1.0 or later of the Subversion extension.

Available Variables

When using a repository monitor plan, the following variables are available:

  • $Branch - the full path of the branch, e.g. branches/develop-1.2.3
  • $RevisionNumber - the highest integer revision number of any file within the specified path

Built-in Subversion Client vs. svn CLI

By default, BuildMaster does not require SVN to be installed on a build server in order to perform source control operations. However, some users who require more advanced configuration for their SVN integration may instruct BuildMaster to run the CLI instead by:

  • setting the SvnExePath operation property to a valid SVN executable path, e.g. /usr/bin/svn on Linux or C:\Program Files\Subversion\bin\svn.exe on Windows
  • configuring a $SvnExePath variable at the server or system level in BuildMaster; this will force all Subversion source control operations to use the CLI instead of the built-in library

Is this documentation incorrect or incomplete? Help us by contributing!

This documentation is licensed under CC-BY-SA-4.0 and stored in GitHub.

Generated from commit b86c9ae8 on master