Core Plugins and tasks PurgeFiles

Core Plugins and tasks PurgeFiles

Certified

Purge Namespace files (and versions).

Deletes files from Namespace storage using a purge behavior (default keeps 1 latest version), optional file glob, and Namespace filters (namespaces list or namespacePattern). Child Namespaces are included by default.

Use to clean old asset versions at scale; behavior controls retention (keepAmount/before).

yaml
type: io.kestra.plugin.core.namespace.PurgeFiles

Purge old versions of namespace files for a namespace tree.

yaml
id: purge_namespace_files
namespace: system

tasks:
  - id: purge_files
    type: io.kestra.plugin.core.namespace.PurgeFiles
    namespaces:
      - company
    includeChildNamespaces: true
    filePattern: "**/*.sql"
    behavior:
      type: version
      before: "2025-01-01T00:00:00Z"
Properties

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Default{"type":"version","keepAmount":1}

Purge behavior

Defines how files are purged.

Definitions

File pattern, e.g. 'AI_*'

Delete only files whose path is matching the glob pattern.

Defaulttrue

Delete files from child namespaces

Defaults to true. This means that if you set namespaces to company, it will also delete files from company.team, company.data, etc.

Glob pattern for the namespaces to delete files from

If not set (e.g., AI_*), all namespaces will be considered. Can't be used with namespaces - use one or the other.

SubTypestring

List of namespaces to delete files from

If not set, all namespaces will be considered. Can't be used with namespacePattern - use one or the other.

The number of purged namespace file versions