-
Notifications
You must be signed in to change notification settings - Fork 9
107 lines (104 loc) · 3.69 KB
/
getting-started.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: "All-in-one: GCP & Prefect Cloud - getting started"
on:
workflow_dispatch:
inputs:
region:
description: GCP region
required: true
default: 'us-east1'
type: string
zone:
description: Zone in the selected GCP region
required: true
default: 'us-east1-b'
type: string
artifact_repository:
description: Artifact Registry Repository
required: true
default: 'prefect'
type: string
image_name:
description: Artifact Container Name
required: true
default: 'deployments'
type: string
machine_type:
description: GCP Compute Engine instance type
required: true
default: 'e2-micro'
type: string
block_name:
description: 'GitHub and CloudRunJob block name'
required: false
default: "default"
type: string
gcp_creds_block_name:
description: 'Name of the GcpCredentials block'
required: false
default: "default"
type: string
deployment:
description: 'Prefect deployment name (could reference environment or branch name e.g. dev or prod)'
required: false
default: default
type: string
queue:
description: 'Prefect queue name'
required: false
default: default
type: string
jobs:
deploy-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: deploy-container
uses: ./.github/actions/deploy-container
with:
prefect_api_key: ${{ secrets.PREFECT_API_KEY }}
prefect_api_url: ${{ secrets.PREFECT_API_URL }}
artifact_repository: ${{ github.event.inputs.artifact_repository }} # optional
region: ${{ github.event.inputs.region }} # optional
gcp_credentials_json: ${{ secrets.GCP_CREDENTIALS }}
# gcp_sa_email: ${{ secrets.GCP_SA_EMAIL }}
zone: ${{ github.event.inputs.zone }} # optional
machine_type: ${{ github.event.inputs.machine_type }} # optional
- id: create-blocks
uses: ./.github/actions/blocks-quickstart
with:
prefect_api_key: ${{ secrets.PREFECT_API_KEY }}
prefect_api_url: ${{ secrets.PREFECT_API_URL }}
image_uri: ${{ env.IMAGE_URI }}
block_name: ${{ github.event.inputs.block_name }} # optional
region: ${{ github.event.inputs.region }} # optional
list-flows:
runs-on: ubuntu-latest
needs: deploy-container
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: echo "matrix=$(ls flows/*.py | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
deploy:
needs: list-flows
runs-on: ubuntu-latest
strategy:
matrix:
flows: ${{ fromJson(needs.list-flows.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- id: flow # example output: "flows/hello.py:hello"
run: |
export FLOW_NAME=$(basename ${{ matrix.flows }} .py)
echo "entrypoint=${{ matrix.flows }}:$FLOW_NAME" >> $GITHUB_OUTPUT
- id: deploy
uses: ./.github/actions/deploy-flows
with:
prefect_api_key: ${{ secrets.PREFECT_API_KEY }}
prefect_api_url: ${{ secrets.PREFECT_API_URL }}
flow_entrypoint: ${{ steps.flow.outputs.entrypoint }}
deployment: ${{ github.event.inputs.deployment }} # optional
queue: ${{ github.event.inputs.queue }} # optional
storage_block: github/${{ github.event.inputs.block_name }} # optional
infrastructure_block: cloud-run-job/${{ github.event.inputs.block_name }} # optional