Skip to content
Snippets Groups Projects
Commit f5ea19c8 authored by Kamil Trzciński's avatar Kamil Trzciński :speech_balloon: Committed by Doug Stull
Browse files

Add `object_attributes.name` to `pipeline_hooks`

This exposes `workflow: name:` of the pipeline.

Changelog: added
parent 14bfdd9d
No related branches found
No related tags found
1 merge request!123639Add `object_attributes.name` to `pipeline_hooks`
......@@ -1110,6 +1110,9 @@ and later, the pipeline webhook returns only the latest jobs.
In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546)
and later, pipeline webhooks triggered by blocked users are not processed.
In [GitLab 16.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123639)
and later, pipeline webhooks started to expose `object_attributes.name`.
Request header:
```plaintext
......@@ -1124,6 +1127,7 @@ Payload example:
"object_attributes":{
"id": 31,
"iid": 3,
"name": "Pipeline for branch: master",
"ref": "master",
"tag": false,
"sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
......
......@@ -65,6 +65,7 @@ def hook_attrs(pipeline)
{
id: pipeline.id,
iid: pipeline.iid,
name: pipeline.name,
ref: pipeline.source_ref,
tag: pipeline.tag,
sha: pipeline.sha,
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Gitlab::DataBuilder::Pipeline do
RSpec.describe Gitlab::DataBuilder::Pipeline, feature_category: :continuous_integration do
let_it_be(:user) { create(:user, :public_email) }
let_it_be(:project) { create(:project, :repository) }
......@@ -26,6 +26,7 @@
it 'has correct attributes', :aggregate_failures do
expect(attributes).to be_a(Hash)
expect(attributes[:name]).to be_nil
expect(attributes[:ref]).to eq(pipeline.ref)
expect(attributes[:sha]).to eq(pipeline.sha)
expect(attributes[:tag]).to eq(pipeline.tag)
......@@ -54,6 +55,16 @@
expect(data[:source_pipeline]).to be_nil
end
context 'pipeline with metadata' do
let_it_be_with_reload(:pipeline_metadata) do
create(:ci_pipeline_metadata, pipeline: pipeline, name: "My Pipeline")
end
it 'has pipeline name', :aggregate_failures do
expect(attributes[:name]).to eq("My Pipeline")
end
end
context 'build with runner' do
let_it_be(:tag_names) { %w(tag-1 tag-2) }
let_it_be(:ci_runner) { create(:ci_runner, tag_list: tag_names.map { |n| ActsAsTaggableOn::Tag.create!(name: n) }) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment