Commit 734ddb6f authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'object-storage-container-registry' into 'master'

Add container registry to object storage

See merge request gitlab-org/gitlab!71905
parents dc10e297 3551f8f3
...@@ -50,7 +50,8 @@ module QA ...@@ -50,7 +50,8 @@ module QA
"user_gpg" => "UserGPG", "user_gpg" => "UserGPG",
"smtp" => "SMTP", "smtp" => "SMTP",
"otp" => "OTP", "otp" => "OTP",
"jira_api" => "JiraAPI" "jira_api" => "JiraAPI",
"registry_tls" => "RegistryTLS"
) )
loader.setup loader.setup
......
# frozen_string_literal: true
module QA
module Scenario
module Test
module Integration
class RegistryTLS < Test::Instance::All
tags :registry_tls
end
end
end
end
end
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Package', :registry, :orchestrated, only: { pipeline: :main } do RSpec.describe 'Package', :orchestrated do
describe 'Self-managed Container Registry' do describe 'Self-managed Container Registry' do
let(:project) do let(:project) do
Resource::Project.fabricate_via_api! do |project| Resource::Project.fabricate_via_api! do |project|
...@@ -28,59 +28,112 @@ module QA ...@@ -28,59 +28,112 @@ module QA
runner.remove_via_api! runner.remove_via_api!
end end
it "pushes image and deletes tag", testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1911' do context 'when tls is enabled' do
Resource::Repository::Commit.fabricate_via_api! do |commit| it "pushes image and deletes tag", :registry_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1911' 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
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('build') pipeline.click_job('build')
end end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Menu.perform(&:go_to_container_registry)
Page::Project::Registry::Show.perform do |registry|
expect(registry).to have_registry_repository(project.path_with_namespace)
registry.click_on_image(project.path_with_namespace)
expect(registry).to have_tag('master')
Page::Project::Job::Show.perform do |job| registry.click_delete
expect(job).to be_successful(timeout: 800) expect(registry).not_to have_tag('master')
end
end end
end
context "when tls is disabled" do
it "pushes image and deletes tag", :registry, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2378' 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 $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
tags:
- "runner-for-#{project.name}"
YAML
}])
end
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('build')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Menu.perform(&:go_to_container_registry) Page::Project::Menu.perform(&:go_to_container_registry)
Page::Project::Registry::Show.perform do |registry| Page::Project::Registry::Show.perform do |registry|
expect(registry).to have_registry_repository(project.path_with_namespace) expect(registry).to have_registry_repository(project.path_with_namespace)
registry.click_on_image(project.path_with_namespace) registry.click_on_image(project.path_with_namespace)
expect(registry).to have_tag('master') expect(registry).to have_tag('master')
registry.click_delete registry.click_delete
expect(registry).not_to have_tag('master') expect(registry).not_to have_tag('master')
end
end end
end end
end end
......
...@@ -57,17 +57,11 @@ module QA ...@@ -57,17 +57,11 @@ module QA
image: "#{docker_client_version}" image: "#{docker_client_version}"
services: services:
- name: "#{docker_client_version}-dind" - name: "#{docker_client_version}-dind"
command: command: ["--insecure-registry=gitlab.test:80"]
- /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
update-ca-certificates
dockerd-entrypoint.sh || exit
before_script: before_script:
- apk add curl jq grep - apk add curl jq grep
- docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_DEPENDENCY_PROXY_SERVER" - echo $CI_DEPENDENCY_PROXY_SERVER
- docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" gitlab.test:80
script: script:
- docker pull #{dependency_proxy_url}/#{image_sha} - docker pull #{dependency_proxy_url}/#{image_sha}
- TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token) - TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token)
......
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