Gabriel Montañola
08/27/2021, 12:11 AMGithub Storage
.
I'm facing a problem when "developing" the flows. Since we're using Github Actions, flows are registered to a development
project when a Pull Request is opened (and updated). But Github Storage
will use main/master
as ref argument. This works fine for production, but won't do while I'm on a development branch.
The workaround I've found is to use a pattern like this:
• Github Actions Workflow with different steps for Push/Pull Request:
◦ Push to main: generate project folder and register the flow
▪︎ I use prefect register --project $project --path $path
to do this
◦ Pull Request: register the flow with disabled schedule in development
project
▪︎ I use the if __name__ = "__main__"
pattern in order to pass a dynamic GITHUB_HEAD_REF
to Github Storage ref argument.
It's working, but I'm thinking if there is way just use the prefect cli
for this and avoid writing boilerplate code.
The thread has some code snippets and more details!Gabriel Montañola
08/27/2021, 12:12 AMGabriel Montañola
08/27/2021, 12:15 AMWilson Bilkovich
08/27/2021, 12:17 AMGabriel Montañola
08/27/2021, 12:29 AMGabriel Montañola
08/27/2021, 12:30 AMdevelop
? The work is already pushed because I'm opening a Pull Request.Gabriel Montañola
08/27/2021, 12:31 AMprefect register --project "$project" --path "$file"
it will use the main
ref from Github Storage and:
• no flow will be found if its the first time (github api 404)
• i'll use the main (old) version of the flow
In the "production" execution of workflow (after the pull request merge) things will work just fine, because I want to use the main
ref in my Github Storage. The issue is just within a Pull Request development.Gabriel Montañola
08/27/2021, 12:40 AM