Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-milan committed Nov 29, 2023
1 parent 0e488bc commit 809f988
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions pipelines/exemplo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from pipelines.exemplo.nome_do_objetivo.flows import * # noqa
from pipelines.exemplo.secrets.flows import * # noqa
Empty file.
21 changes: 21 additions & 0 deletions pipelines/exemplo/secrets/flows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from prefect import Flow, Parameter
from prefect.run_configs import KubernetesRun
from prefect.storage import GCS

from pipelines.constants import constants
from pipelines.exemplo.secrets.tasks import print_secret, read_secret

with Flow(
name="rj-escritorio: Nome do objetivo - Descrição detalhada do objetivo",
) as exemplo__secrets__print_flow:
# Parameters
secret_name = Parameter("secret_name", required=True)

# Tasks
secret_value = read_secret(secret_name=secret_name)
print_secret(secret=secret_value)

# Storage and run configs
exemplo__secrets__print_flow.storage = GCS(constants.GCS_FLOWS_BUCKET.value)
exemplo__secrets__print_flow.run_config = KubernetesRun(image=constants.DOCKER_IMAGE.value)
14 changes: 14 additions & 0 deletions pipelines/exemplo/secrets/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from prefect import task
from prefeitura_rio.pipelines_utils.infisical import get_secret
from prefeitura_rio.pipelines_utils.logging import log


@task
def read_secret(secret_name):
return get_secret(secret_name)


@task
def print_secret(secret):
log(secret)

0 comments on commit 809f988

Please sign in to comment.