gitlab-runner exec shell job_name
gdk start
( gdk doctor
bin/rake frontend:fixtures
yarn karma
yarn jest
CHROME_HEADLESS=0 bundle exec rspec spec/features/projects/tree/create_directory_spec.rb
screenshot_and_save_page
screenshot_and_open_image
live_debug
scripts/static-analysis
(long)yarn eslint
(faster)fdescribe
and fit
for focused karma specsSee https://gitlab.com/gitlab-org/gitlab/tree/master/qa#how-can-i-use-it for more details.
cd qa
bundle
brew cask <install|reinstall> chromedriver
bundle exec bin/qa Test::Instance::All http://0.0.0.0:3000 -- qa/specs/features/ee/browser_ui/1_manage/project/project_templates_spec.rb
To run the QA specs in RubyMine, use a custom rspec runner configuration (right click on the arrow next to the example in the gutter), and set the qa/bin/rubymine
script as the custom RSpec runner script, and the working directory as qa
.
See more detailed instructions for this process here: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/end_to_end_test_configuration.md#starting-tests-using-the-rubymine-gutter
cd sites/handbook && NO_CONTRACTS=true bundle exec middleman
/admin/license
puts
or p
will ONLY show up in gdk tail rails
logger.info('...')
will ONLY show up in tail -f log/development.log
rails-web
By default, the Rails puma configuration template which GitLab uses binds to a socket, instead of a TCP port.
This MR added support for configuring the GDK to bind Rails puma to a TCP socket, and added support for Workhorse to use TCP ports instead of sockets.
See the architecture documentation around components for more details on how GitLab Workhorse and Puma work together.
Why is all of this important?
Because unfortunately, because of this RubyMine bug (https://youtrack.jetbrains.com/issue/RUBY-27404), it is not possible to use the default RubyMine Rails
Run Configuration with a puma configuration which uses a socket binding. (NOTE: If you want this fixed, please go to the issue and thumbs-up to vote for it!)
So, you have two choices to work around this:
Note that you COULD just not worry about any of this, and run a normal RubyMine "Rails" Run Configuration without changing the GDK config, and directly connect to the port it uses (by default 3000). However, this means that you won't be connecting and proxying through the GitLab Workhorse according to the standard component architecture, and some features may be slower, work differently, or not work at all. So, it's safer to go ahead and do one of these two suggested options to use a standard configuration running puma behind the Workhorse proxy.
The following two sections explain how to do those two options.
gdk stop rails-web
before each debugging session (and gdk start rails-web
when you are done debugging)Development: gitlab-puma (use if gdk.yml gitlab rails address IS NOT overridden to use TCP port)
gitlab-puma
gem): /Users/YOUR_USER/.asdf/installs/ruby/RUBY_VERSION/bin/puma
--config /Users/YOUR_USER/PATH_TO/gitlab-development-kit/gitlab/config/puma.rb --environment development
/Users/YOUR_USER/PATH_TO/gitlab-development-kit/gitlab/
Procfile
, they may become outdated): RAILS_ENV=development;RAILS_RELATIVE_URL_ROOT=/;ACTION_CABLE_IN_APP=true;ACTION_CABLE_WORKER_POOL_SIZE=4
gitlab-development-kit/gdk.yml
, add the following. You can use any port, and the hostname should be whatever you normally use - localhost, or gdk.test if you have that hostname set up.
gitlab:
rails:
address: gdk.test:3001
gdk reconfigure
to apply the settings to the bind
entry in gitlab-development-kit/gitlab/config/puma.rb
gdk stop rails-web
before each debugging session (and gdk start rails-web
when you are done debugging)Development: gitlab (use if gdk.yml gitlab rails address IS overridden to use TCP port)
0.0.0.0
3001
(or whatever you put in gdk.yml
)Procfile
, they may become outdated): RAILS_ENV=development;RAILS_RELATIVE_URL_ROOT=/;ACTION_CABLE_IN_APP=true;ACTION_CABLE_WORKER_POOL_SIZE=4
rails-background-jobs
To debug services run as background jobs, you will need to set up debugging for rails-background-jobs
, in addition to the rails-web
debugger. The setup is similar, although you're connecting to the sidekiq process instead of puma.
gdk stop rails-background-jobs
before each debugging session (and gdk start rails-background-jobs
when you are done debugging)Development: gitlab-sidekiq
/Users/YOUR_USER/.asdf/installs/ruby/RUBY_VERSION/bin/sidekiq
/Users/YOUR_USER/PATH_TO/gitlab-development-kit/gitlab/
Procfile
, they may become outdated): SIDEKIQ_VERBOSE=false;SIDEKIQ_QUEUES=default,mailers,email_receiver,hashed_storage:hashed_storage_migrator,hashed_storage:hashed_storage_project_migrate,hashed_storage:hashed_storage_project_rollback,hashed_storage:hashed_storage_rollbacker,project_import_schedule,service_desk_email_receiver;BUNDLE_GEMFILE=/Users/YOUR_USER/PATH_TO/gitlab-development-kit/gitlab/Gemfile;SIDEKIQ_WORKERS=1;ENABLE_BOOTSNAP=true;RAILS_ENV=development;RAILS_RELATIVE_URL_ROOT=/;GITALY_DISABLE_REQUEST_LIMITS=false
git rebase -i master
) and message cleanup via reword
/fixup
are worth learning more about if you are unfamiliar with them.merge-base
(the common ancestor of your branch HEAD
and the upstream branch master
) from the possibility of "conflict resolution" when rebasing against the latest upstream master
.git rebase -i $(git merge-base HEAD master)
. This lets you do your interactive rebase against the merge-base
without any chance of having to deal with conflicts at the same time. Make sure that the merge-base
commit is contained on your master branch (i.e. you didn't just fetch and checkout the branch directly without updating master). You could just git fetch
then rebase against origin/master
, but this negates the benefit of using --force-with-lease
.git push --force-with-lease
(Or just wait until after the next step to push if you don't want to trigger an extra unnecessary build)git rebase master
, to rebase against the latest master, and resolve any conflicts against your cleaned-up, interactively-rebased branch.git push --force-with-lease
(force-with-lease ensures nobody else has pushed to the branch since you last pulled)When a branch has followed a merge instead of a rebase workflow, it can get very confusing to know what is going on, and you want to just squash it down to a single commit. But, you can't just do a regular interactive rebase relative to master if the branch has had master merged into it. Here's what you have to do instead.
Note there may be more efficient ways of doing this, suggestions are welcome. Also note that sometimes this doesn't work, you'll end up with almost all the changes from the branch uncommitted after step 5 - not sure why :(
Assuming branch is named branch
and upstream is named master
:
git log master..branch --oneline
123456
.abcdef
.git reset --hard abcdef
merge --squash
the last commit: git merge --squash 123456
git restore --staged .
git checkout .
git clean -df
Currently our sidebar implementation lives in:
lib/sidebars/
ee/lib/sidebars/
spec/lib/sidebars/
When you need to edit, delete or insert a new sidebar field, you will be working inside these files. The base menu class lives in lib/sidebars/menu.rb
and all other menu items inherit it. If you need different behavior for a menu item, you can override this base class in your implementation. More information about the full implementation is available.
Though the contributor and development docs are the single source of truth, there are some additional habits that may be worth developing when you're new to the code contribution process.
Depending on your existing habits and git
practices the habits below may help mitigate pain during code submissions.
About testing:
Some frontendmasters workshops related to testing that I want to take after the web security workshop: