-
Notifications
You must be signed in to change notification settings - Fork 6
137 lines (121 loc) · 6.15 KB
/
deploy.test.yml
File metadata and controls
137 lines (121 loc) · 6.15 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Deploy to Dev and Test Environments
#
# This workflow deploys Docker images to both dev and test environments.
# It's triggered automatically when build-edge.yml completes, or manually for custom deployments.
#
# When to use:
# - Automatically triggered after edge images are built (production pipeline)
# - Manually triggered to deploy specific image tags to dev/test
#
# What it does:
# - Deploys to dev environment first
# - Then deploys to test environment (if dev succeeds)
# - Validates image existence before deployment
# - Uses edge tag by default, or custom tag if specified
# - When triggered by build-edge, uses commit SHA so Azure actually pulls a new image
# - When manually triggered, uses provided tag or edge
name: Deploy to Dev and Test
on:
workflow_run:
workflows: ["Build and Push Edge Images"]
types:
- completed
workflow_dispatch:
inputs:
image_tag:
description: 'Image tag to deploy (defaults to edge)'
required: false
default: 'edge'
env:
app-name: carrot
repo-owner: health-informatics-uon
registry: ghcr.io
permissions:
contents: read
jobs:
deploy-to-dev:
runs-on: ubuntu-latest
environment: dev
env:
IMAGE_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.inputs.image_tag || 'edge' }}
steps:
# Check that images exist before deploying (only for manual dispatch with custom tags)
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
if: ${{ github.event.inputs.image_tag != '' && github.event.inputs.image_tag != 'edge' }}
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/backend
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
if: ${{ github.event.inputs.image_tag != '' && github.event.inputs.image_tag != 'edge' }}
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/frontend
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
if: ${{ github.event.inputs.image_tag != '' && github.event.inputs.image_tag != 'edge' }}
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
if: ${{ github.event.inputs.image_tag != '' && github.event.inputs.image_tag != 'edge' }}
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler
tag: ${{ github.event.inputs.image_tag }}
- name: Deploy Backend to Dev
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ env.IMAGE_TAG }}
- name: Deploy Frontend to Dev
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NEXT_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ env.IMAGE_TAG }}
- name: Deploy Airflow Webserver to Dev
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_WEBSERVER_NAME }}
publish-profile: ${{ secrets.AIRFLOW_WEBSERVER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ env.IMAGE_TAG }}
- name: Deploy Airflow Scheduler to Dev
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_SCHEDULER_NAME }}
publish-profile: ${{ secrets.AIRFLOW_SCHEDULER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ env.IMAGE_TAG }}
deploy-to-test:
runs-on: ubuntu-latest
environment: test
needs: [deploy-to-dev]
env:
IMAGE_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.inputs.image_tag || 'edge' }}
steps:
- name: Deploy Backend to Test
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ env.IMAGE_TAG }}
- name: Deploy Frontend to Test
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NEXT_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ env.IMAGE_TAG }}
- name: Deploy Airflow Webserver to Test
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_WEBSERVER_NAME }}
publish-profile: ${{ secrets.AIRFLOW_WEBSERVER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ env.IMAGE_TAG }}
- name: Deploy Airflow Scheduler to Test
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_SCHEDULER_NAME }}
publish-profile: ${{ secrets.AIRFLOW_SCHEDULER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ env.IMAGE_TAG }}