Commit 90302eb8 authored by Anastasia McDonald's avatar Anastasia McDonald

Merge branch 'address-technical-debt' into 'master'

Address technical debt on 5_package | Remove deprecated k8s-related test code

See merge request gitlab-org/gitlab!74889
parents 95006217 eca5a94d
...@@ -20,7 +20,7 @@ module QA ...@@ -20,7 +20,7 @@ module QA
end end
def set_api_url(api_url) def set_api_url(api_url)
fill_in 'cluster_platform_kubernetes_attributes_api_url', with: QA::Runtime::Env.cluster_api_url || api_url fill_in 'cluster_platform_kubernetes_attributes_api_url', with: api_url
end end
def set_ca_certificate(ca_certificate) def set_ca_certificate(ca_certificate)
......
...@@ -15,7 +15,7 @@ module QA ...@@ -15,7 +15,7 @@ module QA
end end
def has_package?(name) def has_package?(name)
has_element?(:package_link, text: name) has_element?(:package_link, text: name, wait: 20)
end end
def has_no_package?(name) def has_no_package?(name)
......
...@@ -93,10 +93,6 @@ module QA ...@@ -93,10 +93,6 @@ module QA
ENV['CI'] || ENV['CI_SERVER'] ENV['CI'] || ENV['CI_SERVER']
end end
def cluster_api_url
ENV['CLUSTER_API_URL']
end
def qa_cookies def qa_cookies
ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';') ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';')
end end
......
# frozen_string_literal: true
module QA
module Scenario
module Test
module Integration
class Kubernetes < Test::Instance::All
tags :kubernetes
end
end
end
end
end
# frozen_string_literal: true
module QA
module Scenario
module Test
module Integration
class SSHTunnel < Test::Instance::All
tags :ssh_tunnel
end
end
end
end
end
...@@ -73,14 +73,16 @@ module QA ...@@ -73,14 +73,16 @@ module QA
end end
it 'pushes, pulls image to the registry and deletes image blob, manifest and tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1819' do it 'pushes, pulls image to the registry and deletes image blob, manifest and tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1819' do
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.api_client = api_client Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.api_client = api_client
commit.project = project commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{ commit.project = project
file_path: '.gitlab-ci.yml', commit.add_files([{
content: gitlab_ci_yaml file_path: '.gitlab-ci.yml',
}]) content: gitlab_ci_yaml
}])
end
end end
Support::Waiter.wait_until(max_duration: 10) { pipeline_is_triggered? } Support::Waiter.wait_until(max_duration: 10) { pipeline_is_triggered? }
......
...@@ -79,29 +79,31 @@ module QA ...@@ -79,29 +79,31 @@ module QA
context "when tls is disabled" do context "when tls is disabled" do
it "using a #{params[:token_name]}, pushes image and deletes tag", :registry do it "using a #{params[:token_name]}, pushes image and deletes tag", :registry do
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
build: <<~YAML
image: docker:19.03.12 build:
stage: build image: docker:19.03.12
services: stage: build
- name: docker:19.03.12-dind services:
command: ["--insecure-registry=gitlab.test:5050"] - name: docker:19.03.12-dind
variables: command: ["--insecure-registry=gitlab.test:5050"]
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG variables:
script: IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050 script:
- docker build -t $IMAGE_TAG . - docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050
- docker push $IMAGE_TAG - docker build -t $IMAGE_TAG .
tags: - docker push $IMAGE_TAG
- "runner-for-#{project.name}" tags:
YAML - "runner-for-#{project.name}"
}]) YAML
}])
end
end end
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
...@@ -131,36 +133,38 @@ module QA ...@@ -131,36 +133,38 @@ module QA
context "when tls is enabled" do context "when tls is enabled" do
it "pushes image and deletes tag", :registry_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2378' do it "pushes image and deletes tag", :registry_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2378' do
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
build: <<~YAML
image: docker:19.03.12 build:
stage: build image: docker:19.03.12
services: stage: build
- name: docker:19.03.12-dind services:
command: - name: docker:19.03.12-dind
- /bin/sh command:
- -c - /bin/sh
- | - -c
apk add --no-cache openssl - |
true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt apk add --no-cache openssl
update-ca-certificates true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt
dockerd-entrypoint.sh || exit update-ca-certificates
variables: dockerd-entrypoint.sh || exit
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG variables:
script: IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050 script:
- docker build -t $IMAGE_TAG . - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050
- docker push $IMAGE_TAG - docker build -t $IMAGE_TAG .
tags: - docker push $IMAGE_TAG
- "runner-for-#{project.name}" tags:
YAML - "runner-for-#{project.name}"
}]) YAML
}])
end
end end
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
......
...@@ -53,13 +53,15 @@ module QA ...@@ -53,13 +53,15 @@ module QA
Flow::Login.sign_in Flow::Login.sign_in
project.visit! project.visit!
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: gitlab_ci_yaml file_path: '.gitlab-ci.yml',
}]) content: gitlab_ci_yaml
}])
end
end end
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
......
...@@ -82,14 +82,16 @@ module QA ...@@ -82,14 +82,16 @@ module QA
setting.click_save_changes_button setting.click_save_changes_button
end end
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = imported_project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.branch = 'online-gc-test-builder-poc' commit.project = imported_project
commit.commit_message = 'Update .gitlab-ci.yml' commit.branch = 'online-gc-test-builder-poc'
commit.update_files([{ commit.commit_message = 'Update .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.update_files([{
content: gitlab_ci_yaml file_path: '.gitlab-ci.yml',
}]) content: gitlab_ci_yaml
}])
end
end end
end end
......
...@@ -46,32 +46,34 @@ module QA ...@@ -46,32 +46,34 @@ module QA
with_them do with_them do
it "pulls an image using the dependency proxy" do it "pulls an image using the dependency proxy" do
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
dependency-proxy-pull-test: <<~YAML
image: "#{docker_client_version}" dependency-proxy-pull-test:
services: image: "#{docker_client_version}"
- name: "#{docker_client_version}-dind" services:
command: ["--insecure-registry=gitlab.test:80"] - name: "#{docker_client_version}-dind"
before_script: command: ["--insecure-registry=gitlab.test:80"]
- apk add curl jq grep before_script:
- echo $CI_DEPENDENCY_PROXY_SERVER - apk add curl jq grep
- docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" gitlab.test:80 - echo $CI_DEPENDENCY_PROXY_SERVER
script: - docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" gitlab.test:80
- docker pull #{dependency_proxy_url}/#{image_sha} script:
- TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token) - docker pull #{dependency_proxy_url}/#{image_sha}
- 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' - TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token)
- docker pull #{dependency_proxy_url}/#{image_sha} - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1'
- 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' - docker pull #{dependency_proxy_url}/#{image_sha}
tags: - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1'
- "runner-for-#{project.name}" tags:
YAML - "runner-for-#{project.name}"
}]) YAML
}])
end
end end
project.visit! project.visit!
......
...@@ -70,19 +70,20 @@ module QA ...@@ -70,19 +70,20 @@ module QA
before do before do
Flow::Login.sign_in Flow::Login.sign_in
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{ commit.add_files([{
file_path: '.gitlab-ci.yml', file_path: '.gitlab-ci.yml',
content: gitlab_ci_yaml content: gitlab_ci_yaml
}, },
{ {
file_path: 'composer.json', file_path: 'composer.json',
content: composer_json_file content: composer_json_file
}] }]
) )
end
end end
project.visit! project.visit!
......
...@@ -44,27 +44,29 @@ module QA ...@@ -44,27 +44,29 @@ module QA
it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1638' do it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1638' do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
image: conanio/gcc7 <<~YAML
image: conanio/gcc7
test_package:
stage: deploy test_package:
script: stage: deploy
- "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan" script:
- "conan new #{package.name}/0.1 -t" - "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan"
- "conan create . mycompany/stable" - "conan new #{package.name}/0.1 -t"
- "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package.name}/0.1@mycompany/stable --all --remote=gitlab" - "conan create . mycompany/stable"
- "conan install #{package.name}/0.1@mycompany/stable --remote=gitlab" - "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package.name}/0.1@mycompany/stable --all --remote=gitlab"
tags: - "conan install #{package.name}/0.1@mycompany/stable --remote=gitlab"
- "runner-for-#{project.name}" tags:
YAML - "runner-for-#{project.name}"
}]) YAML
}])
end
end end
project.visit! project.visit!
......
...@@ -57,18 +57,20 @@ module QA ...@@ -57,18 +57,20 @@ module QA
before do before do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: gitlab_ci_yaml file_path: '.gitlab-ci.yml',
}, content: gitlab_ci_yaml
{ },
file_path: 'file.txt', {
content: file_txt file_path: 'file.txt',
}] content: file_txt
) }]
)
end
end end
project.visit! project.visit!
......
...@@ -93,11 +93,12 @@ module QA ...@@ -93,11 +93,12 @@ module QA
end end
it "pushes and pulls a helm chart" do it "pushes and pulls a helm chart" do
# pushing Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = package_project commit.project = package_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([package_gitlab_ci_file, package_chart_yaml_file]) commit.add_files([package_gitlab_ci_file, package_chart_yaml_file])
end
end end
package_project.visit! package_project.visit!
...@@ -124,11 +125,12 @@ module QA ...@@ -124,11 +125,12 @@ module QA
expect(show).to have_package_info(package_name, package_version) expect(show).to have_package_info(package_name, package_version)
end end
# pulling Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = client_project commit.project = client_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([client_gitlab_ci_file]) commit.add_files([client_gitlab_ci_file])
end
end end
client_project.visit! client_project.visit!
......
...@@ -139,11 +139,12 @@ module QA ...@@ -139,11 +139,12 @@ module QA
end end
it "pushes and pulls a maven package via gradle using #{params[:authentication_token_type]}" do it "pushes and pulls a maven package via gradle using #{params[:authentication_token_type]}" do
# pushing Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = package_project commit.project = package_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([package_gitlab_ci_file, package_build_gradle_file]) commit.add_files([package_gitlab_ci_file, package_build_gradle_file])
end
end end
package_project.visit! package_project.visit!
...@@ -170,11 +171,12 @@ module QA ...@@ -170,11 +171,12 @@ module QA
expect(show).to have_package_info(package_name, package_version) expect(show).to have_package_info(package_name, package_version)
end end
# pulling Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = client_project commit.project = client_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([client_gitlab_ci_file, client_build_gradle_file]) commit.add_files([client_gitlab_ci_file, client_build_gradle_file])
end
end end
client_project.visit! client_project.visit!
......
...@@ -171,15 +171,16 @@ module QA ...@@ -171,15 +171,16 @@ module QA
end end
it "pushes and pulls a maven package via maven using #{params[:authentication_token_type]}" do it "pushes and pulls a maven package via maven using #{params[:authentication_token_type]}" do
# pushing Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = package_project commit.project = package_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([ commit.add_files([
package_gitlab_ci_file, package_gitlab_ci_file,
package_pom_file, package_pom_file,
settings_xml settings_xml
]) ])
end
end end
package_project.visit! package_project.visit!
...@@ -206,15 +207,16 @@ module QA ...@@ -206,15 +207,16 @@ module QA
expect(show).to have_package_info(package_name, package_version) expect(show).to have_package_info(package_name, package_version)
end end
# pulling Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = client_project commit.project = client_project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([ commit.add_files([
client_gitlab_ci_file, client_gitlab_ci_file,
client_pom_file, client_pom_file,
settings_xml settings_xml
]) ])
end
end end
client_project.visit! client_project.visit!
...@@ -290,14 +292,16 @@ module QA ...@@ -290,14 +292,16 @@ module QA
end end
def push_duplicated_package def push_duplicated_package
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = client_project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = client_project
commit.add_files([ commit.commit_message = 'Add .gitlab-ci.yml'
package_gitlab_ci_file, commit.add_files([
package_pom_file, package_gitlab_ci_file,
settings_xml package_pom_file,
]) settings_xml
])
end
end end
end end
......
...@@ -156,13 +156,15 @@ module QA ...@@ -156,13 +156,15 @@ module QA
end end
it "push and pull a npm package via CI using a #{params[:token_name]}" do it "push and pull a npm package via CI using a #{params[:token_name]}" do
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([ commit.commit_message = 'Add .gitlab-ci.yml'
gitlab_ci_deploy_yaml, commit.add_files([
package_json gitlab_ci_deploy_yaml,
]) package_json
])
end
end end
project.visit! project.visit!
...@@ -176,12 +178,14 @@ module QA ...@@ -176,12 +178,14 @@ module QA
expect(job).to be_successful(timeout: 800) expect(job).to be_successful(timeout: 800)
end end
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = another_project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = another_project
commit.add_files([ commit.commit_message = 'Add .gitlab-ci.yml'
gitlab_ci_install_yaml commit.add_files([
]) gitlab_ci_install_yaml
])
end
end end
another_project.visit! another_project.visit!
......
...@@ -9,6 +9,7 @@ module QA ...@@ -9,6 +9,7 @@ module QA
Resource::Project.fabricate_via_api! do |project| Resource::Project.fabricate_via_api! do |project|
project.name = 'nuget-package-project' project.name = 'nuget-package-project'
project.template_name = 'dotnetcore' project.template_name = 'dotnetcore'
project.visibility = :private
end end
end end
...@@ -93,35 +94,37 @@ module QA ...@@ -93,35 +94,37 @@ module QA
it "publishes a nuget package at the project level, installs and deletes it at the group level using a #{params[:token_name]}" do it "publishes a nuget package at the project level, installs and deletes it at the group level using a #{params[:token_name]}" do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.update_files( commit.commit_message = 'Add .gitlab-ci.yml'
[ commit.update_files(
{ [
file_path: '.gitlab-ci.yml', {
content: <<~YAML file_path: '.gitlab-ci.yml',
image: mcr.microsoft.com/dotnet/sdk:5.0 content: <<~YAML
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- deploy stages:
- deploy
deploy:
stage: deploy deploy:
script: stage: deploy
- dotnet restore -p:Configuration=Release script:
- dotnet build -c Release - dotnet restore -p:Configuration=Release
- dotnet pack -c Release -p:PackageID=#{package.name} - dotnet build -c Release
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text - dotnet pack -c Release -p:PackageID=#{package.name}
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text
rules: - dotnet nuget push "bin/Release/*.nupkg" --source gitlab
- if: '$CI_COMMIT_BRANCH == "#{project.default_branch}"' rules:
tags: - if: '$CI_COMMIT_BRANCH == "#{project.default_branch}"'
- "runner-for-#{project.group.name}" tags:
YAML - "runner-for-#{project.group.name}"
} YAML
] }
) ]
)
end
end end
project.visit! project.visit!
...@@ -137,50 +140,52 @@ module QA ...@@ -137,50 +140,52 @@ module QA
another_project.visit! another_project.visit!
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = another_project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add new csproj file' commit.project = another_project
commit.add_files( commit.commit_message = 'Add new csproj file'
[ commit.add_files(
{ [
file_path: 'otherdotnet.csproj', {
content: <<~EOF file_path: 'otherdotnet.csproj',
<Project Sdk="Microsoft.NET.Sdk"> content: <<~EOF
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <OutputType>Exe</OutputType>
</PropertyGroup> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
EOF </Project>
} EOF
] }
) ]
commit.update_files( )
[ commit.update_files(
{ [
file_path: '.gitlab-ci.yml', {
content: <<~YAML file_path: '.gitlab-ci.yml',
image: mcr.microsoft.com/dotnet/sdk:5.0 content: <<~YAML
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- install stages:
- install
install:
stage: install install:
script: stage: install
- dotnet nuget locals all --clear script:
- dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/#{another_project.group.id}/-/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text - dotnet nuget locals all --clear
- "dotnet add otherdotnet.csproj package #{package.name} --version 1.0.0" - dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/#{another_project.group.id}/-/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text
only: - "dotnet add otherdotnet.csproj package #{package.name} --version 1.0.0"
- "#{another_project.default_branch}" only:
tags: - "#{another_project.default_branch}"
- "runner-for-#{project.group.name}" tags:
YAML - "runner-for-#{project.group.name}"
} YAML
] }
) ]
)
end
end end
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
......
...@@ -34,58 +34,60 @@ module QA ...@@ -34,58 +34,60 @@ module QA
before do before do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add .gitlab-ci.yml' commit.project = project
commit.add_files([{ commit.commit_message = 'Add .gitlab-ci.yml'
file_path: '.gitlab-ci.yml', commit.add_files([{
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
image: python:latest <<~YAML
stages: image: python:latest
- run stages:
- install - run
- install
run:
stage: run run:
script: stage: run
- pip install twine script:
- python setup.py sdist bdist_wheel - pip install twine
- "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*" - python setup.py sdist bdist_wheel
tags: - "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*"
tags:
- "runner-for-#{project.name}"
install:
stage: install
script:
- "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}" - "runner-for-#{project.name}"
install:
stage: install YAML
script: },
- "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: file_path: 'setup.py',
- "runner-for-#{project.name}" content:
<<~EOF
YAML import setuptools
},
{ setuptools.setup(
file_path: 'setup.py', name="#{package.name}",
content: version="0.0.1",
<<~EOF author="Example Author",
import setuptools author_email="author@example.com",
description="A small example package",
setuptools.setup( packages=setuptools.find_packages(),
name="#{package.name}", classifiers=[
version="0.0.1", "Programming Language :: Python :: 3",
author="Example Author", "License :: OSI Approved :: MIT License",
author_email="author@example.com", "Operating System :: OS Independent",
description="A small example package", ],
packages=setuptools.find_packages(), python_requires='>=3.6',
classifiers=[ )
"Programming Language :: Python :: 3", EOF
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent", }])
], end
python_requires='>=3.6',
)
EOF
}])
end end
project.visit! project.visit!
......
...@@ -46,91 +46,93 @@ module QA ...@@ -46,91 +46,93 @@ module QA
it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1906' do it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1906' do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
commit.project = project Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.commit_message = 'Add package files' commit.project = project
commit.add_files( commit.commit_message = 'Add package files'
[ commit.add_files(
{ [
file_path: '.gitlab-ci.yml', {
content: file_path: '.gitlab-ci.yml',
<<~YAML content:
image: ruby <<~YAML
image: ruby
test_package:
stage: deploy test_package:
before_script: stage: deploy
- mkdir ~/.gem before_script:
- echo "---" > ~/.gem/credentials - mkdir ~/.gem
- | - echo "---" > ~/.gem/credentials
echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials - |
- chmod 0600 ~/.gem/credentials echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
script: - chmod 0600 ~/.gem/credentials
- gem build #{package.name} script:
- gem push #{package.name}-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems - gem build #{package.name}
tags: - gem push #{package.name}-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems
- "runner-for-#{project.name}" tags:
YAML - "runner-for-#{project.name}"
}, YAML
{ },
file_path: 'lib/hello_gem.rb', {
content: file_path: 'lib/hello_gem.rb',
<<~RUBY content:
class HelloWorld <<~RUBY
def self.hi class HelloWorld
puts "Hello world!" def self.hi
puts "Hello world!"
end
end end
end RUBY
RUBY },
}, {
{ file_path: "#{package.name}.gemspec",
file_path: "#{package.name}.gemspec", content:
content: <<~RUBY
<<~RUBY # frozen_string_literal: true
# frozen_string_literal: true
Gem::Specification.new do |s|
Gem::Specification.new do |s| s.name = '#{package.name}'
s.name = '#{package.name}' s.authors = ['Tanuki Steve', 'Hal 9000']
s.authors = ['Tanuki Steve', 'Hal 9000'] s.author = 'Tanuki Steve'
s.author = 'Tanuki Steve' s.version = '0.0.1'
s.version = '0.0.1' s.date = '2011-09-29'
s.date = '2011-09-29' s.summary = 'this is a test package'
s.summary = 'this is a test package' s.files = ['lib/hello_gem.rb']
s.files = ['lib/hello_gem.rb'] s.require_paths = ['lib']
s.require_paths = ['lib']
s.description = 'A test package for GitLab.'
s.description = 'A test package for GitLab.' s.email = 'tanuki@not_real.com'
s.email = 'tanuki@not_real.com' s.homepage = 'https://gitlab.com/ruby-co/my-package'
s.homepage = 'https://gitlab.com/ruby-co/my-package' s.license = 'MIT'
s.license = 'MIT'
s.metadata = {
s.metadata = { 'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues',
'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues', 'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md',
'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md', 'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs',
'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs', 'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme',
'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme', 'source_code_uri' => 'https://gitlab.com/ruby-co/my-package'
'source_code_uri' => 'https://gitlab.com/ruby-co/my-package' }
}
s.bindir = 'bin'
s.bindir = 'bin' s.platform = Gem::Platform::RUBY
s.platform = Gem::Platform::RUBY s.post_install_message = 'Installed, thank you!'
s.post_install_message = 'Installed, thank you!' s.rdoc_options = ['--main']
s.rdoc_options = ['--main'] s.required_ruby_version = '>= 2.7.0'
s.required_ruby_version = '>= 2.7.0' s.required_rubygems_version = '>= 1.8.11'
s.required_rubygems_version = '>= 1.8.11' s.requirements = 'A high powered server or calculator'
s.requirements = 'A high powered server or calculator' s.rubygems_version = '1.8.09'
s.rubygems_version = '1.8.09'
s.add_dependency 'dependency_1', '~> 1.2.3'
s.add_dependency 'dependency_1', '~> 1.2.3' s.add_dependency 'dependency_2', '3.0.0'
s.add_dependency 'dependency_2', '3.0.0' s.add_dependency 'dependency_3', '>= 1.0.0'
s.add_dependency 'dependency_3', '>= 1.0.0' s.add_dependency 'dependency_4'
s.add_dependency 'dependency_4' end
end
RUBY
RUBY }
} ]
] )
) end
end end
project.visit! project.visit!
......
# frozen_string_literal: true
RSpec.describe QA::Scenario::Test::Integration::Kubernetes do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:kubernetes] }
end
end
end
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