Commit Graph
1400 Commits
Author SHA1 Message Date
Grzegorz Bizon ffee05c242 Improve invalid build artifacts metadata path matcher 2016-01-14 12:48:16 +01:00
Grzegorz Bizon 09a4a5aff8 Render only valid paths in artifacts metadata
In this version we will support only relative paths in artifacts
metadata. Support for absolute paths will be introduced later.
2016-01-14 12:48:16 +01:00
Grzegorz Bizon 61fb47a432 Simplify implementation of build artifacts browser (refactoring) 2016-01-14 12:48:15 +01:00
Grzegorz Bizon 387b27813d Change format of artifacts metadata from text to binary 0.0.1
This changes the format of metadata to handle paths, that may contain
whitespace characters, new line characters and non-UTF-8 characters.

Now those paths along with metadata in JSON format are stored as
length-prefixed strings (uint32 prefix).

Metadata file has a custom format:

1.   First string field is metadata version field (string)
2.   Second string field is metadata errors field (JSON strong)
3.   All subsequent fields is pair of path (string) and path metadata
     in JSON format.

Path's metadata contains all fields that where possible to extract from
ZIP archive like date of modification, CRC, compressed size,
uncompressed size and comment.
2016-01-14 12:48:15 +01:00
Grzegorz Bizon 1b1793c253 Show file size in artifacts browser using metadata 2016-01-14 12:48:15 +01:00
Grzegorz Bizon cd3b8bbd2f Add method that checks if path exists in StringPath 2016-01-14 12:48:15 +01:00
Grzegorz Bizon a5e1905d28 Render 404 when artifacts path is invalid 2016-01-14 12:48:15 +01:00
Grzegorz Bizon f948c00757 Do not depend on universe when checking parent in StringPath 2016-01-14 12:48:15 +01:00
Grzegorz Bizon a7f99b67a0 Extract artifacts metadata implementation to separate class 2016-01-14 12:48:15 +01:00
Grzegorz Bizon df41148662 Improve path sanitization in StringPath 2016-01-14 12:48:15 +01:00
Grzegorz Bizon a3191463b6 Add path sanitization to StringPath
[ci skip]
2016-01-14 12:48:15 +01:00
Grzegorz Bizon 3de8a4620a Parse artifacts metadata stored in JSON format 2016-01-14 12:48:15 +01:00
Grzegorz Bizon 447f56036e Use metadata stored in artifacats metadata file 2016-01-14 12:48:14 +01:00
Grzegorz Bizon c177784d5a Use short method call in StringPath instead block 2016-01-14 12:48:14 +01:00
Grzegorz Bizon 1cc26e0f0e Improve performance of StringPath 2016-01-14 12:48:13 +01:00
Grzegorz Bizon b19e958d86 Add support for parent directories in StringPath
This support is not completed though, as parent directory that is first
in collection returned by `directories!` is not iterable yet.
2016-01-14 12:48:13 +01:00
Grzegorz Bizon 37b2c5dd55 Add support for root path for StringPath 2016-01-14 12:48:13 +01:00
Grzegorz Bizon d382335dcd Add implementation of remaining methods in StringPath 2016-01-14 12:48:13 +01:00
Grzegorz Bizon 518b206287 Add parent iteration implementation to StringPath 2016-01-14 12:48:13 +01:00
Grzegorz Bizon 80a71576ba Use Gitlab::StringPath in CI build artifacts controller 2016-01-14 12:48:13 +01:00
Grzegorz Bizon 73d2c7a553 Add new methods to StringPath 2016-01-14 12:48:12 +01:00
Grzegorz Bizon f5d5308658 Add implementation of StringPath class
`StringPath` class is something similar to Ruby's `Pathname` class,
but does not involve any IO operations. `StringPath` objects require
passing string representation of path, and array of paths that
represents universe to constructor to be intantiated.
2016-01-14 12:48:12 +01:00
Douwe Maan 4d64a32c88 Merge branch 'feature/ldap-sync-edgecases' into 'master'
LDAP Sync blocked user edgecases

Allow GitLab admins to block otherwise valid GitLab LDAP users
(https://gitlab.com/gitlab-org/gitlab-ce/issues/3462)

Based on the discussion on the original issue, we are going to differentiate "normal" block operations to the ldap automatic ones in order to make some decisions when its one or the other.

Expected behavior:

- [x] "ldap_blocked" users respond to both `blocked?` and `ldap_blocked?`
- [x] "ldap_blocked" users can't be unblocked by the Admin UI
- [x] "ldap_blocked" users can't be unblocked by the API
- [x] Block operations that are originated from LDAP synchronization will flag user as "ldap_blocked"
- [x] Only "ldap_blocked" users will be automatically unblocked by LDAP synchronization
- [x] When LDAP identity is removed, we should convert `ldap_blocked` into `blocked`
 
Mockup for the Admin UI with both "ldap_blocked" and normal "blocked" users:
![image](/uploads/4f56fc17b73cb2c9e2a154a22e7ad291/image.png)

There will be another MR for the EE version.

See merge request !2242
2016-01-14 11:00:08 +00:00
Gabriel Mazetto dd6fc01ff8 fixed LDAP activation on login to use new ldap_blocked state 2016-01-14 03:31:27 -02:00
Yorick Peterse b7f49aa0f0 Merge branch 'configure-randomize-metrics-sample-interval' into 'master'
See merge request !2406
2016-01-13 14:54:45 +00:00
Douwe Maan c7d9e7806a Merge branch 'fix/reference_filter_uri_decode_error_for_master' into 'master'
Fix #9963 reference_filter "Encoding::CompatibilityError" bug with some complex URL;

https://github.com/gitlabhq/gitlabhq/pull/9964

@DouweM

See merge request !2383
2016-01-13 14:21:32 +00:00
Yorick Peterse 057eb824b5 Randomize metrics sample intervals
Sampling data at a fixed interval means we can potentially miss data
from events occurring between sampling intervals. For example, say we
sample data every 15 seconds but Unicorn workers get killed after 10
seconds. In this particular case it's possible to miss interesting data
as the sampler will never get to actually submitting data.

To work around this (at least for the most part) the sampling interval
is randomized as following:

1. Take the user specified sampling interval (15 seconds by default)
2. Divide it by 2 (referred to as "half" below)
3. Generate a range (using a step of 0.1) from -"half" to "half"
4. Every time the sampler goes to sleep we'll grab the user provided
   interval and add a randomly chosen "adjustment" to it while making
   sure we don't pick the same value twice in a row.

For a specified timeout of 15 this means the actual intervals can be
anywhere between 7.5 and 22.5, but never can the same interval be used
twice in a row.

The rationale behind this change is that on dev.gitlab.org I'm sometimes
seeing certain Gitlab::Git/Rugged objects being retained, but only for a
few minutes every 24 hours. Knowing the code of Gitlab and how much
memory it uses/leaks I suspect we're missing data due to workers getting
terminated before the sampler can write its data to InfluxDB.
2016-01-13 12:57:46 +01:00
Yorick Peterse 2367160015 Make the metrics sampler interval configurable 2016-01-13 12:29:48 +01:00
Yorick Peterse 83ad5fa5cb Merge branch 'remove-application-frames-from-views' into 'master'
See merge request !2392
2016-01-12 15:44:57 +00:00
Yorick Peterse 355c341fe7 Stop tracking call stacks for instrumented views
Where a vew is called from doesn't matter as much. We already know what
action they belong to and this is more than enough information. By
removing the file/line number from the list of tags we should also be
able to reduce the number of series stored in InfluxDB.
2016-01-12 15:41:22 +01:00
Yorick Peterse 5679ee0120 Track memory allocated during a transaction
This gives a very rough estimate of how much memory is allocated during
a transaction. This only works reliably when using a single-threaded
application server and a Ruby implementation with a GIL as otherwise
memory allocated by other threads might skew the statistics. Sadly
there's no way around this as Ruby doesn't provide a reliable way of
gathering accurate object sizes upon allocation on a per-thread basis.
2016-01-12 14:59:30 +01:00
Jason Lee 932a247f5f Use CGI.escape instead of URI.escape, because URI is obsoleted.
ref: https://github.com/ruby/ruby/commit/238b979f1789f95262a267d8df6239806f2859cc
2016-01-12 18:20:03 +08:00
Douwe Maan 49f51ff164 Merge branch 'optimize_ldap' into 'master'
Optimize LDAP and add a search timeout

Related to #4282 

This merge request arranges some things in `access.rb` to facilitate some optimizations in EE (to come later). It also adds a 10 second timeout to all LDAP searches so the entire worker is not blocked if some query doesn't return in a reasonable amount of time. This timeout is configurable per LDAP server.

See merge request !2267
2016-01-11 17:32:33 +00:00
Yorick Peterse 35b501f30a Tag all transaction metrics with an "action" tag
Without this it's impossible to find out what methods/views/queries are
executed by a certain controller or Sidekiq worker. While this will
increase the total number of series it should stay within reasonable
limits due to the amount of "actions" being small enough.
2016-01-11 16:51:01 +01:00
Drew Blessing 67aa0b8c4c Optimize LDAP and add a search timeout 2016-01-11 08:17:32 -06:00
Jeroen Nijhof 706255b926 Merge gitlab.com:gitlab-org/gitlab-ce 2016-01-11 09:32:35 +01:00
Robert Speicher af68897acd Merge branch 'api-project-upload' into 'master'
Add API project upload endpoint

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/4317

See merge request !2329
2016-01-08 20:29:43 +00:00
Gabriel Mazetto 47e4613f4a Code style fixes and some code simplified 2016-01-08 16:26:04 -02:00
Gabriel Mazetto d6dc088aff LDAP synchronization block/unblock new states 2016-01-08 16:26:04 -02:00
Stan Hu 7403df6ca7 Merge branch 'suppress-allow-failure-builds' into 'master'
Suppress e-mails on failed builds if allow_failure is set

Every time I push to GitLab, I get > 2 emails saying a spec failed when I don't care about the benchmarks and others that have `allow_failure` set to `true`.

@ayufan mentioned creating a summary e-mail to prevent getting one e-mail per build, but the latter might actually be desirable. For example, I do want to know if Rubocop errors fail right away.

See merge request !2178
2016-01-08 17:31:35 +00:00
Douwe Maan 0614793b38 DRY up upload and download services 2016-01-08 17:38:53 +01:00
Jeroen Nijhof e0436005af Merge gitlab.com:gitlab-org/gitlab-ce 2016-01-08 17:25:09 +01:00
Yorick Peterse ec4a4f0623 Merge branch 'current-settings-handle-missing-db' into 'master'
See merge request !2346
2016-01-08 14:09:58 +00:00
Yorick Peterse 8d7a968d6d Handle missing DBs in connect_to_db?
This ensures CurrentSettings#connect_to_db? returns "false" in the event
of a database not existing, instead of raising an error.
2016-01-08 14:31:39 +01:00
Jeroen Nijhof 2c37ae2f0a Merge gitlab.com:gitlab-org/gitlab-ce 2016-01-08 13:22:30 +01:00
Robert Speicher 90510f0037 Merge branch 'milestone-ref' into 'master'
Link to milestone in "Milestone changed" system note

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/4141

See merge request !2203
2016-01-07 19:22:43 +00:00
Stan Hu 69209612e1 Suppress e-mails on failed builds if allow_failure is set
Every time I push to GitLab, I get > 2 emails saying a spec failed when
I don't care about benchmarks and other specs that have `allow_failure` set to `true`.
2016-01-07 10:45:39 -08:00
Jeroen Nijhof 1695063d15 Merge gitlab.com:gitlab-org/gitlab-ce 2016-01-07 13:58:19 +01:00
Douwe Maan 706d7eb0b7 Satisfy Rubocp 2016-01-07 13:37:59 +01:00
Douwe Maan 1886d727f7 Add API project upload endpoint 2016-01-07 13:37:14 +01:00