• 
      

    Add argument parsing, settings, and docs for p4-trigger-script.

    Review Request #13060 — Created May 23, 2023 and submitted

    Information

    RBTools
    release-4.x

    Reviewers

    This greatly enhances the code for p4-trigger-script, bringing in some
    functionality that will be available in the upcoming rbt repo-hook
    command for RBTools 5.

    The script now allows for command line options for customizing behavior
    and connection information, which means that users don't have to fork
    and modify the script.

    It also allows admins to specify certain arguments on the command line
    that will be expanded when calling the trigger. This is needed to
    talk to Perforce and edit changes as the submitting user.

    New in-script settings (and command line options) are added for enabling
    debugging, setting a p4trust file location, setting a Perforce client
    name and host, and setting a Review Board API token.

    Documentation is provided at the top of the script to help admins get
    set up. Docs on the website will be created separately, once this is
    fully tested in production.

    Some changes had to be made within RBTools to facilitate some of these
    changes:

    1. initialize_logging() now accepts a debug parameter to enable
      debug logging for hooks.

    2. The call to p4 change no longer ignores error result (which caused
      errors to be sent to the caller as a valid changeset).

    3. Logging information for failed marshalled commands now includes
      demarshalled payload and stderr information.

    Thoroughly tested the script with command line options and in-script
    settings.

    Tested with using a hard-coded user and a Perforce-provided %client%,
    %clienthost%, and %user%.

    Tested with and without debugging information.

    Tested with inaccessible Perforce changesets (which unveiled the
    p4 change error handling problem).

    Summary ID
    Add argument parsing, settings, and docs for p4-trigger-script.
    This greatly enhances the code for p4-trigger-script, bringing in some functionality that will be available in the upcoming `rbt repo-hook` command for RBTools 5. The script now allows for command line options for customizing behavior and connection information, which means that users don't have to fork and modify the script. It also allows admins to specify certain arguments on the command line that will be expanded when calling the trigger. This is needed to talk to Perforce and edit changes as the submitting user. New in-script settings (and command line options) are added for enabling debugging, setting a `p4trust` file location, setting a Perforce client name and host, and setting a Review Board API token. Documentation is provided at the top of the script to help admins get set up. Docs on the website will be created separately, once this is fully tested in production. Some changes had to be made within RBTools to facilitate some of these changes: 1. `initialize_logging()` now accepts a `debug` parameter to enable debug logging for hooks. 2. The call to `p4 change` no longer ignores error result (which caused errors to be sent to the caller as a valid changeset). 3. Logging information for failed marshalled commands now includes demarshalled payload and stderr information.
    d635ea2a9300bdde72ea4b4caaf07db94f9e0397
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.x (e6fb267)