prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Unable to create a deployment with null pull steps

Open masonmenges opened this issue 9 months ago • 6 comments

Bug summary

Trying to create a deployment with null pull steps in a prefect yaml file results in a validation error, this doesn't seem to affect the build or push steps.

Error:

1 validation error for DeploymentUpdate
pull_steps.0
  Input should be a valid dictionary 
    For further information visit https://errors.pydantic.dev/2.10/v/dict_type

Version info

Version:             3.2.7
API version:         0.8.4
Python version:      3.12.4
Git commit:          d4d9001e
Built:               Fri, Feb 21, 2025 7:39 PM
OS/Arch:             darwin/arm64
Profile:             masonsandbox
Server type:         cloud
Pydantic version:    2.10.6
Integrations:
  prefect-dask:      0.3.2
  prefect-snowflake: 0.28.0
  prefect-slack:     0.3.0
  prefect-gcp:       0.6.2
  prefect-aws:       0.5.0
  prefect-gitlab:    0.3.1
  prefect-dbt:       0.6.4
  prefect-docker:    0.6.1
  prefect-sqlalchemy: 0.5.1
  prefect-shell:     0.3.1

Additional context

example yaml

build:
- prefect_docker.deployments.steps.build_docker_image:
    id: build_image
    requires: prefect-docker>=0.3.1
    image_name: IMAGENAME
    tag: TAG
    dockerfile: auto
    platform: linux/amd64

# push section allows you to manage if and how this project is uploaded to remote locations
push:
- prefect_docker.deployments.steps.push_docker_image:
    requires: prefect-docker>=0.3.1
    image_name: "{{ build_image.image_name }}"
    tag: "{{ build_image.tag }}"

# pull section allows you to provide instructions for cloning this project in remote locations
pull: null

masonmenges avatar Feb 27 '25 18:02 masonmenges

Assuming you are trying to set no pull steps, you can avoid this by setting pull: {}; we can probably update the DeploymentUpdate schema to account for this also.

cicdw avatar Feb 27 '25 18:02 cicdw

I did actually try with an empty dictionary and ran into the same issue, I ran through a few different attempts to get the deployment to create, It only worked for me if I passed "something" into the pull steps even just a dummy validation step like this

pull:
- prefect.deployments.steps.run_shell_script:
      id: test
      script: ls
      stream_output: True

pull: null and pull: {} both triggered the same validation error for me.

masonmenges avatar Feb 27 '25 19:02 masonmenges

oh sorry I meant pull: [] @masonmenges

cicdw avatar Feb 27 '25 20:02 cicdw

@masonmenges do you have any details on the use case to create a deployment with no pull steps? I would think that setting no pull steps on a deployment could cause issues down the line.

desertaxle avatar Feb 28 '25 15:02 desertaxle

It mostly comes up around users who are creating their own docker images with their flow code stored in it and setting their working directories on the image and/or users running a Process Worker, setting it a second time often causes issues with the entrypoints they have defined on their deployments.

They can do something like this in those contexts but it's ultimately redundant as they're already defined the working directory in the image or they're running the worker from the root directory they're executing their flows from already.

pull:
- prefect.deployments.steps.set_working_directory:
      directory: .

masonmenges avatar Feb 28 '25 16:02 masonmenges

confirmed you have to set the pull step to something "no op" like what @masonmenges mentioned. passing in pull: [] produces the error still

rcash avatar May 29 '25 23:05 rcash

How are you both creating deployments that produce this error? I can't reproduce and our code usually applies default pull steps.

cicdw avatar Jul 07 '25 02:07 cicdw