Martin Klefas
03/05/2025, 11:32 AMGitHubRepository blocks on my server with things like:
from prefect_github import GitHubRepository
from prefect.blocks.system import Secret
# Load GitHub token from Prefect storage
github_token = Secret.load("github-token").get()
# Define GitHub storage blocks for each repo
ingestion_repo = GitHubRepository(
repository_url="my/repo/url.git",
reference="prefect-dev",
access_token=github_token
)
ingestion_repo.save("ingestion-repo-dev", overwrite=True)
and can see they've all been saved from the blocks ui.
I defined the flow repo within YAML though and uploaded that from the CLI:
deployments:
- name: cpu-flow
entrypoint: flow.py:cpu_workflow
work_pool:
name: cpu-process-pool
work_queue_name:
job_variables: {}
pull:
- prefect.deployments.steps.git_clone:
repository: my/flow/repo.git
branch: main
include_submodules: true
access_token: '{{ prefect.blocks.secret.github-token }}'
version:
tags: []
concurrency_limit:
description:
parameters: {}
schedules: []
So when I run a deployment, the worker seems to happily clone the flow. It then starts the task code:
@task(tags=["cpu"])
async def testSlide(slide: Slide):
ingestion_repo = await GitHubRepository.load("ingestion-repo-dev")
await ingestion_repo.get_directory()
from ingestionMain import slide_test
return await slide_test(slide)
and fails the clone here - asking me what credentials to use - when I already told it that in the block - the deployment knew about the credentials...
Is this a silly way to do it all? The docs all seem to use repos for flows, not tasks. I could migrate over to docker or something else?Nate
03/05/2025, 3:58 PMGitHubRepository in a setup script before you run prefect deploy and to refer to it in prefect.yaml, but why are you loading stuff from it again in the testSlide task? you should already have it on disk wherever your deployment is running right?Martin Klefas
03/05/2025, 6:46 PMNate
03/05/2025, 6:49 PMMartin Klefas
03/05/2025, 7:04 PM