Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic tasks to list flows or namespaces and to download/upload flows (ideally also across tenants) #2867

Open
anna-geller opened this issue Jan 15, 2024 · 1 comment
Labels
area/backend Needs backend code changes enhancement New feature or request

Comments

@anna-geller
Copy link
Member

anna-geller commented Jan 15, 2024

Problem

Some users want to extract some information from the kestra instance without interacting directly with the API, e.g. to:

  • fetch all flows
  • fetch all namespaces
  • download all flows, and all versions of specific flows.

Proposed Solution

We may provide dedicated core tasks for that:

  • ListFlows
  • ListNamespaces
  • DownloadFlows

Proposed syntax

ListNamespaces:

id: export_flows
namespace: dev

tasks:
  - id: list
    type: io.kestra.plugin.core.namespace.ListNamespaces 
    childNamespaces: true # true by default — whether to include flows from child namespaces
    # outputs a list of strings

ListFlows:

id: list_flows
namespace: dev

tasks:
  - id: list_flows
    type: io.kestra.plugin.core.namespace.ListFlows 
    namespace: dev # only fetched from the current namespace by default
    childNamespaces: true # true by default — whether to include flows from child namespaces
    # outputs a list of strings

DownloadFlows:

id: export_flows
namespace: dev

tasks:
  - id: export
    type: io.kestra.plugin.core.namespace.DownloadFlows 
    namespace: dev # only fetched from the current namespace by default
    childNamespaces: true # true by default — whether to include flows from child namespaces
    pastRevisions: false # false by default — whether to include past revisions of each flow
    # outputs ION with columns: namespace, flowId, revision, content. 1 row per flow

Workaround until then

id: export_flows
namespace: dev

tasks:
  - id: fetch_namespaces
    type: io.kestra.plugin.core.http.Request
    uri: http://host.docker.internal:28080/api/v1/flows/distinct-namespaces

  - id: for_each
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ outputs.fetch_namespaces.body }}"
    tasks:
      - id: get_zipfile
        type: io.kestra.plugin.core.http.Download
        uri: http://host.docker.internal:28080/api/v1/flows/export/by-query?namespace={{taskrun.value}}
        method: GET
        contentType: "application/json"

      - id: unzip
        type: io.kestra.plugin.compress.ArchiveDecompress
        algorithm: ZIP
        from: "{{ outputs.get_zipfile.get(taskrun.value).uri }}"
@anna-geller anna-geller added the enhancement New feature or request label Jan 15, 2024
@anna-geller anna-geller added this to the v0.18.0 milestone Jan 15, 2024
@anna-geller anna-geller changed the title Add a generic ExportFlows task Add a generic DownloadFlows task Jun 4, 2024
@anna-geller anna-geller changed the title Add a generic DownloadFlows task Add generic tasks to list flows or namespaces and to download flows Jun 20, 2024
@anna-geller anna-geller removed this from the v0.18.0 milestone Jul 23, 2024
@anna-geller anna-geller added area/backend Needs backend code changes kind/highlight One of the highlights of the upcoming release and removed kind/highlight One of the highlights of the upcoming release labels Aug 15, 2024
@anna-geller anna-geller changed the title Add generic tasks to list flows or namespaces and to download flows Add generic tasks to list flows or namespaces and to download/upload flows (ideally also across tenants) Aug 29, 2024
@anna-geller
Copy link
Member Author

FYI moved to 0.20 as there is only 1 week left before the release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant