Commit graph

24 commits

Author SHA1 Message Date
Nick Thomas
013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Mark Chao
961d43a97b Memorize project to avoid re-query
[skip ci]
2018-11-05 20:09:11 +08:00
Bob Van Landuyt
a6268d3023 Fix deploy tokens without expire_at crashes 2018-08-02 19:43:36 +02:00
Rémy Coutable
f20a40f4a1 Merge branch 'frozen-string-enable-app-models' into 'master'
Enable frozen string in app/models/*.rb

See merge request gitlab-org/gitlab-ce!20851
2018-08-02 09:11:52 +00:00
Lin Jen-Shin
b577faf785 Rename the module and add a simple test to check
if all methods are also presented in the user.
2018-07-27 17:52:45 +08:00
gfyoung
50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Lin Jen-Shin
e3aaa56c92 Introduce PolicyCheckable for checking policies 2018-07-25 21:06:27 +08:00
Mayra Cabrera
f2c46672ca Resolve "Deploy Tokens failed to clone LFS repository" 2018-07-23 09:23:08 +00:00
Mayra Cabrera
cdac54e2a2 Refactor deploy token methods on Ci::Build
Also include a class method for retriving the gitlab_deploy_token on
DeployTokens
2018-04-20 12:18:41 -05:00
Mayra Cabrera
0dd6d25c25 Rename special deploy token to make it more descriptive
Also:
- Includes more specs
- Improves a bit the documentation
2018-04-20 12:18:41 -05:00
Mayra Cabrera
0903456a07 Expose deploy token to CI/CD jobs as environment variable
- If a deploy token with a name 'gitlab-deploy-token' is exists for the
  project, CI_DEPLOY_USER and CI_DEPLOY_PASSWORD variables will be
expose
2018-04-20 12:18:41 -05:00
Yorick Peterse
6f292eaa69
Revert the addition of goldiloader
This reverts the addition of the "goldiloader" Gem and all use of it.
While this Gem is very promising it's causing a variety of problems on
GitLab.com due to it eager-loading too much data in places where we
don't expect/can handle this. At least for the time being this means we
have to go back to manually fixing N+1 query problems, but at least
those should not cause a negative impact on availability.
2018-04-18 15:51:39 +02:00
Mayra Cabrera
3e35f65394 Verify that deploy token has valid access when pulling container registry image 2018-04-10 07:31:30 +00:00
Sean McGivern
4ef3e3491e Add cop for has_many :through without disabled autoloading
Goldiloader is great, but has several issues with has_many :through relations:

* https://github.com/salsify/goldiloader/issues/12
* https://github.com/salsify/goldiloader/issues/14
* https://github.com/salsify/goldiloader/issues/18

Rather than try to figure out which applies in each case, we should just do the
drudge work of manually disabling autoloading for all relations of this type. We
can always use regular preloading for specific cases, but this way we avoid
generating invalid queries through Goldiloader's magic.
2018-04-09 12:47:04 +01:00
Mayra Cabrera
5bc58bac26 Handle limit for datetime attributes on MySQL
The TIMESTAMP data type is used for values that contain both date and
time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to
'2038-01-19 03:14:07' UTC.

A Forever lib class was included to handle future dates for PostgreSQL
and MySQL, also changes were made to DeployToken to enforce Forever.date

Also removes extra conditional from JwtController
2018-04-06 22:28:44 -05:00
Mayra Cabrera
18a1569319 Handles default expires_at date directly into DeployToken model 2018-04-06 21:20:17 -05:00
Mayra Cabrera
2991381630 Addresses database comments
- Adds a default on expires_at datetime
- Modifies deploy tokens views to handle default expires at value
- Use datetime_with_timezone where possible
- Remove unused scopes
2018-04-06 21:20:17 -05:00
Mayra Cabrera
c4f56a8802 Increase test suite around deploy tokens behavior
Also, fixes broken specs
2018-04-06 21:20:17 -05:00
Mayra Cabrera
8315861c9a Include ProjectDeployTokens
Also:
- Changes scopes from serializer to use boolean columns
- Fixes broken specs
2018-04-06 21:20:16 -05:00
Kamil Trzciński
72220a99d1 Support Deploy Tokens properly without hacking abilities 2018-04-06 21:20:16 -05:00
Mayra Cabrera
171b2625b1 Addreses backend review suggestions
- Remove extra method for authorize_admin_project
- Ensure project presence
- Rename 'read_repo' to 'read_repository' to be more verbose
2018-04-06 21:20:16 -05:00
Mayra Cabrera
345ac03b7a Address UX review
- Keep 'Deploy Section' open upon save, otherwise the token might get
  lost
- When an error appears, display the error inside the form and also keep
  the Deploy Section open
- Changue copy of revoke modal
2018-04-06 21:20:16 -05:00
Mayra Cabrera
370fc05da7 Implement 'read_repo' for DeployTokens
This will allow to download a repo using the token from the DeployToken
2018-04-06 21:20:16 -05:00
Mayra Cabrera
db18993f65 Create barebones for Deploytoken
Includes:
- Model, factories, create service and controller actions
- As usual, includes specs for everything
- Builds UI (copy from PAT)
- Add revoke action

Closes #31591
2018-04-06 21:20:16 -05:00