Module: Helpers::JobHelper
- Defined in:
- app/lib/helpers/job_helper.rb
Class Method Summary collapse
-
.correct_feature?(job_invocation, feature) ⇒ Boolean
Returns true if the given feature is present in the job_invocation’s job_features, or if a matching RemoteExecutionFeature exists for the job_template.
Class Method Details
.correct_feature?(job_invocation, feature) ⇒ Boolean
Returns true if the given feature is present in the job_invocation’s job_features, or if a matching RemoteExecutionFeature exists for the job_template.
8 9 10 11 12 13 14 15 16 |
# File 'app/lib/helpers/job_helper.rb', line 8 def correct_feature?(job_invocation, feature) # check if the feature exists in the DB for the job_template template_id = job_invocation.pattern_template_invocations.first.template_id return true if RemoteExecutionFeature.exists?(job_template_id: template_id, label: feature) # Fallback: check if the feature is present in job_features job_features = Array(job_invocation.task&.input&.[]('job_features')) job_features.include?(feature) end |