diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 15:11:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 15:11:17 +0300 |
commit | 4f8983ade80c0d71d4c8e6cc0d686c9cecf5e7d4 (patch) | |
tree | 3c51e09d9315acb8930c3c5383fb6384a3a841aa /qa/gdk | |
parent | e191aabc8fd068233ac7b21e6f1299e2c371faba (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/gdk')
-rw-r--r-- | qa/gdk/Dockerfile | 50 | ||||
-rw-r--r-- | qa/gdk/gdk.yml | 26 | ||||
-rwxr-xr-x | qa/gdk/launch | 40 |
3 files changed, 116 insertions, 0 deletions
diff --git a/qa/gdk/Dockerfile b/qa/gdk/Dockerfile new file mode 100644 index 00000000000..ed8f3f317eb --- /dev/null +++ b/qa/gdk/Dockerfile @@ -0,0 +1,50 @@ +FROM registry.gitlab.com/gitlab-org/gitlab-development-kit/asdf-bootstrapped-gdk-installed-gitlab-e2e:ml-create-image-for-gitlab-qa-tests + +ENV CHROME_DRIVER_VERSION="107.0.5304.62" +ENV CHROME_VERSION="107.0.5304.87-1" +ENV CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_amd64.deb" +ENV CHROME_URL="https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-build-images/packages/generic/google-chrome-stable/${CHROME_VERSION}/${CHROME_DEB}" + +WORKDIR /home/gdk/gdk + +COPY --chown=gdk qa/gdk/gdk.yml . + +RUN cat gdk.yml && \ + gdk update && \ + gdk restart && \ + ./support/test_url http://gdk.test:3000 && \ + gdk stop && sleep 5 && \ + GDK_KILL_CONFIRM=true gdk kill && \ + ps -ef && \ + cd gitlab && git reset --hard && \ + sudo rm -rf "$HOME/gdk/gitaly/_build/deps/git/source" \ + "$HOME/gdk/gitaly/_build/deps/libgit2/source" \ + "$HOME/gdk/gitaly/_build/cache" \ + "$HOME/gdk/gitaly/_build/deps" \ + "$HOME/gdk/gitaly/_build/intermediate" \ + "$HOME/.cache/" \ + "$HOME/gdk/gdk/gitlab" \ + /tmp/* + +# Install Google Chrome version with headless support +# Download from our local S3 bucket, populated by https://gitlab.com/gitlab-org/gitlab-build-images/-/blob/master/scripts/cache-google-chrome +# +RUN echo "${CHROME_URL}" && \ + curl --silent --show-error --fail -O "${CHROME_URL}" && \ + sudo apt update && \ + sudo dpkg -i "./${CHROME_DEB}" || true && \ + sudo apt install -f -y && \ + rm -f "./${CHROME_DEB}" + +WORKDIR /home/gdk/gdk/gitlab + +RUN bundle install --jobs=$(nproc) --retry=3 --quiet +RUN cd qa && \ + bundle install --jobs=$(nproc) --retry=3 --quiet && \ + bundle exec rake -f tasks/webdrivers.rake webdrivers:chromedriver:update[${CHROME_DRIVER_VERSION}] + +RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" + +COPY --chown=gdk qa/gdk/launch . + +ENTRYPOINT ["./launch"] diff --git a/qa/gdk/gdk.yml b/qa/gdk/gdk.yml new file mode 100644 index 00000000000..0494cd0d3c1 --- /dev/null +++ b/qa/gdk/gdk.yml @@ -0,0 +1,26 @@ +--- +hostname: gdk.test +sshd: + additional_config: 'AcceptEnv GIT_PROTOCOL' +webpack: + live_reload: false + sourcemaps: false + incremental: false +gdk: + ask_to_restart_after_update: false + auto_reconfigure: false + overwrite_changes: true + quiet: false +gitlab: + rails: + bootsnap: false + hostname: gdk.test +gitlab_k8s_agent: + enabled: false +gitlab_pages: + enabled: false +prometheus: + enabled: false +tracer: + jaeger: + enabled: false diff --git a/qa/gdk/launch b/qa/gdk/launch new file mode 100755 index 00000000000..4b1fc6ae191 --- /dev/null +++ b/qa/gdk/launch @@ -0,0 +1,40 @@ +#!/bin/bash + +COMMIT_REF=${1:-$CI_COMMIT_REF_SLUG} +RSPEC_ARGS=$2 + +if [ -z "${COMMIT_REF}" ]; then + echo "Please provide a commit ref with the code to be tested as the first argument" + exit 1 +fi + +# Set the GitLab license mode to "test" so that GitLab uses the appropriate encryption key +export GITLAB_LICENSE_MODE="test" + +# Create the temporary directory that screenshots are saved to +sudo install -m 777 -d /home/gdk/gdk/gitlab/qa/tmp + +# Update GDK +(cd .. ; gdk update ; cat gdk.yml) + +# Reset, fetch, and checkout the GitLab repository with the code from the ref to be tested +git reset --hard +git fetch origin $COMMIT_REF +git checkout $COMMIT_REF + +# Install the required gems +bundle install --jobs=$(nproc) --retry=3 --quiet + +# Run the database migrations +bundle exec rake db:migrate + +# Restart GDK to be sure any changes are accounted for in running services, start any stopped services, and wait until the GDK is reachable +(cd .. ; gdk restart ; ./support/test_url http://gdk.test:3000) + +# Install the required gems in the QA directory +cd qa +bundle install --jobs=$(nproc) --retry=3 --quiet + +# Run the tests +bundle exec rake "knapsack:download[test]" +bundle exec bin/qa Test::Instance::All http://gdk.test:3000 -- $RSPEC_ARGS || true |