SDLC event ingest endpoint [GitLab]

Hi @JohannesBraeuer, 
I just read your blog (Observability throughout the SDLC)
I’m currently working on ingesting pipelines from the GitLab environment.
I used this procedure to receive the first test ingestion:

However, it’s not clear how to receive all the pipeline information coming from GitLab. I was studying the webhook… but I must admit that a practical suggestion would be very helpful. I really hope you can assist me in understanding how to receive the complete pipeline information.

Thank you for your time.
Best regards,

Sofia

after digging little within gitlab webhooks i found this blog post that talks about `Applying GitLab Labels Automatically` and it’s mentioning how to push labels automatically with merge requests from Webrick server.

the following code explaining this and i think you can add little lines that sending the same data to dynatrace endpoint to be ingested as events "the endpoints was mentioned within @JohannesBraeuer’s Article or you can check this doc. link "

def update_labels(gitlab_server, api_key, request_body )
  project_id = request_body['object_attributes']['target_project_id']
  request_id = ['object_attributes']['id']
  labels = ['Needs Review'] if request_body['object_attributes']['action']
  semver_increment = semver_increment(gitlab_server, api_key,request_body )
  labels += semver_increment if semver_increment

  merge_data = {id: hook_id(hook), project_id: project_id(hook), labels: labels.to_a.sort.join(',')}
  url = "#{gitlab_server}/api/v3/projects/#{project_id}/merge_requests/#{request_id}?private_token=#{api_key}"
  RestClient::Request.execute(:method => :put, :payload => merge_data, :url => url)
end

def semver_increment(gitlab_server, api_key, request_body)
  from_branch = request_body['object_attributes']['target_branch']
  to_branch = request_body['object_attributes']['source_branch']
  project_id = request_body['object_attributes']['target_project_id']

  params = { private_token: api_key, from: from_branch, to: to_branch }
  url = "#{gitlab_server}/api/v3/projects/#{project_id}/repository/compare"
  changelog = JSON.parse(RestClient::Request.execute(:method => :get, :url => url, :headers => { params: params }))
  changelog = (changelog['commits'] || []).map { |commit| commit['message'] }
  return 'Major' if changelog.any? { |msg| msg.include? '#major' }
  return 'Minor' if changelog.any? { |msg| msg.include? '#minor' }
  return 'Patch' if changelog.any? { |msg| msg.include? '#patch' }
end

I hope this would be helpful.

BR,
Mostafa Hussein.

Hi @MostafaHussein ,

I may not have expressed my requirements clearly. However, I found the solution by creating a test project in GitLab. I went to Settings, selected Webhooks, and entered the following URL as the endpoint:

https://{environmentid}.live.dynatrace.com/platform/ingest/v1/event.sdlc

and i configured the necessary custom headers, as listed on the Openpipeline - Ingest API:

and sent the triggers I was interested in, specifically “Pipeline events.”

Anyway, thank you so much for your response and the time you took to get back to me.
Best regards,

Sofia