Skip to content

Add a tag to skip caching for a task #256

@ZXCroon

Description

@ZXCroon

There are cases where I want to avoid caching a task. This happens if this task is just a "debug" task, which I don't want ansible-bender to spend a lot of time doing caching for the task. And we don't want to cache it also because I want it to be executed for every run for debugging purpose. Another example is "set_fact" or any kinds of tasks that register a variable. I want to avoid caching for these tasks, because if it is cached and skipped, the variable will not be set which is wrong.

Note that this is different than no-cache or stop-layering, which will stop caching for all following tasks.

I think the implementation is easy (at least from my experiment). Just add a tag like SKIP_CACHE_TAG=skip-cache. And in snapshoter.py, add

if SKIP_CACHE_TAG in getattr(task, "tags", []):
    return

into both _maybe_load_from_cache and _snapshot functions. I can also create the MR. Just want to make sure you are ok with this enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXImprove user experienceenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions