Skip to content

Multiple caches per build could raise an exception during feature flag rollback

The following discussion from !53410 (merged) should be addressed:

  • @shinya.maeda started a discussion:

    This attributes.delete(:cache)) can be Array of Hash if the feature flag was enabled at Gitlab::Ci::Pipeline::Chain::Config::Process step. Probably this cause exceptions on runtime, which you can observe in Sentry or users see that pipelines are not properly created.

    FYI, this is an opposite case of !53410 (comment 519237286).

    You'd want to remove the feature flag occurrences from this class in order to align the feature flag state with !53410 (diffs). i.e. we simply can

              def initialize
                  cache = Array.wrap(attributes.delete(:cache))
                  @cache = cache.map do |cache|
                    Seed::Build::Cache.new(pipeline, cache)
                  end
              end
    
              def cache_attributes
                strong_memoize(:cache_attributes) do
                    if @cache.empty?
                      {}
                    else
                      { options: { cache: @cache.map(&:attributes) } }
                    end
                end
              end