GitLab ChatOps

GitLab ChatOps provides a method to interact with CI/CD jobs through chat services like Slack. Many organizations’ discussion, collaboration, and troubleshooting takes place in chat services. Having a method to run CI/CD jobs with output posted back to the channel can significantly augment your team’s workflow.

How GitLab ChatOps works

GitLab ChatOps is built upon GitLab CI/CD and Slack Slash Commands. ChatOps provides a run action for slash commands with the following arguments:

  • A <job name> to execute.
  • The <job arguments>.

ChatOps passes the following CI/CD variables to the job:

  • CHAT_INPUT contains any additional arguments.
  • CHAT_CHANNEL is set to the name of channel the action was triggered in.
  • CHAT_USER_ID is set to the chat service’s user ID of the user who triggered the slash command.

When executed, ChatOps looks up the specified job name and attempts to match it to a corresponding job in .gitlab-ci.yml. If a matching job is found on the default branch, a pipeline containing only that job is scheduled. After the job completes: