Skip to content

Commit 53135ca

Browse files
committed
ci: add staging environment
1 parent 8b71285 commit 53135ca

File tree

6 files changed

+33
-25
lines changed

6 files changed

+33
-25
lines changed

.github/workflows/deploy-to-radix.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ on:
77
default: "test"
88
required: true
99
type: string
10+
image-tag:
11+
description: "Which image tag to deploy."
12+
required: true
13+
type: string
1014
workflow_call: # Workflow is meant to be called from another workflow
1115
inputs:
1216
radix-environment:
1317
description: "Which radix environment to deploy into"
1418
default: "test"
1519
required: true
1620
type: string
21+
image-tag:
22+
description: "Which image tag to deploy."
23+
required: true
24+
type: string
1725

1826
permissions:
1927
id-token: write
@@ -62,3 +70,5 @@ jobs:
6270
--from-config
6371
--token-environment
6472
--follow
73+
--image-tag-name api=${{ inputs.image-tag }}
74+
--image-tag-name proxy=${{ inputs.image-tag }}

.github/workflows/on-push-main-branch.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ jobs:
2828
uses: ./.github/workflows/publish-image.yaml
2929
with:
3030
image-tags: latest
31-
oauth-redirect-url: "https://proxy-template-fastapi-react-test.playground.radix.equinor.com/"
3231
# FIXME: DEMO CURRENTLY NOT DEPLOYED TO RADIX, comment back in to enable deployment to test environment
33-
# deploy-test:
32+
# deploy-dev:
3433
# needs: publish-latest
3534
# uses: ./.github/workflows/deploy-to-radix.yaml
3635
# with:
37-
# radix-environment: "test"
36+
# image-tag: "latest"
37+
# radix-environment: "dev"
3838

3939
release-please:
4040
needs: tests
4141
uses: ./.github/workflows/create-release-pr.yaml
4242

43-
publish-production:
43+
publish-staging:
4444
needs: release-please
4545
if: ${{ needs.release-please.outputs.release_created }}
4646
uses: ./.github/workflows/publish-image.yaml
4747
with:
48-
image-tags: production,${{ needs.release-please.outputs.tag_name }}
49-
oauth-redirect-url: "https://template-fastapi-react.app.playground.radix.equinor.com"
48+
image-tags: ${{ needs.release-please.outputs.tag_name }}
5049
# FIXME: DEMO CURRENTLY NOT DEPLOYED TO RADIX, comment back in to enable deployment to production environment
51-
# deploy-prod:
52-
# needs: publish-production
50+
# deploy-staging:
51+
# needs: [release-please, publish-staging]
5352
# uses: ./.github/workflows/deploy-to-radix.yaml
5453
# with:
55-
# radix-environment: "prod"
54+
# image-tag: ${{ needs.release-please.outputs.tag_name }}
55+
# radix-environment: "staging"

.github/workflows/publish-image.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77
description: "Which tag to give the images. Supports multiple tags if comma separated, ie 'tag1,tag2'"
88
required: true
99
type: string
10-
oauth-redirect-url:
11-
description: "Redirect url for oauth. Should be the public url to access the web app"
12-
default: "https://template-fastapi-react.app.playground.radix.equinor.com"
13-
required: true
14-
type: string
1510
secrets:
1611
CR_SECRET:
1712
description: "Secret to authenticate if using an other container registry than Github"
@@ -39,7 +34,6 @@ jobs:
3934
docker pull $NGINX_IMAGE
4035
printf "$(git log -n 1 --format=format:'hash: %h%ndate: %cs%nrefs: %d' --decorate=short --decorate-refs=refs/tags | sed 's/ (tag: \([^\s]*\))/\1/')" > ./web/public/version.txt
4136
docker build \
42-
--build-arg REDIRECT_URI=${{inputs.oauth-redirect-url}} \
4337
--build-arg AUTH_ENABLED=1 \
4438
--build-arg AUTH_SCOPE=api://4a761bec-628d-4c4b-860a-4903cbecc963/api \
4539
--build-arg CLIENT_ID=4a761bec-628d-4c4b-860a-4903cbecc963 \

radixconfig.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ metadata:
55
spec:
66
environments:
77
- name: prod
8+
- name: staging
89
build:
910
from: main
10-
- name: test
11+
- name: dev
1112
build:
1213
from: main
1314
components:
@@ -23,15 +24,20 @@ spec:
2324
cpu: "4000m"
2425
environmentConfig:
2526
- environment: prod
26-
imageTagName: production
27+
imageTagName: latest
2728
horizontalScaling:
2829
minReplicas: 1
2930
maxReplicas: 4
30-
- environment: test
31+
- environment: staging
3132
imageTagName: latest
3233
horizontalScaling:
3334
minReplicas: 1
3435
maxReplicas: 2
36+
- environment: dev
37+
imageTagName: latest
38+
horizontalScaling:
39+
minReplicas: 1
40+
maxReplicas: 1
3541
secrets:
3642
- SECRET_KEY
3743
- MONGODB_PASSWORD
@@ -58,11 +64,11 @@ spec:
5864
alwaysPullImageOnDeploy: true
5965
environmentConfig:
6066
- environment: prod
61-
imageTagName: production
62-
- environment: test
6367
imageTagName: latest
64-
variables:
65-
AUTH_ENABLED: "True"
68+
- environment: staging
69+
imageTagName: latest
70+
- environment: dev
71+
imageTagName: latest
6672
ports:
6773
- name: nginx
6874
port: 8080

web/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ USER 1000
3333

3434
FROM node:22 AS base
3535
ARG AUTH_ENABLED=0
36-
ARG REDIRECT_URI=http://localhost/
3736
# Azure AD requires a scope.
3837
ARG AUTH_SCOPE=""
3938
ARG CLIENT_ID=""
@@ -45,7 +44,6 @@ ENV VITE_AUTH_TENANT=$TENANT_ID
4544
ENV VITE_TOKEN_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/v2.0/token
4645
ENV VITE_AUTH_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/v2.0/authorize
4746
ENV VITE_LOGOUT_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/logout
48-
ENV VITE_AUTH_REDIRECT_URI=$REDIRECT_URI
4947

5048
WORKDIR /code
5149
COPY ./ ./

web/src/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const authConfig: TAuthConfig = {
55
authorizationEndpoint: import.meta.env.VITE_AUTH_ENDPOINT || '',
66
tokenEndpoint: import.meta.env.VITE_TOKEN_ENDPOINT || '',
77
scope: import.meta.env.VITE_AUTH_SCOPE || '',
8-
redirectUri: import.meta.env.VITE_AUTH_REDIRECT_URI || '',
8+
redirectUri: window.origin,
99
logoutEndpoint: import.meta.env.VITE_LOGOUT_ENDPOINT || '',
1010
autoLogin: false,
1111
preLogin: () =>

0 commit comments

Comments
 (0)