Skip to content

Commit c06c595

Browse files
committed
feature:DBC22-1560 Move to away from ImageStreams
1 parent 4a76b63 commit c06c595

File tree

93 files changed

+1746
-2731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1746
-2731
lines changed

.github/workflows/createTag.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 2a. Create Tag
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
type: string
8+
description: Tag Version (incl. prefix; e.g. v1.2.3)
9+
required: true
10+
message:
11+
type: string
12+
description: Tag Message (e.g. Story Number)
13+
required: true
14+
15+
jobs:
16+
tagging:
17+
if: startsWith(github.ref, 'refs/heads/') == true
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
permissions:
21+
contents: write
22+
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Create a tag
28+
run: |
29+
git config user.name "$GITHUB_ACTOR"
30+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
31+
git config commit.gpgsign false
32+
33+
git tag -a ${{ github.event.inputs.tag }} -m "${{ github.event.inputs.message }}"
34+
git push origin ${{ github.event.inputs.tag }}
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: 2. Create Tag & Build/Deploy to Test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
type: string
8+
description: Tag Version (incl. prefix; e.g. v1.2.3)
9+
required: true
10+
message:
11+
type: string
12+
description: Tag Message (e.g. Story Number)
13+
required: true
14+
15+
env:
16+
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
17+
REGISTRY_USER: ${{ github.actor }}
18+
REGISTRY_PASSWORD: ${{ github.token }}
19+
20+
jobs:
21+
tag:
22+
if: startsWith(github.ref, 'refs/heads/') == true
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 5
25+
permissions:
26+
contents: write
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Create Tag
32+
run: |
33+
git config user.name "$GITHUB_ACTOR"
34+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
35+
git config commit.gpgsign false
36+
37+
git tag -a ${{ github.event.inputs.tag }} -m "${{ github.event.inputs.message }}"
38+
git push origin ${{ github.event.inputs.tag }}
39+
40+
build-pre:
41+
needs: [tag]
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 1
44+
outputs:
45+
tag: ${{ steps.vars.outputs.tag }}
46+
47+
steps:
48+
- name: Remove v from version for the docker tag
49+
id: vars
50+
run: |
51+
vtag=${{ github.event.inputs.tag }}
52+
echo "tag=${vtag//v}" >> $GITHUB_OUTPUT
53+
54+
build-static:
55+
needs: [build-pre]
56+
runs-on: ubuntu-latest
57+
name: Build & Push Docker Static Image
58+
environment:
59+
name: test
60+
61+
steps:
62+
- name: Checkout Code
63+
uses: actions/checkout@v4
64+
with:
65+
ref: ${{ github.ref_name }}
66+
67+
- name: Build Static
68+
id: build_image
69+
uses: redhat-actions/buildah-build@v2.9
70+
with:
71+
context: .
72+
layers: true
73+
image: drivebc-static
74+
tags: latest latest-test ${{ github.sha }} ${{ needs.build-pre.outputs.tag }}
75+
labels: |
76+
app=drivebc
77+
containerfiles: ./compose/frontend/StaticBuild
78+
build-args: |
79+
DEBUG_BUILD=true
80+
81+
- name: Push to Github Packages
82+
uses: redhat-actions/push-to-registry@v2.7
83+
with:
84+
image: ${{ steps.build_image.outputs.image }}
85+
tags: ${{ steps.build_image.outputs.tags }}
86+
registry: ${{ env.IMAGE_REGISTRY }}
87+
username: ${{ env.REGISTRY_USER }}
88+
password: ${{ env.REGISTRY_PASSWORD }}
89+
90+
91+
build-backend:
92+
needs: [build-pre]
93+
runs-on: ubuntu-latest
94+
name: Build & Push Docker Backend Image
95+
environment: test
96+
97+
steps:
98+
- name: Checkout Code
99+
uses: actions/checkout@v4
100+
with:
101+
ref: ${{ github.ref_name }}
102+
103+
- name: Build Backend
104+
id: build_image
105+
uses: redhat-actions/buildah-build@v2.9
106+
with:
107+
image: drivebc-django
108+
tags: latest latest-test ${{ github.sha }} ${{ needs.build-pre.outputs.tag }}
109+
labels: |
110+
app=drivebc
111+
containerfiles: ./compose/backend/Dockerfile
112+
build-args:
113+
DEBUG_BUILD=true
114+
115+
- name: Push to Github Packages
116+
uses: redhat-actions/push-to-registry@v2.7
117+
with:
118+
image: ${{ steps.build_image.outputs.image }}
119+
tags: ${{ steps.build_image.outputs.tags }}
120+
registry: ${{ env.IMAGE_REGISTRY }}
121+
username: ${{ env.REGISTRY_USER }}
122+
password: ${{ env.REGISTRY_PASSWORD }}
123+
124+
125+
build-image-caching:
126+
needs: [build-pre]
127+
runs-on: ubuntu-latest
128+
name: Build & Push Docker Image-Caching Image
129+
environment: test
130+
131+
steps:
132+
- name: Checkout Code
133+
uses: actions/checkout@v4
134+
with:
135+
ref: ${{ github.ref_name }}
136+
137+
- name: Build Image Caching
138+
id: build_image
139+
uses: redhat-actions/buildah-build@v2.9
140+
with:
141+
image: drivebc-image-caching
142+
tags: latest latest-test ${{ github.sha }} ${{ needs.build-pre.outputs.tag }}
143+
labels: |
144+
app=drivebc
145+
containerfiles: ./compose/caching/Dockerfile
146+
147+
- name: Push to Github Packages
148+
uses: redhat-actions/push-to-registry@v2.7
149+
with:
150+
image: ${{ steps.build_image.outputs.image }}
151+
tags: ${{ steps.build_image.outputs.tags }}
152+
registry: ${{ env.IMAGE_REGISTRY }}
153+
username: ${{ env.REGISTRY_USER }}
154+
password: ${{ env.REGISTRY_PASSWORD }}
155+
156+
build-redis:
157+
needs: [build-pre]
158+
runs-on: ubuntu-latest
159+
name: Build & Push Docker Redis Image
160+
environment: test
161+
steps:
162+
- name: Checkout Code
163+
uses: actions/checkout@v4
164+
165+
- name: Build Redis
166+
id: build_image
167+
uses: redhat-actions/buildah-build@v2.9
168+
with:
169+
image: drivebc-redis
170+
tags: latest latest-test ${{ github.sha }} ${{ needs.build-pre.outputs.tag }}
171+
labels: |
172+
app=drivebc
173+
containerfiles: ./compose/redis/Dockerfile
174+
175+
- name: Push to Github Packages
176+
uses: redhat-actions/push-to-registry@v2.7
177+
with:
178+
image: ${{ steps.build_image.outputs.image }}
179+
tags: ${{ steps.build_image.outputs.tags }}
180+
registry: ${{ env.IMAGE_REGISTRY }}
181+
username: ${{ env.REGISTRY_USER }}
182+
password: ${{ env.REGISTRY_PASSWORD }}
183+
184+
185+
versionUpdate:
186+
needs: [build-static, build-backend, build-image-caching, build-redis]
187+
runs-on: ubuntu-latest
188+
name: Deploy Latest Images
189+
environment:
190+
name: test
191+
url: https://test-drivebc.apps.gold.devops.gov.bc.ca
192+
steps:
193+
- name: Checkout code
194+
uses: actions/checkout@v4
195+
with:
196+
ref: ${{ github.ref_name }}
197+
198+
- name: Authenticate and set context
199+
uses: redhat-actions/oc-login@v1
200+
with:
201+
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
202+
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
203+
namespace: ${{ env.OPENSHIFT_NAMESPACE }}
204+
insecure_skip_tls_verify: true
205+
206+
- name: Helm upgrade on OpenShift Environment
207+
run: |
208+
helm dependency update ./infrastructure/main
209+
helm upgrade test-drivebc -f ./infrastructure/main/values-test.yaml ./infrastructure/main --set django.image.tag="${{ needs.build-pre.outputs.tag }}" --set image-caching.image.tag="${{ needs.build-pre.outputs.tag }}" --set redis.image.tag="${{ needs.build-pre.outputs.tag }}" --set static.image.tag="${{ needs.build-pre.outputs.tag }}" --set tasks.image.tag="${{ needs.build-pre.outputs.tag }}"

0 commit comments

Comments
 (0)