forked from bcgov/sbc-pay
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 3.58 KB
/
events-listener-cd.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
name: Events Listener Queue CD
on:
push:
branches:
- main
paths:
- "queue_services/events-listener/**"
- "pay-api/src/pay_api/models/**"
workflow_dispatch:
inputs:
environment:
description: "Environment (dev/test/prod)"
required: true
default: "dev"
defaults:
run:
shell: bash
working-directory: ./queue_services/events-listener
env:
APP_NAME: "events-listener"
TAG_NAME: "dev"
jobs:
events-listener-cd-by-push:
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.repository == 'bcgov/sbc-pay'
environment:
name: "dev"
steps:
- uses: actions/checkout@v3
- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}}
- name: CD Flow
shell: bash
env:
OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }}
OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }}
OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }}
OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }}
OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }}
TAG_NAME: ${{ env.TAG_NAME }}
run: |
make cd
- name: Watch new rollout (trigger by image change in Openshift)
shell: bash
run: |
oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w
- name: Rocket.Chat Notification
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master
if: failure()
with:
type: ${{ job.status }}
job_name: "*Events Listener Queue Built and Deployed to ${{env.TAG_NAME}}*"
channel: "#registries-bot"
url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
events-listener-cd-by-dispatch:
runs-on: ubuntu-20.04
if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/sbc-pay'
environment:
name: "${{ github.event.inputs.environment }}"
steps:
- uses: actions/checkout@v3
- name: Set env by input
run: |
echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV
- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}}
- name: CD Flow
shell: bash
env:
OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }}
OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }}
OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }}
OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }}
OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }}
TAG_NAME: ${{ env.TAG_NAME }}
run: |
make cd
- name: Watch new rollout (trigger by image change in Openshift)
shell: bash
run: |
oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w
- name: Rocket.Chat Notification
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master
if: failure()
with:
type: ${{ job.status }}
job_name: "*Events Listener Queue Built and Deployed to ${{env.TAG_NAME}}*"
channel: "#registries-bot"
url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}