Vera Zabeida
02/24/2023, 5:13 PMname: Ad Hoc Deployment
env:
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }}
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }}
on:
push:
branches:
- main
jobs:
ad-hoc-deployment:
name: Build and apply deployment
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python 3.11.1
uses: actions/setup-python@v4
with:
python-version: "3.11.1"
cache: "pip"
cache-dependency-path: "requirements*.txt"
- name: Install packages
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -r requirements.txt
- name: Build and apply deployment
run: |
prefect deployment build ./flows/pipeline.py:hello \
--name "Ad Hoc Deployment" \
--params '{"user_input": "github action"}' \
--version $GITHUB_SHA \
--tag ad-hoc-gh \
--work-queue github \
--apply
In the video they set up a --storage-block
and use github as a storage block, and use that on the prefect deployment build command, but I'm wondering why that'd be needed. In the step above, we're checking out the repo so for me that would mean that we have all of the code already in this job, so no github storage is needed?
I've had one build that succeeded with this setup, but I didn't see any deployments in the UI, double checked my env vars, and since then getting this error message that isn't very helpful, here's the repo where you can see it:
prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '***/flows/'
Response: {'detail': 'Not Found'}
I'm just trying to get a minimal setup going, and understand what's needed and not needed for that. TIA for any pointers!Vera Zabeida
02/25/2023, 2:20 PMprefect deployment build
is to build your deployment, and autogenerate the path to your flow code, based on the environment in which the command is run. So if your command is run in a github workflow, and you didn't pass in a --path argument that overrides the default behavior, the autogenerated path will be that of your github workflow environment
so the build and the apply step will work just fine without a github storage block, but then when your agent goes and tries to run your deployment, it will have issues at the fetching code step, as the path specified in your build will be that of your github workflow action environment, and the agent will have no way to reach that without you specifying a github storage block
leaving that here, in case someone else finds it useful