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

pipeline de exemplo #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading