-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (35 loc) · 1.46 KB
/
demo.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
name: DEMO Route
on:
pull_request:
types: [labeled]
workflow_dispatch:
inputs:
target:
description: 'PR number to receive DEMO URL routing'
required: true
type: number
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
demo-routing:
name: DEMO Routing
if: ${{ github.event_name == 'workflow_dispatch' || github.event.label.name == 'demo' }}
env:
DEST: demo
DOMAIN: apps.silver.devops.gov.bc.ca
REPO: ${{ github.event.repository.name }}
runs-on: ubuntu-latest
steps:
- name: Point DEMO URL to Existing Service
run: |
# Set Up Routing
# OC Login
OC_TEMP_TOKEN=$(curl -k -X POST ${{ vars.oc_server }}/api/v1/namespaces/${{ secrets.oc_namespace }}/serviceaccounts/pipeline/token --header "Authorization: Bearer ${{ secrets.oc_token }}" -d '{"spec": {"expirationSeconds": 600}}' -H 'Content-Type: application/json; charset=utf-8' | jq -r '.status.token' )
oc login --token=$OC_TEMP_TOKEN --server=${{ vars.oc_server }}
oc project ${{ secrets.oc_namespace }} #Safeguard!
# Delete and replace route
oc delete route/${{ env.REPO }}-${{ env.DEST }} --ignore-not-found=true
oc create route edge ${{ env.REPO }}-${{ env.DEST }} \
--hostname=${{ env.REPO }}-${{ env.DEST }}.${{ env.DOMAIN }} \
--service=${{ env.REPO }}-${{ github.event.number || inputs.target }}-frontend