diff options
Diffstat (limited to 'scripts/trigger-build')
-rwxr-xr-x | scripts/trigger-build | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/scripts/trigger-build b/scripts/trigger-build index 23c9ebbe294..cb235677b5d 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -135,11 +135,11 @@ module Trigger end def extra_variables - # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA for omnibus checkouts due to pipeline for merged results - # and fallback to CI_COMMIT_SHA for the non-MR pipelines. + # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA (MR HEAD commit) so that the image is in sync with the assets and QA images. # See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results. # We also set IMAGE_TAG so the GitLab Docker image is tagged with that SHA. source_sha = Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA'] + { 'GITLAB_VERSION' => source_sha, 'IMAGE_TAG' => source_sha, @@ -177,12 +177,14 @@ module Trigger def extra_variables edition = Trigger.ee? ? 'EE' : 'CE' + # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA (MR HEAD commit) so that the image is in sync with the assets and QA images. + source_sha = Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA'] { "ee" => Trigger.ee? ? "true" : "false", - "GITLAB_VERSION" => ENV['CI_COMMIT_SHA'], + "GITLAB_VERSION" => source_sha, "GITLAB_TAG" => ENV['CI_COMMIT_TAG'], - "GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_SHA'], + "GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : source_sha, "FORCE_RAILS_IMAGE_BUILDS" => 'true', "#{edition}_PIPELINE" => 'true' } @@ -311,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 |