-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (136 loc) · 4.71 KB
/
dev.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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: 1. Build & Deploy to Dev
#Will automatically run on a push to main, but can also be run manually
on:
push:
branches: [ "main" ]
workflow_dispatch:
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
build-static:
runs-on: ubuntu-latest
name: Build & Push Docker Static Image
environment:
name: dev
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Static
id: build_image
uses: redhat-actions/buildah-build@v2.9
with:
context: .
layers: true
image: drivebc-static
tags: latest latest-dev ${{ github.sha }}
labels: |
app=drivebc
containerfiles: ./compose/frontend/StaticBuild
build-args: |
FONTAWESOME_PACKAGE_TOKEN=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
DEBUG_BUILD=true
- name: Push to Github Packages
uses: redhat-actions/push-to-registry@v2.7
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
build-backend:
runs-on: ubuntu-latest
name: Build & Push Docker Backend Image
environment: dev
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Backend
id: build_image
uses: redhat-actions/buildah-build@v2.9
with:
image: drivebc-django
tags: latest latest-dev ${{ github.sha }}
labels: |
app=drivebc
containerfiles: ./compose/backend/Dockerfile
build-args:
DEBUG_BUILD=true
- name: Push to Github Packages
uses: redhat-actions/push-to-registry@v2.7
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
build-image-caching:
runs-on: ubuntu-latest
name: Build & Push Docker Image-Caching Image
environment: dev
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Image Caching
id: build_image
uses: redhat-actions/buildah-build@v2.9
with:
image: drivebc-image-caching
tags: latest latest-dev ${{ github.sha }}
labels: |
app=drivebc
containerfiles: ./compose/caching/Dockerfile
- name: Push to Github Packages
uses: redhat-actions/push-to-registry@v2.7
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
build-redis:
runs-on: ubuntu-latest
name: Build & Push Docker Redis Image
environment: dev
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Redis
id: build_image
uses: redhat-actions/buildah-build@v2.9
with:
image: drivebc-redis
tags: latest latest-dev ${{ github.sha }}
labels: |
app=drivebc
containerfiles: ./compose/redis/Dockerfile
- name: Push to Github Packages
uses: redhat-actions/push-to-registry@v2.7
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
versionUpdate:
needs: [build-static, build-backend, build-redis, build-image-caching]
runs-on: ubuntu-latest
name: Deploy Latest Images
environment:
name: dev
url: https://dev-drivebc.apps.gold.devops.gov.bc.ca
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ env.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true
- name: Helm upgrade on OpenShift Environment
run: |
helm dependency update ./infrastructure/main
helm upgrade dev-drivebc -f ./infrastructure/main/values-dev.yaml ./infrastructure/main --set django.image.tag="${{ github.sha }}" --set image-caching.image.tag="${{ github.sha }}" --set redis.image.tag="${{ github.sha }}" --set static.image.tag="${{ github.sha }}" --set tasks.image.tag="${{ github.sha }}"