Commit 3d2e7b8e authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch '345521-use-unique-package-names-in-qa-specs' into 'master'

Use unique package names in QA specs

See merge request gitlab-org/gitlab!74399
parents 647af590 e40dd2ca
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = 'mygem'
s.authors = ['Tanuki Steve', 'Hal 9000']
s.author = 'Tanuki Steve'
s.version = '0.0.1'
s.date = '2011-09-29'
s.summary = 'package is the best'
s.files = ['lib/hello_gem.rb']
s.require_paths = ['lib']
s.description = 'A test package for GitLab.'
s.email = 'tanuki@not_real.com'
s.homepage = 'https://gitlab.com/ruby-co/my-package'
s.license = 'MIT'
s.metadata = {
'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues',
'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md',
'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs',
'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme',
'source_code_uri' => 'https://gitlab.com/ruby-co/my-package'
}
s.bindir = 'bin'
s.platform = Gem::Platform::RUBY
s.post_install_message = 'Installed, thank you!'
s.rdoc_options = ['--main']
s.required_ruby_version = '>= 2.7.0'
s.required_rubygems_version = '>= 1.8.11'
s.requirements = 'A high powered server or calculator'
s.rubygems_version = '1.8.09'
s.add_dependency 'dependency_1', '~> 1.2.3'
s.add_dependency 'dependency_2', '3.0.0'
s.add_dependency 'dependency_3', '>= 1.0.0'
s.add_dependency 'dependency_4'
end
......@@ -17,7 +17,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = 'conantest'
package.name = "conantest-#{SecureRandom.hex(8)}"
package.project = project
end
end
......
......@@ -11,7 +11,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = "my_package"
package.name = "my_package-#{SecureRandom.hex(8)}"
package.project = project
end
end
......@@ -36,13 +36,13 @@ module QA
upload:
stage: upload
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/#{package.name}/0.0.1/file.txt'
tags:
- "runner-for-#{project.name}"
download:
stage: download
script:
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt -O file_downloaded.txt'
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/#{package.name}/0.0.1/file.txt -O file_downloaded.txt'
tags:
- "runner-for-#{project.name}"
YAML
......
......@@ -6,7 +6,7 @@ module QA
include Runtime::Fixtures
include_context 'packages registry qa scenario'
let(:package_name) { 'gitlab_qa_helm' }
let(:package_name) { "gitlab_qa_helm-#{SecureRandom.hex(8)}" }
let(:package_version) { '1.3.7' }
let(:package_type) { 'helm' }
......
......@@ -8,7 +8,7 @@ module QA
include_context 'packages registry qa scenario'
let(:group_id) { 'com.gitlab.qa' }
let(:artifact_id) { 'maven_gradle' }
let(:artifact_id) { "maven_gradle-#{SecureRandom.hex(8)}" }
let(:package_name) { "#{group_id}/#{artifact_id}".tr('.', '/') }
let(:package_version) { '1.3.7' }
let(:package_type) { 'maven_gradle' }
......
......@@ -125,7 +125,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = "@#{registry_scope}/#{project.name}"
package.name = "@#{registry_scope}/#{project.name}-#{SecureRandom.hex(8)}"
package.project = project
end
end
......
......@@ -104,7 +104,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = "@#{registry_scope}/mypackage"
package.name = "@#{registry_scope}/mypackage-#{SecureRandom.hex(8)}"
package.project = project
end
end
......@@ -133,7 +133,7 @@ module QA
end
end
it "push and pull a npm package via CI using a #{params[:token_name]}", quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/344537', type: :investigating } do
it "push and pull a npm package via CI using a #{params[:token_name]}" do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
......
......@@ -12,7 +12,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = 'mypypipackage'
package.name = "mypypipackage-#{SecureRandom.hex(8)}"
package.project = project
end
end
......@@ -57,7 +57,7 @@ module QA
install:
stage: install
script:
- "pip install mypypipackage --no-deps --index-url #{uri.scheme}://#{personal_access_token}:#{personal_access_token}@#{gitlab_host_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host #{gitlab_host_with_port}"
- "pip install #{package.name} --no-deps --index-url #{uri.scheme}://#{personal_access_token}:#{personal_access_token}@#{gitlab_host_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host #{gitlab_host_with_port}"
tags:
- "runner-for-#{project.name}"
......@@ -70,7 +70,7 @@ module QA
import setuptools
setuptools.setup(
name="mypypipackage",
name="#{package.name}",
version="0.0.1",
author="Example Author",
author_email="author@example.com",
......
......@@ -13,7 +13,7 @@ module QA
let(:package) do
Resource::Package.init do |package|
package.name = 'mygem'
package.name = "mygem-#{SecureRandom.hex(8)}"
package.project = project
end
end
......@@ -46,17 +46,9 @@ module QA
it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1906' do
Flow::Login.sign_in
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.directory = Pathname
.new(__dir__)
.join('../../../../../fixtures/rubygems_package')
push.commit_message = 'RubyGems package'
end
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add mygem.gemspec'
commit.commit_message = 'Add package files'
commit.add_files(
[
{
......@@ -74,8 +66,8 @@ module QA
echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
- chmod 0600 ~/.gem/credentials
script:
- gem build mygem
- gem push mygem-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems
- gem build #{package.name}
- gem push #{package.name}-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems
tags:
- "runner-for-#{project.name}"
YAML
......@@ -90,6 +82,52 @@ module QA
end
end
RUBY
},
{
file_path: "#{package.name}.gemspec",
content:
<<~RUBY
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = '#{package.name}'
s.authors = ['Tanuki Steve', 'Hal 9000']
s.author = 'Tanuki Steve'
s.version = '0.0.1'
s.date = '2011-09-29'
s.summary = 'this is a test package'
s.files = ['lib/hello_gem.rb']
s.require_paths = ['lib']
s.description = 'A test package for GitLab.'
s.email = 'tanuki@not_real.com'
s.homepage = 'https://gitlab.com/ruby-co/my-package'
s.license = 'MIT'
s.metadata = {
'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues',
'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md',
'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs',
'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme',
'source_code_uri' => 'https://gitlab.com/ruby-co/my-package'
}
s.bindir = 'bin'
s.platform = Gem::Platform::RUBY
s.post_install_message = 'Installed, thank you!'
s.rdoc_options = ['--main']
s.required_ruby_version = '>= 2.7.0'
s.required_rubygems_version = '>= 1.8.11'
s.requirements = 'A high powered server or calculator'
s.rubygems_version = '1.8.09'
s.add_dependency 'dependency_1', '~> 1.2.3'
s.add_dependency 'dependency_2', '3.0.0'
s.add_dependency 'dependency_3', '>= 1.0.0'
s.add_dependency 'dependency_4'
end
RUBY
}
]
)
......
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