Skip to content
代码片段 群组 项目
提交 c4294e92 编辑于 作者: Dan Davison's avatar Dan Davison
浏览文件

Merge branch 'sv-add-compliance-check-registry-specs' into 'master'

Add compliance checks to registry tests

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123953



Merged-by: default avatarDan Davison <ddavison@gitlab.com>
Approved-by: default avatarDan Davison <ddavison@gitlab.com>
Reviewed-by: default avatarDan Davison <ddavison@gitlab.com>
Co-authored-by: default avatarSofia Vistas <svistas@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -11,43 +11,45 @@ module QA ...@@ -11,43 +11,45 @@ module QA
end end
end end
let(:registry_repository) do
Resource::RegistryRepository.fabricate! do |repository|
repository.name = project.path_with_namespace.to_s
repository.project = project
end
end
let!(:gitlab_ci_yaml) do let!(:gitlab_ci_yaml) do
<<~YAML <<~YAML
build: stages:
image: docker:24.0.1 - test
stage: build - build
services:
- docker:24.0.1-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
before_script:
- |
echo "Waiting for docker to start..."
for i in $(seq 1 30)
do
docker info && break
sleep 1s
done
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
YAML
end
after do test:
registry_repository&.remove_via_api! image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
stage: test
script:
- 'status_code=$(curl --header "Authorization: Bearer $CI_JOB_TOKEN" "https://${CI_SERVER_HOST}/gitlab/v1")'
- |
if [ "$status_code" -eq 404 ]; then
echo "The registry implements this API specification, but it is unavailable because the metadata database is disabled."
exit 1
fi
build:
image: docker:24.0.1
stage: build
services:
- docker:24.0.1-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
before_script:
- |
echo "Waiting for docker to start..."
for i in $(seq 1 30); do
docker info && break
sleep 1s
done
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
YAML
end end
it 'pushes project image to the container registry and deletes tag', it 'pushes project image to the container registry and deletes tag',
...@@ -68,12 +70,21 @@ module QA ...@@ -68,12 +70,21 @@ module QA
Flow::Pipeline.visit_latest_pipeline Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('test')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 200)
job.click_element(:pipeline_path)
end
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| Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800) expect(job).to be_successful(timeout: 500)
end end
Page::Project::Menu.perform(&:go_to_container_registry) Page::Project::Menu.perform(&:go_to_container_registry)
......
...@@ -43,10 +43,6 @@ module QA ...@@ -43,10 +43,6 @@ module QA
project.visit! project.visit!
end end
after do
runner.remove_via_api!
end
context "when tls is disabled" do context "when tls is disabled" do
where do where do
{ {
...@@ -200,27 +196,27 @@ module QA ...@@ -200,27 +196,27 @@ module QA
file_path: '.gitlab-ci.yml', file_path: '.gitlab-ci.yml',
content: content:
<<~YAML <<~YAML
build: build:
image: docker:23.0.6 image: docker:23.0.6
stage: build stage: build
services: services:
- name: docker:23.0.6-dind - name: docker:23.0.6-dind
command: command:
- /bin/sh - /bin/sh
- -c - -c
- | - |
apk add --no-cache openssl apk add --no-cache openssl
true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt
update-ca-certificates update-ca-certificates
dockerd-entrypoint.sh || exit dockerd-entrypoint.sh || exit
variables: variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
script: script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050
- docker build -t $IMAGE_TAG . - docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG - docker push $IMAGE_TAG
tags: tags:
- "runner-for-#{project.name}" - "runner-for-#{project.name}"
YAML YAML
} }
] ]
...@@ -234,7 +230,11 @@ module QA ...@@ -234,7 +230,11 @@ module QA
pipeline.click_job('build') pipeline.click_job('build')
end end
Support::Retrier.retry_until(max_duration: 800, sleep_interval: 10) do Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 200)
end
Support::Retrier.retry_until(max_duration: 500, sleep_interval: 10) do
project.pipelines.last[:status] == 'success' project.pipelines.last[:status] == 'success'
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册