Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prefect deploy action to use Prefect version 3 #54

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

housekeeping

directory: /
schedule:
interval: "monthly"
interval: monthly
8 changes: 8 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: default

rules:
comments:
min-spaces-from-content: 1
document-start: disable
line-length: disable
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

## Details

A Github Action to deploy one or more Prefect deployments with a [`prefect.yaml` file](https://docs.prefect.io/latest/guides/prefect-deploy/)). Note - all configuration must be defined in your `prefect.yaml` file, which will be inferred at run time. This means you **cannot** pass any additional CLI arguments. For example, your `prefect.yaml` should have the following configuration in place:
A Github Action to deploy one or more Prefect deployments with a [`prefect.yaml` file](https://docs.prefect.io/latest/guides/prefect-deploy/)). Note - all configuration must be defined in your `prefect.yaml` file, which will be inferred at run time. This means you **cannot** pass any additional CLI arguments. For example, your `prefect.yaml` should have the following configuration in place:
```yaml
deployments:
- name: Simple
description: null
entrypoint: examples/simple/flow.py:call_api
flow_name: null
description: A simple example
entrypoint: flow.py:call_api
parameters: {}
schedule: null
tags: []
version: null
schedule: {}
work_pool:
job_variables:
image: prefecthq/prefect:3-latest
name: simple-pool
```

Expand Down Expand Up @@ -60,13 +59,13 @@ jobs:
python-version: '3.10'

- name: Prefect Auth
uses: PrefectHQ/actions-prefect-auth@v1
uses: PrefectHQ/actions-prefect-auth@v2
with:
prefect-api-key: ${{ secrets.PREFECT_API_KEY }}
prefect-workspace: ${{ secrets.PREFECT_WORKSPACE }}

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy@v3
uses: PrefectHQ/actions-prefect-deploy@v4
with:
deployment-names: Simple
requirements-file-paths: ./examples/simple/requirements.txt
Expand All @@ -89,7 +88,7 @@ jobs:
- ...

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy@v3
uses: PrefectHQ/actions-prefect-deploy@v4
with:
deployment-names: Simple_Deployment_1,Simple_Deployment_2
requirements-file-paths: ./examples/multi-deployment/deployment-1/requirements.txt,./examples/multi-deployment/deployment-2/requirements.txt
Expand All @@ -112,7 +111,7 @@ jobs:
- ...

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy@v3
uses: PrefectHQ/actions-prefect-deploy@v4
with:
all-deployments: "true"
requirements-file-paths: ./examples/multi-deployment/deployment-1/requirements.txt,./examples/multi-deployment/deployment-2/requirements.txt
Expand Down Expand Up @@ -144,13 +143,13 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prefect Auth
uses: PrefectHQ/actions-prefect-auth@v1
uses: PrefectHQ/actions-prefect-auth@v2
with:
prefect-api-key: ${{ secrets.PREFECT_API_KEY }}
prefect-workspace: ${{ secrets.PREFECT_WORKSPACE }}

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy@v3
uses: PrefectHQ/actions-prefect-deploy@v4
with:
deployment-names: Docker
requirements-file-paths: ./examples/docker/requirements.txt
Expand Down Expand Up @@ -187,13 +186,13 @@ jobs:
python-version: '3.10'

- name: Prefect Auth
uses: PrefectHQ/actions-prefect-auth@v1
uses: PrefectHQ/actions-prefect-auth@v2
with:
prefect-api-key: ${{ secrets.PREFECT_API_KEY }}
prefect-workspace: ${{ secrets.PREFECT_WORKSPACE }}

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy@v3
uses: PrefectHQ/actions-prefect-deploy@v4
with:
deployment-names: Docker
requirements-file-paths: ./examples/docker/requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ runs:
PREFECT_SHORT_VERSION="$(cut -d "." -f 2 <<< "$PREFECT_VERSION")"."$(cut -d "." -f 3 <<< "$PREFECT_VERSION")"
if [ $(echo $PREFECT_SHORT_VERSION'<'10.14 | bc -l) -eq 1 ];
then
echo "The currently installed Prefect version (2.$PREFECT_SHORT_VERSION) will be updated to the latest to ensure compatibility with this action."
pip install prefect -U "prefect>=2.10.14,<3"
echo "The currently installed Prefect version (3.$PREFECT_SHORT_VERSION) will be updated to the latest to ensure compatibility with this action."
pip install prefect -U "prefect>=3,<4"
fi
if [ ${{ inputs.all-deployments }} == "true" ];
then
Expand Down
4 changes: 2 additions & 2 deletions examples/actions/install-deps-via-pyproject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
python-version: '3.10'

- name: Prefect Auth
uses: PrefectHQ/actions-prefect-auth@v1
uses: PrefectHQ/actions-prefect-auth@v2
with:
prefect-api-key: ${{ secrets.PREFECT_API_KEY }}
prefect-workspace: ${{ secrets.PREFECT_WORKSPACE }}

- name: Run Prefect Deploy
uses: PrefectHQ/actions-prefect-deploy
uses: PrefectHQ/actions-prefect-deploy@v4
with:
deployment-names: Simple
pyproject-toml-path: ./path/to/pyproject.toml
2 changes: 1 addition & 1 deletion examples/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 prefecthq/prefect:2-latest
FROM --platform=linux/amd64 prefecthq/prefect:3-latest

COPY ./examples/docker/requirements.txt requirements.txt
RUN pip install -r requirements.txt
2 changes: 0 additions & 2 deletions examples/docker/flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

import requests
from prefect import flow

Expand Down
24 changes: 7 additions & 17 deletions examples/docker/prefect.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
# File for configuring project / deployment build, push and pull steps

# Generic metadata about this project
name: docker
prefect-version: 2.11.0
prefect-version: 3.0.0

# build section allows you to manage and build docker images
build:
- prefect_docker.projects.steps.build_docker_image:
requires: prefect-docker>0.1.0
- prefect_docker.deployments.steps.build_docker_image:
requires: prefect-docker>0.6.0
image_name: EXAMPLE_IMAGE_REGISTRY
tag: latest
dockerfile: auto

# push section allows you to manage if
# and how this project is uploaded to remote locations
push: null

# pull section allows you to provide instructions
# for cloning this project in remote locations
pull:
- prefect.projects.steps.git_clone_project:
- prefect.deployments.steps.git_clone:
repository: [email protected]:PrefectHQ/actions-prefect-deploy.git
branch: main
access_token: "{{ prefect.blocks.secret.docker-github-pat }}"

deployments:
- name: Docker
description: null
description: An example Prefect deployment
entrypoint: ./flow.py:call_api
flow_name: null
parameters: {}
schedule: null
schedule: {}
work_pool:
job_variables:
image: prefecthq/prefect:2-latest
image: prefecthq/prefect:3-latest
name: docker-pool
work_queue_name: null
2 changes: 1 addition & 1 deletion examples/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
prefect==2.16.5
prefect==3.*
2 changes: 0 additions & 2 deletions examples/multi-deployment/deployment-1/flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

import requests
from prefect import flow

Expand Down
2 changes: 1 addition & 1 deletion examples/multi-deployment/deployment-1/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
prefect==2.16.5
prefect==3.*
2 changes: 0 additions & 2 deletions examples/multi-deployment/deployment-2/flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

import requests
from prefect import flow

Expand Down
2 changes: 1 addition & 1 deletion examples/multi-deployment/deployment-2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
prefect==2.16.5
prefect==3.*
34 changes: 10 additions & 24 deletions examples/multi-deployment/prefect.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,34 @@
# File for configuring project / deployment build, push and pull steps

# Generic metadata about this project
name: multi-deployment
prefect-version: 2.11.0
prefect-version: 3.0.0

# build section allows you to manage and build docker images
build: null

# push section allows you to manage if
# and how this project is uploaded to remote locations
push: null

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

pull:
- prefect.projects.steps.git_clone_project:
- prefect.deployments.steps.git_clone:
repository: [email protected]:PrefectHQ/actions-prefect-deploy.git
branch: main
access_token: "{{ prefect.blocks.secret.simple-github-pat }}"

deployments:
- name: Simple_Deployment_1
description: null
description: Example deployment 1
entrypoint: ./deployment-1/flow.py:call_api
flow_name: null
parameters: {}
schedule: null
tags: []
version: null
schedule: {}
work_pool:
job_variables:
image: prefecthq/prefect:2-latest
image: prefecthq/prefect:3-latest
name: simple-pool
work_queue_name: null

- name: Simple_Deployment_2
description: null
description: Example deployment 2
entrypoint: ./deployment-2/flow.py:call_api
flow_name: null
parameters: {}
schedule: null
tags: []
version: null
schedule: {}
work_pool:
job_variables:
image: prefecthq/prefect:2-latest
image: prefecthq/prefect:3-latest
name: simple-pool
work_queue_name: null
2 changes: 0 additions & 2 deletions examples/simple/flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

import requests
from prefect import flow

Expand Down
22 changes: 5 additions & 17 deletions examples/simple/prefect.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
# File for configuring project / deployment build, push and pull steps

# Generic metadata about this project
name: simple
prefect-version: 2.11.0
prefect-version: 3.0.0

# build section allows you to manage and build docker images
build: null

# push section allows you to manage if
# and how this project is uploaded to remote locations
push: null

# pull section allows you to provide instructions
# for cloning this project in remote locations
pull:
- prefect.projects.steps.git_clone_project:
- prefect.deployments.steps.git_clone:
repository: [email protected]:PrefectHQ/actions-prefect-deploy.git
branch: main
access_token: "{{ prefect.blocks.secret.simple-github-pat }}"

deployments:
- name: Simple
description: null
description: A simple example
entrypoint: flow.py:call_api
flow_name: null
parameters: {}
schedule: null
tags: []
version: null
schedule: {}
work_pool:
job_variables:
image: prefecthq/prefect:2-latest
image: prefecthq/prefect:3-latest
name: simple-pool
work_queue_name: null
2 changes: 1 addition & 1 deletion examples/simple/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
prefect==2.16.5
prefect==3.*