Class: Projects::UpdatePagesService
- Inherits:
-
BaseService
- Object
- BaseService
- Projects::UpdatePagesService
- Includes:
- Gitlab::InternalEventsTracking, Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/projects/update_pages_service.rb
Constant Summary collapse
- OLD_DEPLOYMENTS_DESTRUCTION_DELAY =
old deployment can be cached by pages daemon so we need to give pages daemon some time update cache 10 minutes is enough, but 30 feels safer
30.minutes
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#deployment_validations ⇒ Object
readonly
Returns the value of attribute deployment_validations.
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, build) ⇒ UpdatePagesService
constructor
A new instance of UpdatePagesService.
Methods included from Gitlab::InternalEventsTracking
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(project, build) ⇒ UpdatePagesService
Returns a new instance of UpdatePagesService.
15 16 17 18 19 |
# File 'app/services/projects/update_pages_service.rb', line 15 def initialize(project, build) @project = project @build = build @deployment_validations = ::Gitlab::Pages::DeploymentValidations.new(project, build) end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build.
13 14 15 |
# File 'app/services/projects/update_pages_service.rb', line 13 def build @build end |
#deployment_validations ⇒ Object (readonly)
Returns the value of attribute deployment_validations.
13 14 15 |
# File 'app/services/projects/update_pages_service.rb', line 13 def deployment_validations @deployment_validations end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/services/projects/update_pages_service.rb', line 21 def execute register_attempt ::Ci::Pipelines::AddJobService.new(@build.pipeline).execute!(commit_status) do |job| job.enqueue! job.run! end return error(deployment_validations.errors.first.) unless deployment_validations.valid? if ::Feature.enabled?(:ff_pages_use_open_file, project) handle_deployment_with_open_file else handle_deployment_with_file end rescue StandardError => e error(e.) raise e end |