Commit 269db476 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'test-registry-with-3-docker-clients' into 'master'

Add 3 latest docker versions on Container Registry test

See merge request gitlab-org/gitlab!75411
parents 8505e459 6a96f130
......@@ -48,84 +48,87 @@ module QA
project.remove_via_api!
end
where(:authentication_token_type, :token_name) do
:personal_access_token | 'Personal Access Token'
:project_deploy_token | 'Deploy Token'
:ci_job_token | 'Job Token'
end
with_them do
let(:auth_token) do
case authentication_token_type
when :personal_access_token
"\"#{personal_access_token}\""
when :project_deploy_token
"\"#{project_deploy_token.token}\""
when :ci_job_token
'$CI_JOB_TOKEN'
end
context "when tls is disabled" do
where(:authentication_token_type, :token_name) do
:personal_access_token | 'Personal Access Token'
:project_deploy_token | 'Deploy Token'
:ci_job_token | 'Job Token'
end
let(:auth_user) do
case authentication_token_type
when :personal_access_token
"$CI_REGISTRY_USER"
when :project_deploy_token
"\"#{project_deploy_token.username}\""
when :ci_job_token
'gitlab-ci-token'
with_them do
let(:auth_token) do
case authentication_token_type
when :personal_access_token
"\"#{personal_access_token}\""
when :project_deploy_token
"\"#{project_deploy_token.token}\""
when :ci_job_token
'$CI_JOB_TOKEN'
end
end
end
context "when tls is disabled" do
it "using a #{params[:token_name]}, pushes image and deletes tag", :registry do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{
file_path: '.gitlab-ci.yml',
content:
<<~YAML
build:
image: docker:19.03.12
stage: build
services:
- name: docker:19.03.12-dind
command: ["--insecure-registry=gitlab.test:5050"]
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
tags:
- "runner-for-#{project.name}"
YAML
}])
end
let(:auth_user) do
case authentication_token_type
when :personal_access_token
"$CI_REGISTRY_USER"
when :project_deploy_token
"\"#{project_deploy_token.username}\""
when :ci_job_token
'gitlab-ci-token'
end
end
Flow::Pipeline.visit_latest_pipeline
where(:docker_client_version) do
%w[docker:18.09.9 docker:19.03.12 docker:20.10]
end
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('build')
end
with_them do
it "pushes image and deletes tag", :registry do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{
file_path: '.gitlab-ci.yml',
content:
<<~YAML
build:
image: "#{docker_client_version}"
stage: build
services:
- name: "#{docker_client_version}-dind"
command: ["--insecure-registry=gitlab.test:5050"]
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
tags:
- "runner-for-#{project.name}"
YAML
}])
end
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Flow::Pipeline.visit_latest_pipeline
Page::Project::Menu.perform(&:go_to_container_registry)
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('build')
end
Page::Project::Registry::Show.perform do |registry|
expect(registry).to have_registry_repository(project.path_with_namespace)
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Menu.perform(&:go_to_container_registry)
registry.click_on_image(project.path_with_namespace)
expect(registry).to have_tag('master')
Page::Project::Registry::Show.perform do |registry|
expect(registry).to have_registry_repository(project.path_with_namespace)
registry.click_delete
expect(registry).not_to have_tag('master')
registry.click_on_image(project.path_with_namespace)
expect(registry).to have_tag('master')
end
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