Developer alerts

GitLab pipeline status on your LED matrix

Two small jobs at the end of your pipeline: one for a pass, one for a failure.

GitLab runs a job only when earlier stages passed, or only when one failed, so a build light is two short jobs in a last stage. They use a tiny curl image and take a few seconds.

What your matrix shows

shop failed

Text with the "fireworks" border. Illustration; the real effect is animated.

What you need

  • A GitLab project with a .gitlab-ci.yml and runners (GitLab.com shared runners work).
  • Your Authorization value from the setup guide (about 5 minutes).

Set it up

1. Add the variable

In the project open Settings → CI/CD → Variables → Add variable. Key PIPPLEE_AUTH, your Authorization value as the value, with "Mask variable" on.

2. Add the jobs

Add notify as the last entry in your stages: list, then add these two jobs to .gitlab-ci.yml.

.matrix:
  stage: notify
  image:
    name: curlimages/curl:latest
    entrypoint: [""]
  script:
    - >
      curl -sS -X POST https://pipplee.com/api/v1/public/devices/text
      -H "Authorization: $PIPPLEE_AUTH"
      -H "Content-Type: application/json"
      -d "$BODY"

matrix-passed:
  extends: .matrix
  when: on_success
  variables:
    BODY: '{"text": "$CI_PROJECT_NAME passed", "font_color": "51cf66", "duration": 30}'

matrix-failed:
  extends: .matrix
  when: on_failure
  variables:
    BODY: '{"text": "$CI_PROJECT_NAME failed", "font_color": "ff6b6b", "border": "fireworks", "duration": 300}'

How it works

  • GitLab runs matrix-passed when every earlier job passed, and matrix-failed when one failed.
  • GitLab fills in $CI_PROJECT_NAME inside the variable, so the message names the project.
  • Each job sends one request to Pipplee Cloud; the matrix goes back to normal when the time is up.

Variations

Only on the default branch

Add rules so feature branches stay quiet. rules replaces when, so keep when inside the rule.

matrix-failed:
  extends: .matrix
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: on_failure

Questions

Why the empty entrypoint?

The curl image starts curl directly. GitLab needs a shell to run the script, and an empty entrypoint gives it one.

Does the masked variable show in job logs?

No. GitLab hides masked values in logs, and curl -sS doesn't print request headers.

More ideas

All developer ideas and setup →

Get Pipplee

Set up your matrix in the app, then send it your first alert.

iPhone Android