Perforce
This page describes how to configure Bamboo to use a Perforce repository.
You can specify repositories at the following levels in Bamboo:
- global – repositories are available to all plans in Bamboo.
- plan – repositories are available to all jobs in the Bamboo plan.
- job – repositories are available to all tasks in the Bamboo job.
The recommended approach is to set up linked source repositories at the global level – see Linking to source code repositories.
Configure a Perforce source repository
- Navigate to the repository configuration for a linked repository, plan or job. See Linking to source code repositories.
- Either select Add repository to add a new repository, or edit an existing repository configuration.
- Select Perforce from the Source repository list.
- Enter a Display Name to help identify the repository in Bamboo.
- You can configure the following settings for a Perforce source repository for your plan:
On this page:
Port
Type either the port to which the Perforce client will connect, or the Perforce server itself. This is the Perforce P4PORT environment variable that tells Bamboo which p4d (Perforce server) to use.
Client (Workspace) (3)
The name of the Perforce Client Workspace which Bamboo will use. The Client Workspace determines which portions of the depot are visible in your Workspace Tree.
Do not create two plans or jobs that use the same client (e.g. one client set to manage, the other client set to not manage). This setup will create major issues in your builds.
Depot view
The client view of the depot that contains the source code files for this Plan/Job. This is typically in the form //<clientname>/<workspace_mapping>/...
For details please see the Perforce User's Guide.
Bamboo sets the client root to its working directory, which means that code will be checked out to the working directory/<workspace_mapping>
location. Please take note of this, when specifying the Artifact copy pattern for your Build artifacts.)
Username
The Perforce username that Bamboo will use when it accesses the server (Port). Leave this field blank if you want Bamboo to use the default Perforce user (i.e. the OS username).
Password
Type the password required by the Perforce username (if applicable).
Let Bamboo manage your workspace (4)
This field indicates whether or not you want Bamboo to manage your workspace.
Use Client Mapping For Change Detection
Select this option if you use overlay mappings for your workspace. Your workspace must be available on the Bamboo Server.
Advanced Options
Enable quiet period
Specifies a delay after a single commit is detected before the build is started. This allows multiple commits to be aggregated into a single build.
Include/Exclude files
Allows you to specify the files that Bamboo should, or should not, use to detect changes.
Enter into File pattern a regular expression to match the files that Bamboo includes or excludes. The regex pattern must match the file path in the repository. See sub page for examples.
Exclude changesets
Enter a regular expression to match the commit messages for changesets that should not start a build.
Web repository
If your repository can be viewed in a web browser, select the repository type.
This allows links to relevant files to be displayed in the Code changes section of a build result.
Generic Web Repository
- Web repository URL – the URL of the repository.
- Web repository module — the particular repository required for this plan or job, if the Web repository URL above points to multiple repositories.
Stash – specify the following details for the repository:
- Stash URL – the URL of your Stash (now Bitbucket Server) instance (e.g. https://bitbucket.mycompany.com ).
- Stash project key – the key of the project in Stash (e.g. CONF).
- Repository name – the name of the repository in Stash (e.g. conf-dev).
Use this option to connect to a Bitbucket Server repository.
See Integrating Bamboo with Bitbucket Data Center for more information.
Fisheye – specify the URL and other details for the repository:
- Fisheye URL — the URL of your Fisheye repository (e.g.
https://atlaseye.atlassian.com/
). - Repository name — the name of your Fisheye repository (e.g.
Bamboo
). This is effectively the alias for your repository path. - Repository path — the path for your Fisheye repository (e.g.
/atlassian/bamboo/
).
- Fisheye URL — the URL of your Fisheye repository (e.g.
See Integrating Bamboo with Fisheye for more information.
How do I determine my Repository Path?
If you have previously run builds with changes from your repository, the easiest way of determining your repository path is to view the code changes and copy the path from the start of the path of one of the changed files, up to (but not including) the appropriate root directory. The root directories for repositories are the ones shown by Fisheye when browsing a repository (e.g. trunk
)). For example, if a code change listed /atlassian/bamboo/trunk/bamboo-acceptance-test/pom.xml
, the path would be /atlassian/bamboo/
.
If you have not previously run builds with changes from your repository, you will need to ask your Fisheye administrator for the repository path indexed by Fisheye.
Notes
- You will not be able to create plans or jobs that use a Perforce repository without specifying the shared local Perforce capability first. Read more about configuring a VCS capability.
- Keep your Perforce configuration up to date — If you are using Perforce as your repository, you must ensure your Perforce configuration in Bamboo is in sync with any changes to your Perforce repository (such as client, depot or user credential changes). If not, your Perforce repository changes may cause unexpected behavior in Bamboo when Bamboo tries to access the repository. See the notes in the configuration instructions below for further details.
- Issue when running Bamboo with Perforce prior to Bamboo 2.0.7 — A known issue exists when running Bamboo with Perforce prior to Bamboo 2.0.7 (See BAM-2866 and BAM-2849). If you change the name of your Perforce client (i.e. via an update) without updating your Perforce configuration in Bamboo, Bamboo will not be able to find the Perforce client to run against. Perforce will then create a default client in your running directory. This can lead to situations where Bamboo will attempt to clear out data from your running directory (e.g. force build). To avoid this problem, ensure that you update the Client in your Perforce configuration whenever you change your Perforce client.
- Please be aware of the following implications when either letting Bamboo manage or preventing Bamboo from managing your workspace:
- If you let Bamboo manage your workspace,
- We recommend this configuration if your jobs will be running on many different machines or different operating systems, as Bamboo sets the client root for you.
- Bamboo will make configuration changes to the Client Workspace to manage builds (e.g. Bamboo will modify the
host
androot
). You need to ensure that you enter a Client Workspace in the Client field that will be used solely for Bamboo. - Under this configuration, you should configure one client per job to avoid conflicts when updating the client root.
- If you do not let Bamboo manage your workspace,
- We recommend this configuration if you wish to reuse your client for several jobs, as Bamboo will retrieve the client root directory from Perforce and use it to run builds.
Setting the client root in Perforce: We strongly recommend that you choose a directory that is dedicated for Bamboo's use only, when you are specifying the client root in your Perforce repository. This directory may get cleaned (i.e. files and sub-directories deleted) if you choose to force clean builds. - Under this configuration, you need to ensure that the client root directory exists on all machines that the job will be built on.
- Please note that alternate roots does not currently work in Bamboo. See issue BAM-2377 for further details.
- We recommend this configuration if you wish to reuse your client for several jobs, as Bamboo will retrieve the client root directory from Perforce and use it to run builds.
- If you let Bamboo manage your workspace,