Skip to content
Snippets Groups Projects

Add JH files into QA docker when pass the jh parameter

Merged Song Huang requested to merge gitlab-jh/jh-team/gitlab:feature/jh-qa-docker into master
All threads resolved!

What does this MR do and why?

Another way to solve the problem in !90881 (merged) seems it is not supported in our CI environment.

This solution comes from here: https://stackoverflow.com/a/54245466

How to set up and validate locally

  1. When not in JiHu environment, nothing will change here, the QA docker image dir will be:
├── INSTALLATION_TYPE
├── VERSION
├── config
├── ee
├── lib
├── qa
  1. When in JiHu environment, we need add build args --build-arg QA_BUILD_TARGET=jhqa and then the QA docker image dir will be:
├── INSTALLATION_TYPE
├── VERSION
├── config
├── ee
├── lib
├── qa
├── jh
│   ├── qa
│   ├── lib

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

/cc @daveliu

Edited by Song Huang

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Song Huang added 1 commit

    added 1 commit

    Compare with previous version

    • Resolved by Jason Zhang

      I think potentially cleaner way could be using multi-stage build.

      You could check beforehand if jh folder exists and set a target based on that via --target option. This would however make it less portable when building locally, a user would need to know which target to set.

      ARG DOCKER_VERSION=20.10.14
      ARG CHROME_VERSION=101
      
      FROM registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-2.7:bundler-2.3-git-2.33-lfs-2.9-chrome-${CHROME_VERSION}-docker-${DOCKER_VERSION}-gcloud-383-kubectl-1.23 as gitlab
      LABEL maintainer="GitLab Quality Department <quality@gitlab.com>"
      
      ENV DEBIAN_FRONTEND="noninteractive"
      # Override config path to make sure local config doesn't override it when building image locally
      ENV BUNDLE_APP_CONFIG=/home/gitlab/.bundle
      
      ##
      # Install system libs
      #
      RUN apt-get update; \
          apt-get install -y xvfb unzip; \
          apt-get -yq autoremove; \
          apt-get clean -yqq; \
          rm -rf /var/lib/apt/lists/*
      
      ##
      # Install root certificate
      #
      RUN mkdir -p /usr/share/ca-certificates/gitlab
      ADD ./qa/tls_certificates/authority/ca.crt /usr/share/ca-certificates/gitlab/
      RUN echo 'gitlab/ca.crt' >> /etc/ca-certificates.conf
      RUN chmod -R 644 /usr/share/ca-certificates/gitlab && update-ca-certificates
      
      WORKDIR /home/gitlab/qa
      
      ##
      # Install qa dependencies or fetch from cache if unchanged
      #
      COPY ./qa/Gemfile* /home/gitlab/qa/
      RUN bundle config set --local without development \
          && bundle install --retry=3
      
      ##
      # Fetch chromedriver based on version of chrome
      # Copy rakefile first so that webdriver is not reinstalled on every code change
      # https://github.com/titusfortner/webdrivers
      #
      COPY ./qa/tasks/webdrivers.rake /home/gitlab/qa/tasks/
      RUN bundle exec rake -f tasks/webdrivers.rake webdrivers:chromedriver:update
      
      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)
      COPY VERSION ./ee/app/models/license.r[b] /home/gitlab/ee/app/models/
      COPY ./config/bundler_setup.rb /home/gitlab/config/
      COPY ./config/feature_flags /home/gitlab/config/feature_flags
      COPY ./lib/gitlab_edition.rb /home/gitlab/lib/
      COPY ./lib/gitlab/utils.rb /home/gitlab/lib/gitlab/
      COPY ./INSTALLATION_TYPE ./VERSION /home/gitlab/
      
      COPY ./qa /home/gitlab/qa
      
      ENTRYPOINT ["bin/test"]
      
      FROM gitlab as jh
      
      COPY VERSION ./jh/qa /home/gitlab/jh/qa/
      COPY VERSION ./jh/lib /home/gitlab/jh/lib/

      The benefit of such approach is that final image is "cleaner" in case jh folder is not present as it would not contain extra layers with optional copy.

  • Nick Malcolm removed review request for @dcouture

    removed review request for @dcouture

  • Song Huang added 671 commits

    added 671 commits

    Compare with previous version

  • Song Huang added 1 commit

    added 1 commit

    • 85a89c47 - Add JH files into QA docker when pass the jh parameter

    Compare with previous version

  • Andrejs Cunskis approved this merge request

    approved this merge request

  • Song Huang added 1 commit

    added 1 commit

    • 0dc4ada8 - Add JH files into QA docker when pass the jh parameter

    Compare with previous version

  • Lin Jen-Shin approved this merge request

    approved this merge request

  • Lin Jen-Shin requested review from @mlapierre

    requested review from @mlapierre

  • Mark Lapierre approved this merge request

    approved this merge request

  • Mark Lapierre changed milestone to %15.2

    changed milestone to %15.2

  • added QA label

  • Dominic Couture approved this merge request

    approved this merge request

  • Andrejs Cunskis resolved all threads

    resolved all threads

  • @acunskis, did you forget to run a pipeline before you merged this work? Based on our code review process, if the latest pipeline finished more than 2 hours ago, you should:

    1. Ensure the merge request is not in Draft status.
    2. Start a pipeline (especially important for Community contribution merge requests).
    3. Set the merge request to merge when pipeline succeeds.

    This is a guideline, not a rule. Please consider replying to this comment for transparency.

    (Improve this message?)

  • @songhuangcn, how was your code review experience with this merge request? Please tell us how we can continue to iterate and improve:

    1. Leave a :thumbsup: or a :thumbsdown: on this comment to describe your experience.
    2. Create a new comment starting with @gitlab-bot feedback below, and leave any additional feedback you have for us in the comment.

    Have five minutes? Take our survey to give us even more feedback on how GitLab can improve the contributor experience.

    Thanks for your help! :heart:

  • Andrejs Cunskis mentioned in commit b32238c8

    mentioned in commit b32238c8

  • Song Huang changed the description

    changed the description

  • added workflowstaging label and removed workflowcanary label

  • mentioned in merge request omnibus-gitlab!6206 (merged)

  • Please register or sign in to reply
    Loading