|
1 |
| -name: CD |
| 1 | +name: Register flows (production) |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
|
17 | 17 | GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }}
|
18 | 18 | GKE_ZONE: ${{ secrets.GKE_ZONE }}
|
19 | 19 | IMAGE_NAME: ghcr.io/prefeitura-rio/prefect-flows
|
20 |
| - PREFECT__BACKEND: ${{ secrets.PREFECT__BACKEND }} |
21 |
| - PREFECT__SERVER__HOST: ${{ secrets.PREFECT__SERVER__HOST }} |
22 |
| - PREFECT__SERVER__PORT: ${{ secrets.PREFECT__SERVER__PORT }} |
| 20 | + PREFECT__BACKEND: cloud |
| 21 | + PREFECT__CLOUD__API: https://prefect.dados.rio/api |
| 22 | + PREFECT__CLOUD__PORT: 443 |
23 | 23 | PREFECT__SERVER__PROJECT: ${{ secrets.PREFECT__SERVER__PROJECT }}
|
| 24 | + PREFECT_AUTH_TOML: ${{ secrets.PREFECT_AUTH_TOML }} |
24 | 25 |
|
25 | 26 | jobs:
|
26 | 27 | build-container:
|
27 |
| - name: Build, publish and register |
| 28 | + name: Register flows (production) |
28 | 29 | runs-on: ubuntu-latest
|
29 | 30 | steps:
|
30 | 31 | - uses: actions/checkout@v2
|
@@ -53,30 +54,34 @@ jobs:
|
53 | 54 | run: |-
|
54 | 55 | pip install .
|
55 | 56 |
|
56 |
| - - name: Get GKE credentials |
57 |
| - uses: google-github-actions/[email protected] |
58 |
| - with: |
59 |
| - cluster_name: ${{ env.GKE_CLUSTER }} |
60 |
| - location: ${{ env.GKE_ZONE }} |
61 |
| - credentials: ${{ secrets.GCP_SA_KEY }} |
62 |
| - |
63 |
| - - name: Build and publish Prefect Agent image |
64 |
| - run: | |
65 |
| - docker build -t $IMAGE_NAME:$GITHUB_SHA . |
66 |
| - docker build -t $IMAGE_NAME:latest . |
67 |
| - echo $GH_PAT | docker login ghcr.io -u gabriel-milan --password-stdin |
68 |
| - docker push $IMAGE_NAME:$GITHUB_SHA |
69 |
| - docker push $IMAGE_NAME:latest |
70 |
| -
|
71 | 57 | - name: Install GDAL for osgeo deps
|
72 | 58 | run: |
|
73 |
| - curl -sSLo ./GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl https://sourceforge.net/projects/gdal-wheels-for-linux/files/GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl/download |
| 59 | + curl -sSLo ./GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl https://prefeitura-rio.github.io/storage/GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
74 | 60 | python -m pip install --no-cache-dir ./GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
|
75 | 61 |
|
76 |
| - - name: Forward port to Apollo |
| 62 | + - name: Get changed files for code tree analysis |
| 63 | + id: files |
| 64 | + |
| 65 | + |
| 66 | + - name: Perform code tree analysis |
| 67 | + id: code-tree-analysis |
| 68 | + continue-on-error: true |
| 69 | + run: | |
| 70 | + python .github/workflows/scripts/code_tree_analysis.py "${{ steps.files.outputs.all }}" --write-to-file |
| 71 | +
|
| 72 | + - name: Write auth.toml |
77 | 73 | run: |-
|
78 |
| - bash -c "kubectl port-forward -n prefect deploy/prefect-apollo 4200:4200 &" && sleep 5 |
| 74 | + mkdir -p $HOME/.prefect |
| 75 | + echo $PREFECT_AUTH_TOML | base64 --decode > $HOME/.prefect/auth.toml |
| 76 | +
|
| 77 | + - name: Wait for Docker image to be available |
| 78 | + |
| 79 | + with: |
| 80 | + ref: ${{ github.ref }} |
| 81 | + check-name: 'Build Docker image' |
| 82 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + verbose: true |
79 | 84 |
|
80 | 85 | - name: Register Prefect flows
|
81 | 86 | run: |-
|
82 |
| - python .github/workflows/scripts/register_flows.py --project $PREFECT__SERVER__PROJECT --path pipelines/ |
| 87 | + python .github/workflows/scripts/register_flows.py --project $PREFECT__SERVER__PROJECT --path pipelines/ --schedule --filter-affected-flows |
0 commit comments