1.2.0-feat-add-custom-message-command-69455808.0 • Published 3 years ago

@team-supercharge/jarvis-slack-notifier v1.2.0-feat-add-custom-message-command-69455808.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

JARVIS Slack Notifier

Node.js tool to provide Slack notifications through a Slack App to deliver JARVIS notifications

Getting Started

When installed as an NPM package, the tool exposes the jsn <command> binary to use with the following available commands:

  • jsn build-start - sends a Slack message containin release information about the currently built release (tag)
  • jsn build-result - updates previous message based on the CI_JOB_STATUS variable

different statuses can be notified manually as well:

  • jsn build-success - updates previous message with a success state
  • jsn build-failed - updates previous message with a failed state
  • jsn build-canceled - updates previous message with a canceled state

general commands:

  • jsn version - prints out version number

Usage

The recommended use of JARVIS Slack Notifier in a pletform-agnostic way is documented in the main JARVIS repository, access the latest version here!

In Node-based projects

If you are running a Node-based project you can add @team-supercharge/jarvis-slack-notifier to your devDependencies and use the commands with npx listed above, thus removing some extra build steps to be scheduled in your pipeline. For example if you have a single job producing your build:

build:
  stage: build
  script:
    - npm ci # install package with "devDependencies"
    - npx jsn build-start
    - npm run build
  after_script:
    - npx jsn build-result

Configuration

JARVIS Slack Notifier gets its configuration entirely from environment variables:

variablerequireddescription
JARVIS_SLACK_BOT_TOKEN*Slack App's bot token
JARVIS_SLACK_SIGNING_SECRET*Slack App's signing secret
JARVIS_SLACK_CHANNEL_ID*must be an ID, updating a message does not work with channel names
JARVIS_SLACK_GROUP_EMOJIemoji to use for project group (without colons)
JARVIS_SLACK_GITLAB_PRIVATE_TOKENuse a private token instead of a job token (local testing)
JARVIS_SLACK_NO_RELEASE_CONTENTif set to any value, no content (features, fixes, etc) sent

On top of that the project relies on a handful of GitLab environment variables to be defined as seen in the .env.example file.