<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SDLC event ingest endpoint [GitLab] in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260277#M1845</link>
    <description>&lt;P&gt;after digging little within gitlab webhooks i found this &lt;A href="https://about.gitlab.com/blog/2016/08/19/applying-gitlab-labels-automatically/" target="_self"&gt;blog post&lt;/A&gt; that talks about&amp;nbsp;`Applying GitLab Labels Automatically` and it's mentioning how to push labels automatically with merge requests from&amp;nbsp;&lt;SPAN&gt;Webrick server.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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&amp;nbsp;&lt;A href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/33327" target="_self"&gt;@JohannesBraeuer's&lt;/A&gt; Article or you can check this doc. &lt;A href="https://docs.dynatrace.com/docs/shortlink/openpipeline-api-ingestion-reference#sdlc-events" target="_self"&gt;link&lt;/A&gt; "&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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 =&amp;gt; :put, :payload =&amp;gt; merge_data, :url =&amp;gt; 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 =&amp;gt; :get, :url =&amp;gt; url, :headers =&amp;gt; { 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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this would be helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BR,&lt;BR /&gt;Mostafa Hussein.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 09:09:05 GMT</pubDate>
    <dc:creator>MostafaHussein</dc:creator>
    <dc:date>2024-10-23T09:09:05Z</dc:date>
    <item>
      <title>SDLC event ingest endpoint [GitLab]</title>
      <link>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260262#M1844</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/33327"&gt;@JohannesBraeuer&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;I just read your blog (&lt;A href="https://www.dynatrace.com/news/blog/observability-throughout-the-software-development-lifecycle/?" target="_blank" rel="noopener"&gt;Observability throughout the SDLC&lt;/A&gt;)&lt;BR /&gt;I’m currently working on ingesting pipelines from the GitLab environment.&lt;BR /&gt;I used this procedure to receive the first test ingestion:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/pipeline-observability-ingest-sdlc-events#send-event" target="_new" rel="noopener"&gt;&lt;SPAN&gt;https&lt;/SPAN&gt;&lt;SPAN&gt;://docs&lt;/SPAN&gt;&lt;SPAN&gt;.dynatrace&lt;/SPAN&gt;&lt;SPAN&gt;.com&lt;/SPAN&gt;&lt;SPAN&gt;/docs&lt;/SPAN&gt;&lt;SPAN&gt;/shortlink&lt;/SPAN&gt;&lt;SPAN&gt;/pipeline&lt;/SPAN&gt;&lt;SPAN&gt;-observability&lt;/SPAN&gt;&lt;SPAN&gt;-ingest&lt;/SPAN&gt;&lt;SPAN&gt;-sdlc&lt;/SPAN&gt;&lt;SPAN&gt;-events&lt;/SPAN&gt;&lt;SPAN&gt;#send&lt;/SPAN&gt;&lt;SPAN&gt;-event&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;BR /&gt;&lt;BR /&gt;Thank you for your time.&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Sofia&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 05:52:33 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260262#M1844</guid>
      <dc:creator>SofiaPersia</dc:creator>
      <dc:date>2024-10-24T05:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: SDLC event ingest endpoint [GitLab]</title>
      <link>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260277#M1845</link>
      <description>&lt;P&gt;after digging little within gitlab webhooks i found this &lt;A href="https://about.gitlab.com/blog/2016/08/19/applying-gitlab-labels-automatically/" target="_self"&gt;blog post&lt;/A&gt; that talks about&amp;nbsp;`Applying GitLab Labels Automatically` and it's mentioning how to push labels automatically with merge requests from&amp;nbsp;&lt;SPAN&gt;Webrick server.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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&amp;nbsp;&lt;A href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/33327" target="_self"&gt;@JohannesBraeuer's&lt;/A&gt; Article or you can check this doc. &lt;A href="https://docs.dynatrace.com/docs/shortlink/openpipeline-api-ingestion-reference#sdlc-events" target="_self"&gt;link&lt;/A&gt; "&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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 =&amp;gt; :put, :payload =&amp;gt; merge_data, :url =&amp;gt; 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 =&amp;gt; :get, :url =&amp;gt; url, :headers =&amp;gt; { 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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this would be helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BR,&lt;BR /&gt;Mostafa Hussein.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 09:09:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260277#M1845</guid>
      <dc:creator>MostafaHussein</dc:creator>
      <dc:date>2024-10-23T09:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: SDLC event ingest endpoint [GitLab]</title>
      <link>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260817#M1846</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="2"&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/66935"&gt;@MostafaHussein&lt;/a&gt;&amp;nbsp;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="2"&gt;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:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;&lt;FONT face="courier new,courier"&gt;https://{environmentid}.live.dynatrace.com/platform/ingest/v1/event.sdlc&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;and i configured the necessary custom headers, as listed on the &lt;STRONG&gt;Openpipeline - Ingest API&lt;/STRONG&gt;:&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="PipelineTest.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24203i130DEBD8EB604652/image-size/large?v=v2&amp;amp;px=999" role="button" title="PipelineTest.png" alt="PipelineTest.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="2"&gt;and sent the triggers I was interested in, specifically "&lt;STRONG&gt;Pipeline events&lt;/STRONG&gt;."&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="PipelineTestTrigger.png" style="width: 515px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24204i61E3C8255146A9FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="PipelineTestTrigger.png" alt="PipelineTestTrigger.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Anyway, thank you so much for your response and the time you took to get back to me.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="helvetica" size="2"&gt;Best regards,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Sofia&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 09:42:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/SDLC-event-ingest-endpoint-GitLab/m-p/260817#M1846</guid>
      <dc:creator>SofiaPersia</dc:creator>
      <dc:date>2024-10-28T09:42:37Z</dc:date>
    </item>
  </channel>
</rss>

