diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-20 10:05:16 -0500 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-20 12:18:41 -0500 |
commit | cdac54e2a2abe4b93bd5a96603b9d6d8745d277e (patch) | |
tree | 458a5b8eddfbe8cf3bde2771460eaefa7dd7ff07 /app/models/deploy_token.rb | |
parent | 800ee75aa5f65fc41f32c8d7f3519256cd37c645 (diff) | |
download | gitlab-ce-cdac54e2a2abe4b93bd5a96603b9d6d8745d277e.tar.gz |
Refactor deploy token methods on Ci::Build
Also include a class method for retriving the gitlab_deploy_token on
DeployTokens
Diffstat (limited to 'app/models/deploy_token.rb')
-rw-r--r-- | app/models/deploy_token.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/deploy_token.rb b/app/models/deploy_token.rb index 4e450d0bdc8..5082dc45368 100644 --- a/app/models/deploy_token.rb +++ b/app/models/deploy_token.rb @@ -18,6 +18,10 @@ class DeployToken < ActiveRecord::Base scope :active, -> { where("revoked = false AND expires_at >= NOW()") } + def self.gitlab_deploy_token + active.find_by(name: GITLAB_DEPLOY_TOKEN_NAME) + end + def revoke! update!(revoked: true) end |