Class: Shipit::UndeployedCommit
- Inherits:
-
Commit
- Object
- ActiveRecord::Base
- Record
- Commit
- Shipit::UndeployedCommit
show all
- Defined in:
- app/models/shipit/undeployed_commit.rb
Constant Summary
Constants inherited
from Commit
Commit::AmbiguousRevision, Commit::RECENT_COMMIT_THRESHOLD
DeferredTouch::CACHE_KEY, DeferredTouch::SET_KEY, DeferredTouch::THROTTLE_TTL, DeferredTouch::TMP_KEY
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Commit
#active?, #author, #author=, by_sha, by_sha!, #checks, #children, #committer, #committer=, create_from_github!, #create_or_update_check_run_from_github!, #create_release_status!, #create_status_from_github!, #deploy_failed?, #deploy_requested_at, #deployable?, #deployed?, detach!, #detach_children!, #fetch_stats!, from_github, #github_commit, #identify_merge_request, #last_release_status, #lock, lock_all, #lock_author, #lock_author=, #message=, #message_header, newer_than, older_than, #paginated_check_runs, #pull_request?, #pull_request_number, #pull_request_title, #recently_pushed?, #refresh_check_runs!, #refresh_statuses!, #reload, #revert?, #revert_of?, #schedule_continuous_delivery, #schedule_fetch_stats!, #schedule_refresh_check_runs!, #schedule_refresh_statuses!, #short_sha, since, #status, #statuses_and_check_runs, successful, #title, #unlock, until
touch_now!
Methods inherited from Record
serializer_class
Constructor Details
#initialize(commit, index:, next_expected_commit_to_deploy: nil) ⇒ UndeployedCommit
Returns a new instance of UndeployedCommit.
12
13
14
15
16
|
# File 'app/models/shipit/undeployed_commit.rb', line 12
def initialize(commit, index:, next_expected_commit_to_deploy: nil)
super(commit)
@index = index
@next_expected_commit_to_deploy = next_expected_commit_to_deploy
end
|
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
10
11
12
|
# File 'app/models/shipit/undeployed_commit.rb', line 10
def index
@index
end
|
Instance Method Details
#blocked? ⇒ Boolean
55
56
57
58
59
|
# File 'app/models/shipit/undeployed_commit.rb', line 55
def blocked?
return @blocked if defined?(@blocked)
@blocked = super
end
|
#deploy_disallowed? ⇒ Boolean
39
40
41
|
# File 'app/models/shipit/undeployed_commit.rb', line 39
def deploy_disallowed?
!deployable? || !stack.deployable?
end
|
#deploy_discouraged? ⇒ Boolean
43
44
45
|
# File 'app/models/shipit/undeployed_commit.rb', line 43
def deploy_discouraged?
stack.maximum_commits_per_deploy && index >= stack.maximum_commits_per_deploy
end
|
#deploy_state(bypass_safeties = false) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/models/shipit/undeployed_commit.rb', line 18
def deploy_state(bypass_safeties = false)
state = deployable? ? 'allowed' : status.state
unless bypass_safeties
if blocked?
state = 'blocked'
elsif locked?
state = 'locked'
elsif stack.active_task?
state = 'deploying'
end
end
state
end
|
#expected_to_be_deployed? ⇒ Boolean
47
48
49
50
51
52
53
|
# File 'app/models/shipit/undeployed_commit.rb', line 47
def expected_to_be_deployed?
return false if @next_expected_commit_to_deploy.nil?
return false unless stack.continuous_deployment
return false if active?
id <= @next_expected_commit_to_deploy.id
end
|
#redeploy_state(bypass_safeties = false) ⇒ Object
33
34
35
36
37
|
# File 'app/models/shipit/undeployed_commit.rb', line 33
def redeploy_state(bypass_safeties = false)
state = 'allowed'
state = 'deploying' if !bypass_safeties && stack.active_task?
state
end
|