Commit Graph

104 Commits

Author SHA1 Message Date
Kamil Trzcinski 31be74c74b
Return struct instead of multiple values 2017-01-25 14:23:47 +01:00
Kamil Trzcinski c46445af92
Fix specs 2017-01-25 10:49:36 +01:00
Kamil Trzcinski 3441b4f93b
Fix picking CI builds
The conflict happens when we try to update a build,
but fail to do so due to fact that we update the same build concurrently for two different runners.
2017-01-25 10:49:35 +01:00
Kamil Trzcinski b368447cf7
Remove unneeded code and fix offenses 2017-01-25 10:47:58 +01:00
Kamil Trzcinski b7f4553e3e
Backport changes introduced by https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1083 2017-01-20 12:25:53 +01:00
Kamil Trzcinski 8171a1932b
Merge remote-tracking branch 'origin/master' into 21698-redis-runner-last-build 2017-01-19 15:31:04 +01:00
Rémy Coutable c28b0a539d Don't instrument 405 Grape calls
Fixes #26051.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-09 10:02:52 +01:00
Lin Jen-Shin 8c9a4ed373 WIP: Add tests and make sure that headers are set
* We realized that headers were not set whenever we give 204
  because `render_api_error!` doesn't preserve the headers.

* We also realized that `update_runner_info` would be called in
  POST /builds/register every time therefore runner is updated
  every time, ticking the queue, making this last_update didn't
  work very well, and the test would be failing due to that.
2017-01-04 17:46:56 +08:00
Rémy Coutable 359718603e Ensure nil User-Agent doesn't break the CI API
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-21 11:46:16 +01:00
Lin Jen-Shin 18c9fc4224 Use a block to insert extra check for authenticate_build!
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091#note_20253762
2016-12-20 03:24:38 +08:00
Lin Jen-Shin ec003d9eb3 Prefer unless over if not
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/builds/7606797
2016-12-19 19:14:21 +08:00
Lin Jen-Shin 64d7772b6f Use a separate method to skip validation
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091#note_20222666
2016-12-19 18:43:06 +08:00
Kim "BKC" Carlbäcker 24f0a45b0f Do things in the correct order 2016-12-16 16:32:16 +01:00
Kim "BKC" Carlbäcker 811addf2d1 #NamingThings 2016-12-16 01:04:18 +01:00
Kim "BKC" Carlbäcker e179544342 Move redis-logic into Ci::Runner 2016-12-15 22:30:31 +01:00
Kim "BKC" Carlbäcker 771dd68cdf linting 2016-12-15 22:29:47 +01:00
Lin Jen-Shin e485b3f6ad Give forbidden if project for the build was deleted
Closes #25309
2016-12-15 00:28:55 +08:00
Kim "BKC" Carlbäcker aa224c13fc typo-o 2016-12-14 16:39:40 +01:00
Kim "BKC" Carlbäcker a6ab8a3409 Add BuildQueueWorker for injecting redis-keys 2016-12-14 16:06:50 +01:00
Kim "BKC" Carlbäcker afea2df151 First attempt 2016-12-14 14:35:43 +01:00
Tomasz Maczukin e3fb074022
Send credentials array with build data 2016-11-21 15:01:06 +01:00
Tomasz Maczukin 596bbf670c
Send registry_url with build data to GitLab Runner 2016-11-16 13:31:02 +01:00
Grzegorz Bizon 9a8e486307 Extract method that checks if ci runner needs update 2016-10-03 12:07:47 +02:00
Kamil Trzcinski 08e31875c2 Update runner version only when updating contacted_at 2016-10-03 12:07:47 +02:00
Kamil Trzcinski 967eb8fb55 Merge branch 'master' into per-build-token 2016-09-19 13:31:42 +02:00
Kamil Trzcinski 2cc9a785df Properly create deployment using all possible options 2016-09-19 10:07:12 +02:00
Kamil Trzcinski 548169cfb5 Fix most of specs 2016-09-15 15:40:53 +02:00
Kamil Trzcinski 50076ab974 Merge remote-tracking branch 'origin/master' into per-build-token
# Conflicts:
#	db/schema.rb
2016-09-15 13:19:53 +02:00
Tomasz Maczukin 940f900f1c
Change response for /ci/api/v1/builds/register.json from 404 to 204 2016-09-13 17:44:18 +02:00
Kamil Trzcinski 505dc808b3 Use a permissions of user to access all dependent projects from CI jobs (this also includes a container images, and in future LFS files) 2016-09-13 13:30:26 +02:00
Jacob Vosmaer (GitLab) b7e6da5a4b Merge branch 'gitlab-workhorse-safeties' into 'master'
Security and safety improvements for gitlab-workhorse integration

Companion to https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/60

- Use a custom content type when sending data to gitlab-workhorse
- Verify (using JWT and a shared secret on disk) that internal API requests came from gitlab-workhorse

This will allow us to build features in gitlab-workhorse that require
more trust, and protect us against programming mistakes in the future.

This is designed so that no action is required for installations from
source. For omnibus-gitlab we need to add code that manages the shared
secret.

See merge request !5907
2016-09-09 11:33:08 +00:00
Kamil Trzcinski 6a29ac7d1d Change update interval of runners when trying to preserve contacted_at 2016-09-07 13:58:55 +02:00
Jacob Vosmaer c87540ed46 Verify JWT messages from gitlab-workhorse 2016-09-05 15:05:31 +02:00
Stan Hu 170885edd6 Add Sentry logging to API calls
Closes #21043
2016-08-24 12:09:51 -07:00
Yorick Peterse d345591fc8
Tracking of custom events
GitLab Performance Monitoring is now able to track custom events not
directly related to application performance. These events include the
number of tags pushed, repositories created, builds registered, etc.

The use of these events is to get a better overview of how a GitLab
instance is used and how that may affect performance. For example, a
large number of Git pushes may have a negative impact on the underlying
storage engine.

Events are stored in the "events" measurement and are not prefixed with
"rails_" or "sidekiq_", this makes it easier to query events with the
same name triggered from different parts of the application. All events
being stored in the same measurement also makes it easier to downsample
data.

Currently the following events are tracked:

* Creating repositories
* Removing repositories
* Changing the default branch of a repository
* Pushing a new tag
* Removing an existing tag
* Pushing a commit (along with the branch being pushed to)
* Pushing a new branch
* Removing an existing branch
* Importing a repository (along with the URL we're importing)
* Forking a repository (along with the source/target path)
* CI builds registered (and when no build could be found)
* CI builds being updated
* Rails and Sidekiq exceptions

Fixes gitlab-org/gitlab-ce#13720
2016-08-17 10:04:04 +02:00
Lin Jen-Shin 9d8dca08e4 Use AR callbacks as suggested by:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4964#note_12744656
2016-06-29 17:44:39 +08:00
Lin Jen-Shin de54335958 Prefer Ci::Build#erase_artifacts! 2016-06-28 20:32:32 +08:00
Lin Jen-Shin 0a294698db Just save the size in total rather than individual files
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4964#note_12741046
2016-06-28 11:16:48 +00:00
Lin Jen-Shin fe0c59d2e6 Introduce ci_builds.artifacts_sizes as JSON:
We store the sizes as a hash from path to bytes like:

``` ruby
{'ci_artifacts.txt' => 27,
 'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif' =>
71759,
 'other_artifacts_0.1.2/doc_sample.txt' => 1314,
 'rails_sample.jpg' => 35255,
 'tests_encoding/utf8 test dir ✓/regular_file_2' => 7}
```

So that it's easier to access than reading gzip file again.
2016-06-28 18:14:21 +08:00
Lin Jen-Shin 5174d6c146 Merge remote-tracking branch 'upstream/master' into feature/runner-lock-on-project
* upstream/master: (337 commits)
  Update CHANGELOG for !4659
  Center the header logo for all Devise emails
  Add previews for all customized Devise emails
  Customize the Devise `unlock_instructions` email
  Customize the Devise `reset_password_instructions` email
  Customize the Devise `password_change` emails
  Use gitlab-git 10.2.0
  Use Git cached counters on project show page
  Fix indentation scss-lint errors
  Added title attribute to enties in tree view Closes #18353
  Banzai::Filter::ExternalLinkFilter use XPath
  Reduce queries in IssueReferenceFilter
  Use gitlab_git 10.1.4
  Fixed ordering in Project.find_with_namespace
  Fix images in emails
  Banzai::Filter::UploadLinkFilter use XPath
  Turn Group#owners into a has_many association
  Make project_id nullable
  CHANGELOG [ci skip]
  CHANGELOG [ci skip]
  ...
2016-06-17 19:52:55 +08:00
Lin Jen-Shin fd285f71d8 Merge branch 'master' into feature/runner-lock-on-project
* master: (147 commits)
  Update CHANGELOG
  Remove deprecated issues_tracker and issues_tracker_id from project
  Schema doesn’t reflect the changes of the last 3 migrations
  Revert CHANGELOG
  Also rename "find" in the specs
  Change to new Notes styleguide
  Add guide on changing a document's location
  Change logs.md location in README
  Move logs/logs.md to administration/logs.md
  Make "four phase test"
  Only show branches for revert / cherry-pick
  Instrument all Banzai::ReferenceParser classes
  Removed old comment from update_column_in_batches
  Update columns in batches until no rows are left
  Remove counters from Pipeline navigation
  Handle NULL migration errors in migration helpers
  Fix typo causing related branches to Error 500
  Improved SVG sanitizer specs to include smoke tests for clean.
  Refactored SVG sanitizer
  Added SVG sanitizer fix to the changelog
  ...
2016-06-14 23:05:26 +08:00
Kamil Trzcinski 421be01dab Improve design based on review 2016-06-13 11:09:19 +01:00
Kamil Trzcinski 86800bf51a Support expiration date in CI API when uploading artifacts 2016-06-13 11:03:30 +01:00
Kamil Trzcinski aea4041ce9 Allow to expire build artifacts 2016-06-13 11:01:19 +01:00
Kamil Trzcinski c43279a8d9 Fix expose of TriggerRequest 2016-06-10 13:58:33 +02:00
Kamil Trzcinski 4663ae064d Fix CI TriggerRequest entity 2016-06-09 17:57:07 +02:00
Lin Jen-Shin 781d35c191 Prefer attributes_for_keys so that it ignores nils
Also add a test for setting locked.
2016-06-09 16:00:24 +08:00
Lin Jen-Shin 1c302d566b WIP, try to add views for locked runners 2016-06-09 16:00:24 +08:00
Grzegorz Bizon bf9cc351c2 Add minor corrections related to config of runner 2016-05-19 22:01:53 +02:00
Grzegorz Bizon 0fd100d28d Improve setting default runner attrs when using API 2016-05-19 22:01:53 +02:00