Skip to content
A buildkite plugin for checking out code from Perforce
Python Shell Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite Ensure makefile flow lives inside checkout dir (#147) Feb 17, 2020
ci TravisCI runs integration tests (#157) Feb 25, 2020
dev Ensure makefile flow lives inside checkout dir (#147) Feb 17, 2020
examples Add example p4trigger written in python (#84) Jun 10, 2019
.travis.yml TravisCI runs integration tests (#157) Feb 25, 2020
Makefile Update Feb 20, 2020
plugin.yml Throw exception when 'root' plugin setting is used by people (#105) Aug 8, 2019

Perforce Buildkite Plugin Build Status

A Buildkite plugin that lets you check out code from Perforce Version Control

  1. Configure at least P4PORT and P4USER (see examples below)
  2. Provision with credentials - a P4TICKETS file is recommended
  3. Optionally customise workspace mapping.

The P4CLIENT, P4USER and P4PORT used by the plugin are written to a P4CONFIG file at the workspace root and the P4CONFIG env var is set, so build scripts are able to automatically pick up configuration for any further interactions with Perforce.


Configuration via env vars:

  P4PORT: perforce:1666
  P4USER: username

    - improbable-eng/perforce: ~

Configuration via the plugin:

    - improbable-eng/perforce:
      p4port: perforce:1666
      p4user: username

P4PORT may also be configured by setting BUILDKITE_REPO for your pipeline.

Custom workspace view:

Note that this must consist of real depot paths like a regular worspace view. You cannot combine streams.

    - improbable-eng/perforce:
      view: >-
        //dev/project/... project/...
        //dev/vendor/... vendor/...

Workspace view via a p4 stream:

      - improbable-eng/perforce:
          stream: //dev/minimal

Partial sync of a stream

      - improbable-eng/perforce:
          stream: //dev/minimal
          sync: //dev/minimal/.buildkite/...

Enable parallel sync

      - improbable-eng/perforce:
          parallel: 16

Share a stream workspace between pipelines.

Useful to avoid syncing duplicate data with large workspaces. Only allowed when there is a single buildkite agent running on the machine.

      - improbable-eng/perforce:
          stream: //dev/buildkite
          share_workspace: true

Triggering Builds

There are a few options for triggering builds that use this plugin, in this order from least valuable but most convenient to most valuable but least convenient.


Relies on people within your team manually clicking New Build within the BuildKite UI.

  • To build current head revision on the server - accept the defaults.
  • To build a specific revision - paste the revision number into the Commit textbox.
    • Note you can also use more abstract p4 revision specifiers such as @labelname or @datespec
  • To build a shelved changelist - paste your changelist number into the Branch textbox.


Schedule builds with a cron in buildkite - this requires no additional setup, but provides the worst response time as changes are made


A service polls your perforce for the current head revision and POSTs to the Buildkite API to trigger builds for any new changes. Note that you will need to store state to avoid duplicate and skipped builds.

p4 trigger

Set up a p4 trigger which POSTs to the buildkite API to trigger a build. See p4 triggers for more information. Note that this will require admin access to the Perforce server.



Run dev/

Python virtualenv .dev-venv for running tests will be created at repo root.

Run the test_fixture unit test to check everything is setup correctly:

source .dev-venv/bin/activate
pytest python/ -k test_fixture


TBC, feedback welcome

Suggested workflow

Making changes to python/

  • Read implementation of test_fixture in
  • Write unit test in, optionally making changes to the test fixture if required
  • Implement new functionality
  • Iterate via unit test

Making changes to hooks/ and scripts called by hooks

  • Add entries to local-pipeline.yml to test new behaviour, if relevant
  • make to start p4d on localhost:1666, vendor the plugin, run the pipeline and kill p4d.
You can’t perform that action at this time.