diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 18:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 18:09:22 +0300 |
commit | 99f4b14cb0546a905d8f14f938d679d17e569005 (patch) | |
tree | d0520a58f46c8b5ceb018ca4d404e9a682f4af3c /app/services | |
parent | 4f8983ade80c0d71d4c8e6cc0d686c9cecf5e7d4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/security/ci_configuration/base_create_service.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/services/security/ci_configuration/base_create_service.rb b/app/services/security/ci_configuration/base_create_service.rb index 3e8865d3dff..c5fbabf487c 100644 --- a/app/services/security/ci_configuration/base_create_service.rb +++ b/app/services/security/ci_configuration/base_create_service.rb @@ -51,7 +51,7 @@ module Security end def existing_gitlab_ci_content - root_ref = root_ref_sha(project) + root_ref = root_ref_sha(project.repository) return if root_ref.nil? @gitlab_ci_yml ||= project.ci_config_for(root_ref) @@ -82,13 +82,10 @@ module Security ) end - def root_ref_sha(project) - project.repository.root_ref_sha - rescue StandardError => e - # this might fail on the very first commit, - # and unfortunately it raises a StandardError - Gitlab::ErrorTracking.track_exception(e, project_id: project.id) - nil + def root_ref_sha(repository) + commit = repository.commit(repository.root_ref) + + commit&.sha end end end |