diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/models/packages/package.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/models/packages/package.rb')
-rw-r--r-- | app/models/packages/package.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index 4ea127fc222..34eae6ab5dc 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true class Packages::Package < ApplicationRecord + include EachBatch include Sortable include Gitlab::SQL::Pattern include UsageStatistics @@ -104,6 +105,7 @@ class Packages::Package < ApplicationRecord scope :including_build_info, -> { includes(pipelines: :user) } scope :including_project_route, -> { includes(project: { namespace: :route }) } scope :including_tags, -> { includes(:tags) } + scope :including_dependency_links, -> { includes(dependency_links: :dependency) } scope :with_conan_channel, ->(package_channel) do joins(:conan_metadatum).where(packages_conan_metadata: { package_channel: package_channel }) @@ -291,6 +293,13 @@ class Packages::Package < ApplicationRecord ::Packages::Maven::Metadata::SyncWorker.perform_async(user.id, project.id, name) end + def create_build_infos!(build) + return unless build&.pipeline + + # TODO: use an upsert call when https://gitlab.com/gitlab-org/gitlab/-/issues/339093 is implemented + build_infos.find_or_create_by!(pipeline: build.pipeline) + end + private def composer_tag_version? |