diff options
Diffstat (limited to 'app/models/ci/catalog/resources/version.rb')
-rw-r--r-- | app/models/ci/catalog/resources/version.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/ci/catalog/resources/version.rb b/app/models/ci/catalog/resources/version.rb index 4273c4515bc..0ea2735b030 100644 --- a/app/models/ci/catalog/resources/version.rb +++ b/app/models/ci/catalog/resources/version.rb @@ -19,6 +19,7 @@ module Ci scope :for_catalog_resources, ->(catalog_resources) { where(catalog_resource_id: catalog_resources) } scope :preloaded, -> { includes(:catalog_resource, project: [:route, { namespace: :route }], release: :author) } + scope :by_name, ->(name) { joins(:release).merge(Release.where(tag: name)) } scope :order_by_created_at_asc, -> { reorder(created_at: :asc) } scope :order_by_created_at_desc, -> { reorder(created_at: :desc) } @@ -122,6 +123,14 @@ module Ci project.commit_by(oid: sha) end + def path + Gitlab::Routing.url_helpers.project_tag_path(project, name) + end + + def readme + project.repository.tree(sha).readme + end + private def update_catalog_resource |