A Buildkite plugin that lets you check out code from Perforce Version Control on Windows, Linux and macOS platforms.
- Configure at least
P4PORTandP4USER(see examples below) - Provision with credentials - a
P4TICKETSfile is recommended - 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.
env:
P4PORT: perforce:1666
P4USER: username
steps:
plugins:
- improbable-eng/perforce: ~steps:
plugins:
- improbable-eng/perforce:
p4port: perforce:1666
p4user: usernameP4PORT may also be configured by setting BUILDKITE_REPO for your pipeline.
Note that this must consist of real depot paths like a regular workspace view. You cannot combine streams.
steps:
plugins:
- improbable-eng/perforce:
view: >-
//dev/project/... project/...
//dev/vendor/... vendor/...steps:
plugins:
- improbable-eng/perforce:
stream: //dev/minimalsteps:
plugins:
- improbable-eng/perforce:
stream: //dev/minimal
sync: //dev/minimal/.buildkite/...steps:
plugins:
- improbable-eng/perforce:
parallel: 16Useful to avoid syncing duplicate data with large workspaces. Only allowed when there is a single buildkite agent running on the machine.
steps:
plugins:
- improbable-eng/perforce:
stream: //dev/buildkite
# Sync each stream once
share_workspace: true
# Sync once and switch streams in-place (requires share_workspace: true)
stream_switching: trueThere 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
Committextbox.- Note you can also use more abstract p4 revision specifiers such as
@labelnameor@datespec
- Note you can also use more abstract p4 revision specifiers such as
- To build a shelved changelist - paste your changelist number into the
Branchtextbox.
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.
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/setup_env_osx.sh
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/test_perforce.py -k test_fixture
TBC, feedback welcome.
Making changes to python/
- Read implementation of
test_fixtureintest_perforce.py - Write unit test in
test_perforce.py, 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
maketo start p4d on localhost:1666, vendor the plugin, run the pipeline and kill p4d.