summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/project_services/gitlab_ci_service.rb8
-rw-r--r--app/views/projects/merge_requests/widget/_heading.html.haml3
2 files changed, 8 insertions, 3 deletions
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index 820dd3f567c..9e2b3bcd873 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -46,7 +46,9 @@ class GitlabCiService < CiService
end
ci_project = Ci::Project.find_by(gitlab_id: project.id)
- Ci::CreateCommitService.new.execute(ci_project, data)
+ if ci_project
+ Ci::CreateCommitService.new.execute(ci_project, data)
+ end
end
def get_ci_commit(sha, ref)
@@ -85,7 +87,9 @@ class GitlabCiService < CiService
end
def build_page(sha, ref)
- Ci::RoutesHelper.ci_project_ref_commits_path(project.gitlab_ci_project, ref, sha)
+ if project.gitlab_ci_project.present?
+ Ci::RoutesHelper.ci_project_ref_commits_path(project.gitlab_ci_project, ref, sha)
+ end
end
def title
diff --git a/app/views/projects/merge_requests/widget/_heading.html.haml b/app/views/projects/merge_requests/widget/_heading.html.haml
index 4d4e2f68f61..10640f746f0 100644
--- a/app/views/projects/merge_requests/widget/_heading.html.haml
+++ b/app/views/projects/merge_requests/widget/_heading.html.haml
@@ -10,7 +10,8 @@
%span CI build #{status}
for #{@merge_request.last_commit_short_sha}.
%span.ci-coverage
- = link_to "View build details", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
+ - if ci_build_details_path(@merge_request)
+ = link_to "View build details", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
.ci_widget
= icon("spinner spin")