Commit 402f959d authored by James Fargher's avatar James Fargher

Merge branch '234002-conan-create-build-info' into 'master'

Conan packages associate with pipelines

See merge request gitlab-org/gitlab!49426
parents 5ceb31e7 4d958498
---
title: Conan packages show build and commit information when published using CI
merge_request: 49426
author:
type: fixed
......@@ -222,6 +222,7 @@ module API
return unless route_authentication_setting[:job_token_allowed]
job = find_job_from_token || raise(::Gitlab::Auth::UnauthorizedError)
@current_authenticated_job = job # rubocop:disable Gitlab/ModuleWithInstanceVariables
job.user
end
......
......@@ -629,6 +629,7 @@ RSpec.shared_examples 'workhorse recipe file upload endpoint' do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid file_name', 'conanfile.py.git%2fgit-upload-pack'
it_behaves_like 'uploads a package file'
it_behaves_like 'creates build_info when there is a job'
end
RSpec.shared_examples 'workhorse package file upload endpoint' do
......@@ -649,6 +650,7 @@ RSpec.shared_examples 'workhorse package file upload endpoint' do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid file_name', 'conaninfo.txttest'
it_behaves_like 'uploads a package file'
it_behaves_like 'creates build_info when there is a job'
context 'tracking the conan_package.tgz upload' do
let(:file_name) { ::Packages::Conan::FileMetadatum::PACKAGE_BINARY }
......@@ -657,6 +659,20 @@ RSpec.shared_examples 'workhorse package file upload endpoint' do
end
end
RSpec.shared_examples 'creates build_info when there is a job' do
context 'with job token' do
let(:jwt) { build_jwt_from_job(job) }
it 'creates a build_info record' do
expect { subject }.to change { Packages::BuildInfo.count }.by(1)
end
it 'creates a package_file_build_info record' do
expect { subject }.to change { Packages::PackageFileBuildInfo.count }.by(1)
end
end
end
RSpec.shared_examples 'uploads a package file' do
context 'file size above maximum limit' do
before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment