Skip to content

Latest commit

 

History

History
96 lines (62 loc) · 1.87 KB

File metadata and controls

96 lines (62 loc) · 1.87 KB

ciccd-service

Handles sending notifications to several services for incoming ciccd-builds pub sub messages.

These messages are usually sent by the forward-service. However, you can also manually publish these. See the readme for ciccd-service for the required attributes in case you want to manually send messages and trigger notifications.

Notification services

  • google chat: done
  • jira comments: done
  • jira transition issue to new status: done
  • github checks: planned
  • github comments: planned
  • email (using sendgrid api): planned

Templating system

For google chat and jira comments the notification service allows you to use mustache templates.

Replacements

{{sha}}

{{{branch}}}

{{{repo}}}

{{status}}

{{{logUrl}}}

{{trigger}}

{{commitAuthor}}

{{commitMessage}}

Success and failure sections

Example template:

Hi. {{#success}}Great job!{{/success}}{{#failure}}You failed!{{/failure}}

Will print for a succesful build:

Hi. Great job!

And for a a failed build:

Hi. You failed!

Lowercase

{{#lowercase}}{{{branch}}}{{/lowercase}}

Given branch feat/PROJECT-1234 will print feat/project-1234.

IssueId

Currently only supported for jira-update notifications.

{{#issueId}}{{{branch}}}{{/issueId}}

Given branch feat/PROJECT-1234-exp and using default issue id regex [A-Z][A-Z0-9]+-[0-9]+ will print PROJECT-1234.

Run locally

Add a .env file containing your github token.

GITHUB_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx

## jira server
JIRA_USER=
JIRA_PASSWORD=
JIRA_HOST=jira-server.your-domain.com

Next build and start the server:

yarn install
yarn build
yarn dev

Edit the file in ./tests/pub-sub-message.json with the data you would like to test.

Now run trigger.sh from the ./tests folder.