forked from bcgov/traction
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (70 loc) · 3.33 KB
/
deploy_tenant_ui.yaml
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
name: Deploy Tenant UI
on:
workflow_dispatch:
inputs:
deploy_env:
description: 'Target (github) environment for deployment: development, test, production'
required: true
default: 'development'
ref:
description: 'The branch, tag or SHA to checkout'
required: false
default: ''
traction_api_endpoint:
description: 'Traction API Endpoint'
required: true
default: 'https://traction-api-dev.apps.silver.devops.gov.bc.ca'
instance_name:
description: 'Instance name'
required: true
default: 'tenant-ui'
traction_name:
description: 'Traction instance name'
required: true
default: 'traction'
jobs:
build_image:
runs-on: ubuntu-20.04
if: github.repository_owner == 'bcgov'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Build service
uses: ./.github/actions/build_ui
id: builder
with:
ref: ${{ github.event.inputs.ref }}
context: './services/tenant-ui'
image_name: ${{ github.repository_owner}}/traction-tenant-ui
registry: ghcr.io
registry_username: ${{ github.repository_owner}}
registry_password: ${{ secrets.GITHUB_TOKEN }}
outputs:
image_tag: ${{ steps.builder.outputs.image_tag }}
image_version: ${{ steps.builder.outputs.image_version }}
buildtime: ${{ steps.builder.outputs.buildtime }}
deploy:
environment: ${{ github.event.inputs.deploy_env }}
runs-on: ubuntu-20.04
needs:
- build_image
if: ${{ always() && contains(needs.*.result, 'success') && !(contains(needs.*.result, 'failure')) && (github.repository_owner == 'bcgov') }}
steps:
- uses: actions/checkout@v2
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
certificate_authority_data: ${{ secrets.OPENSHIFT_CA_CRT }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
- name: Run Helm
run: |
yq eval '.global.fullnameOverride = "${{ github.event.inputs.instance_name }}"' -i ./charts/tenant-ui/values.yaml
yq eval '.global.tractionNameOverride = "${{ github.event.inputs.traction_name }}"' -i ./charts/tenant-ui/values.yaml
yq eval '.tenant_ui.traction_api.endpoint = "${{ github.event.inputs.traction_api_endpoint }}"' -i ./charts/tenant-ui/values-${{ github.event.inputs.deploy_env }}.yaml
yq eval '.tenant_ui.image.tag = "${{ needs.build_image.outputs.image_tag }}"' -i ./charts/tenant-ui/values-${{ github.event.inputs.deploy_env }}.yaml
yq eval '.tenant_ui.image.version = "${{ needs.build_image.outputs.image_version }}"' -i ./charts/tenant-ui/values-${{ github.event.inputs.deploy_env }}.yaml
yq eval '.tenant_ui.image.buildtime = "${{ needs.build_image.outputs.buildtime }}"' -i ./charts/tenant-ui/values-${{ github.event.inputs.deploy_env }}.yaml
helm upgrade -f ./charts/tenant-ui/values.yaml -f ./charts/tenant-ui/values-${{ github.event.inputs.deploy_env }}.yaml "${{ github.event.inputs.instance_name }}" ./charts/tenant-ui --install --wait