Commit d2595a48 authored by Rémy Coutable's avatar Rémy Coutable

Cache the qa/vendor/ruby folder to speed up the build-qa-image job

Signed-off-by: Rémy Coutable's avatarRémy Coutable <>
parent fdf9fcdd
Pipeline #88035195 failed with stages
in 76 minutes and 56 seconds
# `build_from_dir` can't find Dockerfile when `.dockerignore` is "*"
# See
# Ignore all folders except qa/, config/initializers and the root of lib/ since
# the files we need to build the QA image are in these folders.
# Following are the files we need:
# - ./config/initializers/0_inject_enterprise_edition_module.rb
# - ./ee/app/models/license.rb
# - ./lib/gitlab.rb
# - ./lib/gitlab/utils.rb
# - ./qa/
# Ignore all folders except for the files we need to build the QA image.
......@@ -80,3 +32,15 @@
# Following are the files we need:
# Plus the following:
# - ./qa/
# - ./vendor/ruby
......@@ -23,6 +23,7 @@
- .default-cache
- .review-docker
- .only-code-qa-changes
......@@ -30,6 +31,9 @@ build-qa-image:
- $CI_SERVER_HOST == "" && $CI_PROJECT_NAMESPACE == "gitlab-org"
stage: prepare
- mkdir -p ./qa/vendor
- mv "${CI_PROJECT_DIR}/vendor/ruby" "${CI_PROJECT_DIR}/qa/vendor/ruby"
- ls -l "${CI_PROJECT_DIR}/qa/vendor/ruby"
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
- time docker build --cache-from gitlab/gitlab-${GITLAB_EDITION}-qa:nightly --tag ${QA_IMAGE} --file ./qa/Dockerfile ./
......@@ -48,7 +48,6 @@ RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
apt-get update -y && apt-get install google-cloud-sdk kubectl -y
WORKDIR /home/gitlab/qa
COPY ./qa/Gemfile* /home/gitlab/qa/
COPY ./config/initializers/0_inject_enterprise_edition_module.rb /home/gitlab/config/initializers/
# Copy VERSION to ensure the COPY succeeds to copy at least one file since ee/app/models/license.rb isn't present in FOSS
# The [b] part makes ./ee/app/models/license.r[b] a pattern that is allowed to return no files (which is the case in FOSS)
......@@ -56,7 +55,10 @@ COPY VERSION ./ee/app/models/license.r[b] /home/gitlab/ee/app/models/
COPY ./lib/gitlab.rb /home/gitlab/lib/
COPY ./lib/gitlab/utils.rb /home/gitlab/lib/gitlab/
RUN cd /home/gitlab/qa/ && bundle install --jobs=$(nproc) --retry=3 --quiet
COPY ./qa/Gemfile* /home/gitlab/qa/
COPY ./vendor/ruby /home/gitlab/qa/vendor/
RUN ls -l /home/gitlab/qa/vendor/ruby
RUN cd /home/gitlab/qa/ && bundle install --clean --jobs=$(nproc) --path=vendor --retry=3 --quiet
COPY ./qa /home/gitlab/qa
ENTRYPOINT ["bin/test"]
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