Skip to content

Commit

Permalink
Fix updating scmsync attribute for existing target packages
Browse files Browse the repository at this point in the history
In case the target package already exists for some reason

- this is an updated pull request
- the target package was created previously

we still need to update the scmsync attribute. This broke with #14830
  • Loading branch information
hennevogel committed Mar 19, 2024
1 parent 443574e commit 6e23396
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/api/app/models/workflow/step/branch_package_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ def call
restore_target_project
elsif scm_webhook.new_commit_event?
create_branched_package
unless scm_synced?
target_package.save_file({ file: branch_request_content,
filename: '_branch_request',
comment: BRANCH_REQUEST_COMMIT_MESSAGE })
end
write_branch_request_file
write_scmsync_branch_information
Workflows::ScmEventSubscriptionCreator.new(token, workflow_run, scm_webhook, target_package).call

target_package
Expand All @@ -27,6 +24,22 @@ def call

private

def write_branch_request_file
return if scm_synced?

target_package.save_file({ file: branch_request_content,
filename: '_branch_request',
comment: BRANCH_REQUEST_COMMIT_MESSAGE })
end

def write_scmsync_branch_information
return unless scm_synced?
# BranchPackage takes care of the initial setup of new packages
return if target_package.blank?

target_package.update!(scmsync: parse_scmsync_for_target_package)
end

def target_project_base_name
step_instructions[:target_project]
end
Expand Down

0 comments on commit 6e23396

Please sign in to comment.