Commit graph

19 commits

Author SHA1 Message Date
Kamil Trzciński
0103d5be96 Add config_options|variables to BuildMetadata
These are data columns that store runtime configuration
of build needed to execute it on runner and within pipeline.

The definition of this data is that once used, and when no longer
needed (due to retry capability) they can be freely removed.

They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking
support for json datatype on old enough version).
2019-01-04 16:38:17 +01:00
Francisco Javier López
a6778fc647 Rename project's pipelines relation 2018-12-05 14:39:15 +00:00
Kamil Trzciński
15cd91c71a Make all legacy security reports to use raw format
- This introduces and uses `:raw` format for all legacy reports,
  the ones that do not have yet proper parsers on Backend
- Raw format is needed to make Frontend be able to parse reports,
  without the need of decompressing,
- This also extends fixtures to seed security reports with database,
  even though parser code is part of EE
2018-10-16 13:51:49 +02:00
Shinya Maeda
90becf966c Squashed commit of the following:
commit b4e71d4f5a1334a27c179d086bfea57c707de4ef
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 20:07:09 2018 +0900

    Add changelog

commit 50bc02ca6cfcf9c8d18d5c832a00c0f9f778d475
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 20:05:17 2018 +0900

    Fix fixture path

commit 15779300f98e00277db0e66fcfd865f603b45234
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:59:14 2018 +0900

    Revert leftovers

commit e26c0ce6b1fc490c1ad8c53fd8da5b95f8ef27ed
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:57:30 2018 +0900

    Revert quick actions

commit 9e257650ad8683c5628fd717fb21a8767bfca0fc
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:28:40 2018 +0900

    Add changelog

commit 473edcf4e60200c5ec9f6b92907d4badcf9c6a94
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:27:25 2018 +0900

    Fix specs

commit fa2d4f76235c8aa19de9712288f5c225c47ea5f0
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:20:21 2018 +0900

    Fix fixture

commit ee3df6595e4693c4ff11b8799aa15fc2078b7843
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 19:14:12 2018 +0900

    Clean up quick action scripts

commit 2398de2711f196c2a3fdedbd52b878489e7aa01e
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 18:15:21 2018 +0900

    Add quick action tasks

commit b0dbc47e2c29419133c1a24ed6922a68584a3e28
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Aug 8 15:33:24 2018 +0900

    Simplify fixtures

commit 693a95f2edb400a3db0e6e6f3021777f849f9400
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Aug 7 13:11:07 2018 +0900

    Support corrupted fixtures

commit d4e44eb329193cd68c964424f5343d3863802751
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 2 19:07:46 2018 +0900

    bring back debaggable fixtures

commit 466d3ffefac20d0f3eec350ea7231e0e403da90d
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 2 15:25:30 2018 +0900

    Revert "Decouple fixture seeds change"

    This reverts commit 30626cf8f5.
2018-08-08 20:08:40 +09:00
Kamil Trzcinski
871de0f185 Rename artifacts_* to legacy_artifacts_* 2017-12-03 12:04:49 +01:00
Lin Jen-Shin
4968f226a0 Make sure that environment was created before deploying 2017-06-02 21:34:31 +08:00
Kamil Trzcinski
161af17c1b Introduce source to pipeline entity 2017-05-31 14:17:49 +02:00
Kamil Trzciński
828d81ee1f Optimise trace handling code to use streaming instead of full read 2017-04-06 16:20:27 +00:00
Yorick Peterse
88e627cf14
Fix race conditions for AuthorizedProjectsWorker
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.
2017-01-25 13:22:15 +01:00
Kamil Trzcinski
c1928f4fce
Merge remote-tracking branch 'origin/master' into improve-pipeline-fixtures 2016-12-18 23:43:13 +01:00
twonegatives
0a5427d7c2 Made Ci::Builds to have same ref as Ci::Pipeline in dev fixtures 2016-12-15 19:03:59 +03:00
Kamil Trzcinski
1e62a13968 Improve pipeline fixtures 2016-11-28 16:55:31 +01:00
Kamil Trzcinski
6cdbb27ec3 Refactor code to use available and stopped statuses and refactor views to use separate renders 2016-10-17 12:45:31 +02:00
Kamil Trzcinski
0e1f39d8ce Allow to close environments 2016-10-06 14:16:03 +02:00
Grzegorz Bizon
ebeee31100 Fix pipeline fixtures and calls to removed method 2016-10-04 14:43:24 +02:00
Kamil Trzcinski
d392f147fc Group similar builds 2016-09-07 14:52:13 +02:00
Grzegorz Bizon
c15dc455f1 Move and improvement comment in pipeline fixtures 2016-08-19 14:43:02 +02:00
Grzegorz Bizon
7450fe7800 Change name of the class that with pipeline seeds 2016-08-18 16:31:06 +02:00
Grzegorz Bizon
c3ce005e66 Rename file that holds pipeline fixtures in dev env 2016-08-18 16:31:06 +02:00
Renamed from db/fixtures/development/14_builds.rb (Browse further)