From 05f53109ca94c10eeef913619fdc4a9a96bcb6c4 Mon Sep 17 00:00:00 2001 From: Alishan Ladhani <aladhani@gitlab.com> Date: Wed, 16 Jun 2021 15:12:15 -0400 Subject: [PATCH] DB testing: Don't overwrite previous comment when kicking off pipeline --- scripts/trigger-build | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/scripts/trigger-build b/scripts/trigger-build index 03aca8b3da730..cb235677b5d52 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -313,27 +313,18 @@ module Trigger comment = "<!-- #{IDENTIFIABLE_NOTE_TAG} --> \nStarted database testing [pipeline](https://ops.gitlab.net/#{downstream_project_path}/-/pipelines/#{pipeline.id}) " \ "(limited access). This comment will be updated once the pipeline has finished running." - # Look for a note to update + # Look for an existing note db_testing_notes = gitlab.merge_request_notes(project_path, merge_request_id).auto_paginate.select do |note| note.body.include?(IDENTIFIABLE_NOTE_TAG) end - note = db_testing_notes.max_by { |note| Time.parse(note.created_at) } - - if note && note.type != 'DiscussionNote' - # The latest note has not led to a discussion. Update it. - gitlab.edit_merge_request_note(project_path, merge_request_id, note.id, comment) - - puts "Updated comment:\n" - else - # This is the first note or the latest note has been discussed on the MR. - # Don't update, create new note instead. + if db_testing_notes.empty? + # This is the first note note = gitlab.create_merge_request_note(project_path, merge_request_id, comment) puts "Posted comment to:\n" + puts "https://gitlab.com/#{project_path}/-/merge_requests/#{merge_request_id}#note_#{note.id}" end - - puts "https://gitlab.com/#{project_path}/-/merge_requests/#{merge_request_id}#note_#{note.id}" end private -- GitLab