feat(notifier): gitlab_artifact notifier (Wave 1 Tier-2 #1) - #11
Merged
Merged
Conversation
Adds a built-in `type: gitlab_artifact` notifier that writes alert Markdown to a configurable file path (default ding-alerts.md, relative to CWD = $CI_PROJECT_DIR in GitLab CI). Users declare the path in their .gitlab-ci.yml `artifacts:` block to surface alerts as a downloadable/browsable pipeline artifact, closing the "no native step-summary surface" gap documented in the GitLab CI recipe. Pattern: sync, mutex-guarded, append-only. Mirrors github_actions.go shape exactly minus the ::warning:: stdout mirror (GitLab CI lacks workflow-annotation commands; users add type: stdout alongside if they want runtime visibility). No new dependencies, no go.mod changes. Single optional `path:` field added to NotifierConfig. 7 unit tests cover header behavior, multi-alert append, default path, file write errors, label sort stability, empty message handling, and concurrent Send serialization. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- docs/recipes/gitlab-ci.md: replace the "no native step-summary surface" gotcha with a positive `## Native GitLab UI surfacing` section showing the new notifier + .gitlab-ci.yml `artifacts:` declaration. Update Escalation criteria gotcha count (2 → 1) and reframe the Tier-2 trigger as fulfilled. - docs/configuration.md: new `### type: gitlab_artifact` section in the Notifiers chapter, between kubernetes_event and webhook. - ding.yaml.example: commented example block in the notifiers catalog after the kubernetes_event entry. Closes the documented gap from Wave 1 review (the recipe's prior line 86 trigger has fired). After this commit, type: gitlab_artifact is a fully-documented built-in notifier. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a built-in `type: gitlab_artifact` notifier that writes alert Markdown to a configurable file path (default `ding-alerts.md`, relative to `$CI_PROJECT_DIR`), so GitLab CI users can declare it in `.gitlab-ci.yml` `artifacts:` and surface alerts as a downloadable pipeline artifact in the GitLab UI. Closes the gap flagged in the GitLab CI recipe — first row of the Wave 1 Tier-2 candidates table marked shipped.
This continues the established Tier-2 cadence: T2-A (`${VAR}`), T2-B (`kubernetes_event` shipped in v0.9.0), and now Wave 1 #1 (`gitlab_artifact`).
Design (locked in brainstorm)
Commits
Test plan
```bash
mkdir /tmp/gitlab-artifact-smoke && cd /tmp/gitlab-artifact-smoke
cat > ding.yaml <<'YAML'
notifiers:
alerts:
type: gitlab_artifact
rules:
match: { metric: run.exit }
condition: value > 0
message: "Job failed (exit {{ .exit_code }})"
alert:
YAML
/tmp/ding run --config ding.yaml -- false
cat ding-alerts.md
Expected: file with "# DING Alerts" header + "## job_failed" section
```Out of scope (deferred)
Post-merge
By the established convention (MLflow → v0.6.0, Argo → v0.7.0, Ray → v0.8.0, kubernetes_event → v0.9.0), this could tag as v0.10.0 if you want the new notifier in a release rather than just on main.
🤖 Generated with Claude Code