broker.conf #1

  • //
  • guest/
  • perforce_software/
  • cbd/
  • main/
  • broker/
  • broker.conf
  • View
  • Commits
  • Open Download .zip Download (8 KB)
#-------------------------------------------------------------------------------
# Sample p4broker configuration file
#
# The following paragraphs illustrate the configuration of the Perforce
# Broker by example. Change the values and configuration to suit your 
# environment and requirements.
#
# Note that by default this broker will simply allow all commands to pass
# through, and be executed against the target server. Uncomment and edit
# the examples below to get started.
#-------------------------------------------------------------------------------

target		= localhost:1666;
listen 		= 2666;
zeroconf	= false;
server-name	= "CBD Broker";
server-desc	= "CBD Broker";
directory 	= /home/rdefauw/P4Servers/b.2666;
logfile 	= broker.log;
debug-level 	= server=1;
admin-name 	= "Perforce Admins";
admin-phone 	= 999/911;
admin-email 	= perforce-admins@example.com;

# Optional user account to authenticate the broker to the target server with.
#service-user    = "svc-user-broker";

# Optional alternate P4TICKETS location.
#ticket-file     = "/home/perforce/p4-broker/.p4tickets";

#
# Redirection mode. Pedantic redirection always redirects when instructed
# to do so. Selective redirection permits redirection within a session
# until a command has been executed against the target server. Selective
# redirection is the default as it gives GUI users a better experience
# when replication delays might otherwise cause incorrect results to be
# returned.
#
redirection	= selective;
#redirection 	= pedantic;

#-------------------------------------------------------------------------------
# Definitions of all altservers in the environment.
#-------------------------------------------------------------------------------

# Note that the altserver name can not be 'random' as that is reserved for use
# in the destination field of command handlers to specify that the altserver
# should be chosen randomly.
#
#altserver: replica_name
#{
#    # 
#    # Address of target server. Note that target servers must be configured
#    # to use P4AUTH to ensure that login tickets are valid for all servers in
#    # the brokered environment.  I.e. the target and alternate servers must
#    # share their authentication.
#    #
#    target	= localhost:1669;
#}

#-------------------------------------------------------------------------------
# Command policies
#-------------------------------------------------------------------------------

#
# The general syntax is:
#
# command: <regex pattern>
# {
# 	# Conditions for the command to meet (optional)
#	# Note that with the exception of 'flags', these are regex patterns.
# 	flags		= <required flags>;
# 	args		= <required arguments>;
#	user		= <required user>;
#	workspace	= <required client workspace>;
#	prog		= <required client program>;
#	version 	= <required version of client program>;
#
#	# What to do with matching commands (required)
#	action	= pass | reject | redirect | filter ;
#
#	# How to go about it
#	destination = <altserver>;		# Required for action = redirect
#	execute	= <path to filter program>;	# Required for action = filter
#	message = <rejection message>;		# Required for action = reject
#}
#
# Note that when specifying regex patterns, bare strings like 'integ' will also
# match 'integrate'.  To match an exact string, append the beginning/end of line
# anchors.  E.g. '^integ$'.
#

##
# Workspace creation
# Args: 
#  1. Configuration
#  2. Workspace name
##
command: wscreate
{
    action = filter;
    execute = "./scripts/wscreate.sh";
}

##
# Workspace switching
# Args: 
#  1. Configuration
#  2. Workspace name
##
command: wsswitch
{
    action = filter;
    execute = "./scripts/wsswitch.sh";
}

##
# Configuration adding
# Args:
# 1. Configuration name
# 2. Configuration XML data
##
command: submit
{
    flags	= -A;
    action = filter;
    execute = "./scripts/cfgadd.sh";
}

##
# Configuration updating
# Args:
# 1. Configuration depot path
# 2. Configuration XML data
##
command: submit
{
    flags	= -Q;
    action = filter;
    execute = "./scripts/cfgupdate.sh";
}

##
# Configuration deleting
# Args:
# 1. Configuration depot path
##
command: submit
{
    flags	= -Z;
    action = filter;
    execute = "./scripts/cfgdelete.sh";
}

## 
# filter unshelve
##
command: unshelve
{
    action = filter;
    execute = "./scripts/wsunshelve.sh";
}

## 
# filter reconcile/status
##
command: reconcile
{
    action = filter;
    execute = "./scripts/wsreconcile.sh";
}
command: status
{
    action = filter;
    execute = "./scripts/wsreconcile.sh";
}

## 
# filter sync/update
##
command: sync
{
    action = filter;
    execute = "./scripts/wssync.sh";
}
command: update
{
    action = filter;
    execute = "./scripts/wssync.sh";
}
command: flush
{
    action = filter;
    execute = "./scripts/wssync.sh";
}

##
# check access policies on add/edit/delete
##
command: edit 
{
    action = filter;
    execute = "./scripts/wsedit.sh";
}
command: add
{
    action = filter;
    execute = "./scripts/wsadd.sh";
}
command: delete
{
    action = filter;
    execute = "./scripts/wsdelete.sh";
}

##
# check acess policies on merge operations
# (those that take branch spec arguments)
##
command: merge
{
    flags	= -b;
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: copy
{
    flags	= -b;
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: integ
{
    flags	= -b;
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: populate
{
    flags	= -b;
    action = filter;
    execute = "./scripts/wsmerge.sh";
}

##
# check acess policies on merge operations
# (those that take source/target pairs)
##
command: merge
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: copy
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: integ
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: move
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: populate
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}
command: rename
{
    action = filter;
    execute = "./scripts/wsmerge.sh";
}

##
# check acess policies on submit
##
command: submit
{
    action = filter;
    execute = "./scripts/wssubmit.sh";
}

# Uncomment the lines below to block all access to the server during
# periods of maintenance.
#
#command: .*
#{
#    action	= reject;
#    message	= "Server down for maintenance. Back soon";
#}

#
# Allow user 'tony' to run 'p4 opened -a'.
# 
#command: opened
#{
#    flags	= -a;
#    user	= tony;
#    action	= pass;
#}

#
# Forbid the use of 'p4 opened -a' to everyone else.
#
#command: opened
#{
#    flags	= -a;
#    action	= reject;
#    message	= "You don't need to know that";
#}

#
# Use of the 'p4 changes' command is filtered. The script might decide
# that requests for information about older changes can be served by
# an alternate server.
#
#command: changes
#{
#    action	= filter;
#    execute	= ./check_changes.rb;
#}

#
# Redirect all 'p4 users' commands to another server. Not a very useful
# example; good cases for wholesale redirection are hard to come by and
# great care should be exercised when using this action.
# 
#command: users
#{
#    action	= redirect;
#    destination = replica;
#}

# When the destination is 'random', the altserver is chosen arbitrarily.
# 
#command: fixes
#{
#    action	= redirect;
#    destination = random;
#}

#
# Only allow users named "super-something" to run 'p4 protect' or 'p4 admin'.
#
#command: admin|protect
#{
#    user = ^super-;
#    action = pass;
#}
#
#command: admin|protect
#{
#    action = reject;
#    message = "permission denied.";
#}

#
# Reject programs that don't identify themselves.
#
#command: .*
#{
#    prog = ^$|unknown;
#    action = reject;
#    message = "Unnamed programs disallowed.  API programs can call SetProg().";
#}

#
# Prevent commands against //... and //depot/...
#
#command: .*
#{
#    args = ^//[^/]*/?\.\.\.;
#    action = reject;
#    message = "Some commands just want to watch the database churn.";
#}

# Change User Description Committed
#2 11356 C. Thomas Tyler Promotion from Dev Branch.

       What's included:
       * CBD scripts for Streams as demonstrated at Merge 2014.
       * Deletion of files from the original PoC that aren't needed.

       What's coming later, still work in progress on the dev branch:
       * Documentation.
       * Test Suite with complete Vagrant-based Test Environment.
       * CBD scripts for Classic.
#1 11196 C. Thomas Tyler Added CBD sample logic.
 It was developed by Randy DeFauw as a PoC,
and mentioned at the Perforce MERGE 2013 User Conference.

This PoC explores a broad spectrum of CBD challenges, and thus is
complex.  Actual production implementations derived can be simpler.

This implementation works with Classic Perforce only; support for
Streams is possible.
//guest/randy_defauw/cbd/broker/broker.conf
#1 8278 Randy DeFauw Import component development tool kit