Commit 2c2ea775 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'acunskis-remove-qa-image-review-app' into 'master'

Execute e2e specs for review app inside gitlab-qa image directly

See merge request gitlab-org/gitlab!64165
parents 1e95e476 a4054779
......@@ -116,13 +116,14 @@ review-stop:
.review-qa-base:
extends:
- .use-docker-in-docker
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7
image:
name: ${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_REF_SLUG}
entrypoint: [""]
stage: qa
needs: ["review-deploy"]
needs: ["build-qa-image", "review-deploy"]
variables:
QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa"
QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
QA_DEBUG: "true"
QA_CAN_TEST_GIT_PROTOCOL_V2: "false"
QA_GENERATE_ALLURE_REPORT: "true"
GITLAB_USERNAME: "root"
GITLAB_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}"
......@@ -132,15 +133,16 @@ review-stop:
EE_LICENSE: "${REVIEW_APPS_EE_LICENSE}"
SIGNUP_DISABLED: "true"
before_script:
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_REF_SLUG}"
# Use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA so that GitLab image built in omnibus-gitlab-mirror and QA image are in sync.
- if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA};
fi
- export CI_ENVIRONMENT_URL="$(cat environment_url.txt)"
- echo "${CI_ENVIRONMENT_URL}"
- echo "${QA_IMAGE}"
- *base-before_script
- gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}}
- cd qa
artifacts:
paths:
- ./qa/gitlab-qa-run-*
- qa/tmp
expire_in: 7 days
when: always
......@@ -157,7 +159,7 @@ review-stop:
script:
- |
allure-report-publisher upload gcs \
--results-glob="qa/gitlab-qa-run-*/**/allure-results/*" \
--results-glob="qa/tmp/allure-results/*" \
--bucket="gitlab-qa-allure-reports" \
--prefix="$ALLURE_REPORT_PATH_PREFIX/$CI_COMMIT_REF_SLUG" \
--update-pr="comment" \
......@@ -171,7 +173,7 @@ review-qa-smoke:
- .review:rules:review-qa-smoke
retry: 1 # This is confusing but this means "2 runs at max".
script:
- gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
- bin/test Test::Instance::Smoke "${CI_ENVIRONMENT_URL}"
review-qa-all:
extends:
......@@ -181,7 +183,14 @@ review-qa-all:
script:
- export KNAPSACK_REPORT_PATH=knapsack/master_report.json
- export KNAPSACK_TEST_FILE_PATTERN=qa/specs/features/**/*_spec.rb
- gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" -- --format RspecJunitFormatter --out tmp/rspec-${CI_JOB_ID}.xml --format html --out tmp/rspec.htm --color --format documentation
- |
bin/test Test::Instance::All "${CI_ENVIRONMENT_URL}" \
-- \
--color --format documentation \
--format RspecJunitFormatter --out tmp/rspec.xml
artifacts:
reports:
junit: qa/tmp/rspec.xml
review-performance:
extends:
......@@ -209,32 +218,6 @@ review-performance:
performance: performance.json
expire_in: 31d
parallel-spec-reports:
extends:
- .review:rules:review-qa-all
image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine
stage: post-qa
needs: ["review-qa-all"]
variables:
NEW_PARALLEL_SPECS_REPORT: qa/report-new.html
BASE_ARTIFACT_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/qa/"
script:
- apk add --update build-base libxml2-dev libxslt-dev && rm -rf /var/cache/apk/*
- gem install nokogiri --no-document
- cd qa/gitlab-qa-run-*/gitlab-*
- ARTIFACT_DIRS=$(pwd |rev| awk -F / '{print $1,$2}' | rev | sed s_\ _/_)
- cd -
- '[[ -f $NEW_PARALLEL_SPECS_REPORT ]] || echo "{}" > ${NEW_PARALLEL_SPECS_REPORT}'
- scripts/merge-html-reports ${NEW_PARALLEL_SPECS_REPORT} ${BASE_ARTIFACT_URL}${ARTIFACT_DIRS} qa/gitlab-qa-run-*/**/rspec.htm
artifacts:
when: always
paths:
- qa/report-new.html
- qa/gitlab-qa-run-*
reports:
junit: qa/gitlab-qa-run-*/**/rspec-*.xml
expire_in: 31d
allure-report-qa-smoke:
extends:
- .allure-report-base
......
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'nokogiri'
main_report_file = ARGV.shift
unless main_report_file
puts 'usage: merge-html-reports <main-report> <base-artifact-url> [parallel reports...]'
exit 1
end
base_artifact_url = ARGV.shift
unless base_artifact_url
puts 'usage: merge-html-reports <main-report> <base-artifact-url> [parallel reports...]'
exit 1
end
# Create the base report with empty body tag
new_report = Nokogiri::HTML.parse(File.read(ARGV[0]))
new_report.at_css('body').remove
empty_body = Nokogiri::XML::Node.new('body', new_report)
new_report.at_css('head').add_next_sibling(empty_body)
ARGV.each do |report_file|
report = Nokogiri::HTML.parse(File.read(report_file))
report.css('a').each do |link|
link_suffix = link['href'].slice(19..-1)
link['href'] = base_artifact_url + link_suffix
end
header = report.css('div #rspec-header')
tests = report.css('dt[id^="example_group_"]')
tests.each do |test|
title = test.parent
group = title.parent
script = title.css('script')
if script.inner_html.include? 'makeYellow'
test.remove_class('passed')
test.add_class('not_implemented')
group.remove_class('passed')
group.add_class('not_implemented')
header.add_class('not_implemented')
script.remove
test.next_sibling.remove
test.next_sibling.remove
elsif script.inner_html.include? 'makeRed'
test.remove_class('passed')
test.add_class('failed')
group.remove_class('passed')
group.add_class('failed')
header.add_class('failed')
script.remove
test.next_sibling.remove
test.next_sibling.remove
end
end
duration = report.at_css('p#duration')
totals = report.at_css('p#totals')
duration_script = report.css('div.results script')[-2]
totals_script = report.css('div.results script')[-1]
duration_text = duration_script.text.slice(49..-3)
totals_text = totals_script.text.slice(47..-3)
duration.inner_html = duration_text
totals.inner_html = totals_text
duration_script.remove
totals_script.remove
# Add the new result after the last one to keep the test order
new_report.css('body')[-1].add_next_sibling(report.at_css('body'))
end
File.write(main_report_file, new_report)
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