# This is the config file for various workflow triggers: # - CreateSwarmReview.py # - CheckSubmitHasReview.py # - DefaultSwarmReviewDesc.py # - RequireJob.py # In an SDP installation the default location is /p4/common/config # But it can be specified on the command line (so in trigger table entry) # It is a standard Yaml format - when in doubt put quotes around string values! # api: API version for Swarm. "api/v6" is 2017.2 api: "api/v6" # user: Perforce user name to access Swarm as user: p4swarm # ticket: P4 Ticket for the above user - generate with: # p4 -u <username> login -ap ticket: AA1233C0FD5EF69605B08070AFB86711 # review_description: The default review description. # Can be a single quoted string (with embedded '\n' for newlines, or an array of quoted strings. # The values $jobDescription and $changeDescription if found will be expanded as # appropriate. review_description: - "$jobDescription" - "" - "<Please edit these fields as desired>" - "Review type: Delta/Full" # ------------------------------------------ # For CheckFixes.py # Note the use of fix_allowed_paths per project. # fix_state_field: the name of the field in the Perforce job spec fix_state_field: "JiraStatus" # link_allowed_states: An array of values for fix_state_field in which links are allowed to be created # or deleted between jobs and changelists fix_allowed_states: - "Accepted" # msg_cant_link_jobs: An array of lines for the message # For legibility it is good to have the first line blank msg_cant_link_jobs: - "" - "You are not allowed to link changes to or unlink changes from these jobs" - "because of the state of their associated JIRA issues." - "Please change the state first in JIRA and try again." # ------------------------------------------ # For CheckSubmitHasReview.py # Allow certain users to submit directly without review being required # An array of user IDs submit_without_review_users: - jenkins # msg_submit_requires_review: An array of lines for the message # For legibility it is good to have the first line blank msg_submit_requires_review: - "" - "You are not allowed to submit a change without a review." - "Please shelve the change for Swarm review first." - "Jenkins will build the change and if successful submit on your behalf." # msg_submit_test_must_pass: An array of lines for the message # For legibility it is good to have the first line blank msg_submit_test_must_pass: - "" - "You are not allowed to submit a change unless the review has successfully" - "passed the Jenkins build/test phase." - "Please check the result of the Jenkins job and rebuild if necessary." # ------------------------------------------ # For CheckFolderStructure.py # msg_new_folder_not_allowed: An array of lines for the message # For legibility it is good to have the first line blank msg_new_folder_not_allowed: - "" - "You are not allowed to create new folders at this level in the stream." - "Please add your files/folders to an existing folder at this level." # ------------------------------------------ # Projects - an array of project entries # Each project expected to have entries for: # require_job: y/n - for pre-submit or pre-shelve trigger - whether a job is required or not # post_submit_create_review: y/n - whether to create a review on submit # pre_submit_require_review: y/n - read by CheckSubmitHasReview.py to avoid bypassing pre-submit review # Also SwarmReviewTemplate.py to set review description to value of 'review_description' # pre_submit_test_must_pass: y/n - read by CheckSubmitHasReview.py to make sure Jenkins build/test passed # Is only relevant if pre_submit_require_review=y # swarm_review_template: y/n - read by SwarmReviewTemplate.py (relevant if pre_submit_require_review=n) # Updates review description to value of 'review_description' # update_review: y/n - if y then try and update the first review found associated with linked job # new_folder_allowed_level: integer - controls at which level within a stream # new folder names can be created. # If not set, or set to 0, then new folders can be created in the root of the stream. # If set to 1, then for stream # //streams/main/new_folder/a.txt would not be allowed, but # //streams/main/existing_folder/new_folder/a.txt would be allowed if existing_folder # had already been created. # new_folder_exceptions: an array of users/groups who can override the trigger. # depot_paths: an array of values for which to process other fields # Controlling here allows you to not have to update the trigger table entry every # time you wish to adjust. Also, it is possible to have this file be updated by ordinary # users and not just superusers. You can even auto-sync this file if required via trigger. # Use quotes if spaces in the path, or if you have an exclude mapping ("-//some/path/...") # fix_allowed_paths: an array of depot paths for which the CheckFixes.py checkes shown above # does not apply. This allows integrators to copy up changes (thus creating a new submit), # even when the associated issue is closed. Specify one or more paths with wildcards where # you will let submits to be handled. # Same rules for quoting as for depot_paths, and exclude mappings also possible # If field empty or not present then there are no exclusions projects: - name: ProjectA post_submit_create_review: y pre_submit_require_review: y pre_submit_test_must_pass: y swarm_review_template: n require_job: y update_review: n new_folder_allowed_level: 0 depot_paths: - //depot/inside/... - "-//depot/inside/....c" fix_allowed_paths: - //depot/inside/rel/... - name: ProjectB post_submit_create_review: n pre_submit_require_review: n pre_submit_test_must_pass: n swarm_review_template: y require_job: y update_review: n depot_paths: - //depot/inside/B/... - //depot/inside/C/...
This is Tom's change:
Introduced new 'Unsupported' directory to clarify that some files
in the SDP are not officially supported. These files are samples for
illustration, to provide examples, or are deprecated but not yet
ready for removal from the package.
The Maintenance and many SDP triggers have been moved under here,
along with other SDP scripts and triggers.
Added comments to p4_vars indicating that it should not be edited
directly. Added reference to an optional site_global_vars file that,
if it exists, will be sourced to provide global user settings
without needing to edit p4_vars.
As an exception to the refactoring, the totalusers.py Maintenance
script will be moved to indicate that it is supported.
Removed settings to support long-sunset P4Web from supported structure.
Structure under new .../Unsupported folder is:
Samples/bin Sample scripts.
Samples/triggers Sample trigger scripts.
Samples/triggers/tests Sample trigger script tests.
Samples/broker Sample broker filter scripts.
Deprecated/triggers Deprecated triggers.
To Do in a subsequent change: Make corresponding doc changes.
First version of trigger to enforce stream folder naming structure - control at which
level in a stream users are allowed to create new folders.
Add new feature/test for CheckSubmitHasReview:
When set, the Swarm testStatus config must equal 'pass'
|#6||24158||robert_cowham||Refactor - tidy up triggers to make a little more consistent. No functional change.|
|#5||23779||robert_cowham||Add new field 'swarm_review_template' to workflow.yaml and let trigger accept it.|
|#4||23662||robert_cowham||Allow one or more users to bypass trigger, e.g. jenkins user|
|#3||23527||robert_cowham||Add a config option fix_allowed_paths per project for CheckFixes.py|
Refer to Workflow.yaml
Change name of field from create_review to post_submit_create_review
New trigger with test.
Reworked sample yaml file to Workflow.yaml
|#3||23131||robert_cowham||New RequireJob pre-submit trigger.|
|#2||23122||robert_cowham||Add functionality to allow depot paths to be specified in groups|
|#1||23074||robert_cowham||Sample Yaml config file|