In Prefect 2.0 CLI, is there a way when running `p...
# prefect-community
r
In Prefect 2.0 CLI, is there a way when running
prefect deployment ls
to get only the deployment’s ids without the fancy drawing of the table? (it makes it difficult to parse the output to use with
xargs
). Then another thing, I’ve noticed that when doing
prefect deployment apply
if the deployment already exists in the cloud, it doesn’t get updated. Is there a way to force the re-deployment of an existing one?
👍 1
a
what are you trying to do?
Is there a way to force the re-deployment of an existing one?
yes, that's exactly what this command does and the reason why it's called apply rather than create -- you can think about it the same way as kubectl apply
r
I’m building a CI/CD pipeline in GitHub, at every run of the pipeline I build the docker image for the runtime environment and then I want to apply all of my deployments. I have all the deployment yaml files in a folder
deployements
which allows me to do:
Copy code
ls deployments/*.yaml | xargs -I % poetry run prefect deployment apply %
but I’ve noticed that if a deployment exists in cloud, if I change the deployment file and do apply again it doesn’t get updated, so for that reason first I need to delete the deployments by doing
Copy code
poetry run prefect deployment ls | egrep ${GUID_REGEX} -o | xargs -I % poetry run prefect deployment delete --id %
so you see at the moment I need to parse the GUIDs from the fancy output table given by
ls
command, then pass them to
delete
command
in my first post there was a typo, I meant that
deployment apply
does NOT update a deployment if it already exists in cloud
t
Our deployments aren't updated either when we use "apply". What didn't update in our case was the manifest file and in there the
import_path
when we ran
prefect deployment apply our-deployment.yaml
a
ahh I see why this might be confusing - in the next releases this info from JSON will move into the YAML manifest so that there will be only one YAML manifest which will make things less confusing and easier to update
🙌 1