ripclawffb.helix_core.helix_core_trigger module – Manage triggers on Perforce Helix Core

Note

This module is part of the ripclawffb.helix_core collection (version 1.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ripclawffb.helix_core. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: ripclawffb.helix_core.helix_core_trigger.

New in ripclawffb.helix_core 1.1.0

Synopsis

  • Triggers are user-defined scripts executed by the Perforce server when specific operations occur.

  • This module manages the entire triggers table as a unit.

  • This module supports check mode.

Requirements

The below requirements are needed on the host that executes this module.

  • P4Python pip module is required

Parameters

Parameter

Comments

charset

aliases: p4charset

string

Character set used for translation of unicode files

Can also use ‘P4CHARSET’ environment variable

Default: "none"

password

aliases: p4passwd

string / required

The login password

Can also use ‘P4PASSWD’ environment variable

server

aliases: p4port

string / required

The hostname/ip and port of the server (perforce:1666)

Can also use ‘P4PORT’ environment variable

state

string

Determines if the trigger entries are set or cleared

present replaces the triggers with the specified entries

absent clears all entries from the triggers table

Choices:

  • "present" ← (default)

  • "absent"

triggers

list / elements=dictionary

List of trigger entries

Each entry must have name, type, path, and command keys

Required when state is present

command

string / required

The command to execute when the trigger fires

name

string / required

A unique name for the trigger

path

string / required

The depot path pattern for changelist triggers, or form type for form triggers

type

string / required

The trigger type (e.g., change-submit, change-content, change-commit, form-save, auth-check)

user

aliases: p4user

string / required

A user with access to perform this operation

Can also use ‘P4USER’ environment variable

See Also

See also

Helix Core Triggers

Configure trigger definitions

P4Python Pip Module

Python module to interact with Helix Core

Examples

# Set trigger entries
- name: Configure triggers
  ripclawffb.helix_core.helix_core_trigger:
    state: present
    triggers:
      - name: check_submit
        type: change-submit
        path: //depot/...
        command: "/scripts/validate.sh %changelist%"
      - name: notify_commit
        type: change-commit
        path: //depot/...
        command: "/scripts/notify.sh %changelist% %user%"
    server: '1666'
    user: bruno
    charset: auto
    password: ''

# Clear all trigger entries
- name: Clear triggers
  ripclawffb.helix_core.helix_core_trigger:
    state: absent
    server: '1666'
    user: bruno
    charset: auto
    password: ''

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

action

string

The action performed on the resource.

Returned: always

Can only return:

  • "updated"

  • "cleared"

  • "unchanged"

Sample: "updated"

changed

boolean

Whether any changes were made to the triggers.

Returned: always

Sample: true

changes

dictionary

Entries that were added or removed.

Returned: always

Sample: {"added": [{"command": "/scripts/validate.sh %changelist%", "name": "check_submit", "path": "//depot/...", "type": "change-submit"}], "removed": []}

diff

dictionary

A dictionary containing ‘before’ and ‘after’ state of the resource.

Returned: when diff mode is enabled

after

string

The state of the resource after the action.

Returned: success

before

string

The state of the resource before the action.

Returned: success

triggers

list / elements=dictionary

The trigger table entries after the operation.

Returned: always

Sample: [{"command": "/scripts/validate.sh %changelist%", "name": "check_submit", "path": "//depot/...", "type": "change-submit"}]

Authors

  • Asif Shaikh (@ripclawffb)