Age | Commit message (Collapse) | Author |
|
environment
|
|
Fix race conditions for AuthorizedProjectsWorker
Closes #26194 and #26310
See merge request !8701
|
|
There were two cases that could be problematic:
1. Because sometimes AuthorizedProjectsWorker would be scheduled in a
transaction it was possible for a job to run/complete before a
COMMIT; resulting in it either producing an error, or producing no
new data.
2. When scheduling jobs the code would not wait until completion. This
could lead to a user creating a project and then immediately trying
to push to it. Usually this will work fine, but given enough load it
might take a few seconds before a user has access.
The first one is problematic, the second one is mostly just annoying
(but annoying enough to warrant a solution).
This commit changes two things to deal with this:
1. Sidekiq scheduling now takes places after a COMMIT, this is ensured
by scheduling using Rails' after_commit hook instead of doing so in
an arbitrary method.
2. When scheduling jobs the calling thread now waits for all jobs to
complete.
Solution 2 requires tracking of job completions. Sidekiq provides a way
to find a job by its ID, but this involves scanning over the entire
queue; something that is very in-efficient for large queues. As such a
more efficient solution is necessary. There are two main Gems that can
do this in a more efficient manner:
* sidekiq-status
* sidekiq_status
No, this is not a joke. Both Gems do a similar thing (but slightly
different), and the only difference in their name is a dash vs an
underscore. Both Gems however provide far more than just checking if a
job has been completed, and both have their problems. sidekiq-status
does not appear to be actively maintained, with the last release being
in 2015. It also has some issues during testing as API calls are not
stubbed in any way. sidekiq_status on the other hand does not appear to
be very popular, and introduces a similar amount of code.
Because of this I opted to write a simple home grown solution. After
all, all we need is storing a job ID somewhere so we can efficiently
look it up; we don't need extra web UIs (as provided by sidekiq-status)
or complex APIs to update progress, etc.
This is where Gitlab::SidekiqStatus comes in handy. This namespace
contains some code used for tracking, removing, and looking up job IDs;
all without having to scan over an entire queue. Data is removed
explicitly, but also expires automatically just in case.
Using this API we can now schedule jobs in a fork-join like manner: we
schedule the jobs in Sidekiq, process them in parallel, then wait for
completion. By using Sidekiq we can leverage all the benefits such as
being able to scale across multiple cores and hosts, retrying failed
jobs, etc.
The one downside is that we need to make sure we can deal with
unexpected increases in job processing timings. To deal with this the
class Gitlab::JobWaiter (used for waiting for jobs to complete) will
only wait a number of seconds (30 by default). Once this timeout is
reached it will simply return.
For GitLab.com almost all AuthorizedProjectWorker jobs complete in
seconds, only very rarely do we spike to job timings of around a minute.
These in turn seem to be the result of external factors (e.g. deploys),
in which case a user is most likely not able to use the system anyway.
In short, this new solution should ensure that jobs are processed
properly and that in almost all cases a user has access to their
resources whenever they need to have access.
|
|
This reverts commit c20934869f7dc8cfbdbafb6ecb7b1305452c9e8a, reversing
changes made to 4b7ec44b91e0571d209c790d54947ba1756dac0e.
|
|
'master'"
This reverts merge request !8573
|
|
Signed-off-by: Rémy Coutable <remy@rymai.me>
|
|
By passing commit data to this worker we remove the need for querying
the Git repository for every job. This in turn reduces the time spent
processing each job.
The migration included migrates jobs from the old format to the new
format. For this to work properly it requires downtime as otherwise
workers may start producing errors until they're using a newer version
of the worker code.
|
|
|
|
|
|
|
|
|
|
This changes ProjectCacheWorker.perform_async so it only schedules a job
when no lease for the given project is present. This ensures we don't
end up scheduling hundreds of jobs when they won't be executed anyway.
|
|
This reverts merge request !6730
|
|
|
|
This fixes an issue with Rails 5 and brings us up-to-date with the latest Devise release.
This also replaces the deprecated Devise::TestHelpers with Devise::Test::ControllerHelpers.
Changelog: https://github.com/plataformatec/devise/blob/v4.2.0/CHANGELOG.md#420---2016-07-01
|
|
artifacts-from-ref-and-build-name
* upstream/master: (192 commits)
Added CHANGELOG
Added unfold test to parallel and added 'diff discussion' context
Fix Spinach branches spec
Better first match on this MR also
Change merge_error column from string to text type
Fix typo in gitlab_flow.md
entities: make Environment inherit EnvironmentBasic
Updated to optimized specs from !5864
Added 'with an unfolded line should not allow commenting' scenario (line 125)
Added addtional 'renderable' validator to check 'data-note-type' attr exists
Allow passing an index to selectRowAtIndex
Fixed enter key in search input not working
Fix file links on project page Files view
Fix incorrect "stopped impersonation" log message
8.11 is released, long live 8.12
Also check if Akismet is enabled, before showing the `Submit as spam` button.
fix location of markdown help location
Fix for update 8.10-to-8.11.md doc.
Appease the linter.
Add Ruby 2.3 upgrade notes.
...
|
|
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5734#note_14056642
|
|
artifacts-from-ref-and-build-name
* upstream/master: (516 commits)
Rename `run` task helper method to prevent conflict with StateMachine
Add a method in Project to return a cached value of total count of projects
Add Changelog entry for Grape upgrade [ci skip]
Fix Grape tests.
Retain old behavior
Update Grape from 0.13.0 to 0.15.0.
adds second batch of tests changed to active tense
fixes part1 of files to start using active tense
Clarify the features for generating default label sets
Update tree view to sort folders with submodules
Memoize CI config node validator to prevent leaks
fix MR source project assignment
remove offending empty line
Rails prefers require_dependency so that it won't require twice:
use Unix line endings for API documentation
use long options for curl examples in API documentation (!5703)
Prefixes removed branches name with PR number when importing PR from GH
Update CHANGELOG
Remove SHA suffix for removed branches name when importing PR from GH
add linting script for documentation
...
|
|
This is in preparation to address the DB load caused by the counting in
gitlab-com/infrastructure#303.
|
|
|
|
|
|
|
|
|
|
|
|
* master: (335 commits)
Disable transaction when adding index for Ci::Pipeline
added changelog
allow empty repos on import/export
Modify test for Build tabs
Add tests to project builds for pending tab
Remove unused .js-running-count class
Add test for new pending tab and update tests for running tab
Add Pending Tab to Admin Builds
added changelog
limit project expor retry to only 3
use method in validates statement
Fix spec to set import_url before attempting to create import_data
Allow a project import URL to be blank to prevent false positives preventing settings from being saved
Refactor gitlab_ci_yaml_processor variables tests
Fix CI yaml example
Align cancel and retry buttons
Remove deploy to production button
Remove irrelevant comments
Fix gitlab_ci_yaml_processor_spec.rb
Fix AddWhenAndYamlVariablesToCiBuilds migration
...
|
|
It turns out they are different:
builds.success.latest.first
and
builds.latest.success.first
If we put success first, that latest would also filter via success,
and which is what we want here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This allows the removal of the monkey patch from this commit: 47ff1c56089b3df9c36b77c02f0f3db54fea1d54
It'll also make it slightly easier to upgrade to 3.5.0 later.
Changelog: https://github.com/rspec/rspec-rails/blob/master/Changelog.md#340--2015-11-11
|
|
1. Allow subscribing (the current user) to a label
- Refactor the `Subscription` coffeescript class
- The main change is that it accepts a container, and conducts all
DOM queries within its scope. We need this because the labels
page has multiple instances of `Subscription` on the same page.
2. Creating an issue or MR with labels notifies users subscribed to those labels
- Label `has_many` subscribers through subscriptions.
3. Adding a label to an issue or MR notifies users subscribed to those labels
- This only applies to subscribers of the label that has just been
added, not all labels for the issue.
|
|
The rationale for this can be found in
https://gitlab.com/gitlab-org/gitlab-ce/issues/13718 but in short the
benchmark suite no longer serves a good purpose now that we have proper
production monitoring in place.
Fixes gitlab-org/gitlab-ce#13718
|
|
|
|
|
|
|
|
Refactor Ci::Commit and Ci::Build to have all builds for same :sha on single page
This makes Ci::Commit to have only :sha and simplifies routing to have only :sha in path. The :ref and :push_data is now parameter of Ci::Build.
All commit related data (git author, message and .gitlab-ci.yml) is read directly from repository.
All code related for creating builds is moved to CreateBuildsService.
Status deduction is rewritten to make if more efficient and easier to integrate with Commit Status API.
This is partially working, tests are not yet touched.
This slightly changes view of Commit:
![Screen_Shot_2015-10-02_at_15.21.47](https://gitlab.com/gitlab-org/gitlab-ce/uploads/ad3f1ccdcc87659ea437d8db6c5b9f94/Screen_Shot_2015-10-02_at_15.21.47.png)
@dzaporozhets What do you think?
See merge request !1502
|
|
|
|
This benchmark suite uses benchmark-ips
(https://github.com/evanphx/benchmark-ips) behind the scenes. Specs can
be turned into benchmark specs by setting "benchmark" to "true" in the
top-level describe block like so:
describe SomeClass, benchmark: true do
end
Writing benchmarks can be done using custom RSpec matchers, for example:
describe MaruTheCat, benchmark: true do
describe '#jump_in_box' do
it 'should run 1000 iterations per second' do
maru = described_class.new
expect { maru.jump_in_box }.to iterate_per_second(1000)
end
end
end
By default the "iterate_per_second" expectation requires a standard
deviation under 30% (this is just an arbitrary default for now). You can
change this by chaining "with_maximum_stddev" on the expectation:
expect { maru.jump_in_box }.to iterate_per_second(1000)
.with_maximum_stddev(10)
This will change the expectation to require a maximum deviation of 10%.
Alternatively you can use the it block style to write specs:
describe MaruTheCat, benchmark: true do
describe '#jump_in_box' do
subject { -> { described_class.new } }
it { is_expected.to iterate_per_second(1000) }
end
end
Because "iterate_per_second" operates on a block, opposed to a static
value, the "subject" method must return a Proc. This looks a bit goofy
but I have been unable to find a nice way around this.
|
|
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
|
|
|
|
Also adds the ability to run rspecs with relative_url_defined on the enviornment. For example:
RELATIVE_URL_ROOT=/gitlab rspec
Closes #1728
|
|
These tools must be loaded before our regular Rails environment.
|
|
There were several specs that were failing when run by themselves.
- Use the `helper` object, as per RSpec 3 standards
- Use `assign` to assign instance variables that helpers expect
- Add `StubConfiguration` support module
|
|
Just for consistency with our Capybara, DatabaseCleaner, WebMock, etc.
setups.
|
|
This fixes spec/mailers/notify_spec
Also only require email_spec in the one place it's used
|
|
|