-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (138 loc) · 5.28 KB
/
run-onboarding-service.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: OnBoarding_Service
on:
workflow_call:
issues:
types:
- labeled
jobs:
Tenant-Onboarding-Process:
if: github.event.label.name == 'Onboard New Tenant'
runs-on: ubuntu-latest
steps:
- name: View issue information
env:
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
echo "🎉 The job automatically triggered by a ${{ github.event_name }} event."
echo "Issue title: $ISSUE_TITLE"
echo "Issue No: ${{ github.event.issue.number }}"
echo "Issue body: $ISSUE_BODY"
- name: Creating new Temp sub dir 'service'
run: |
mkdir -m 777 service
cd service
pwd
ls -la
- name: Checkout /Fiserv/tenant-onboarding Repo at ${{ github.workspace }}/service
uses: actions/checkout@v3
with:
repository: Fiserv/tenant-onboarding
ref: develop
path: ${{ github.workspace }}/service
- name: List files in the repository
run: |
cd ${{ github.workspace }}
pwd
ls -la
cd ${{ github.workspace }}/service
pwd
ls -la
- run: echo "💡 The Fiserv/tenant-onboarding repository has been cloned on root"
- run: echo "🖥️ The workflow is now ready to run Onboarding service on the runner."
- name: List files in the repository
run: |
pwd
ls -la
- name: Running Tenant Generator.....
id: build
env:
GITHUB_AUTH_TOKEN: ${{ secrets.ZIP_GENERATOR_ACTION }}
STAGE_WEBHOOK_KEY: ${{ secrets.STAGE_WEBHOOK_KEY }}
PROD_WEBHOOK_KEY: ${{ secrets.PROD_WEBHOOK_KEY }}
run: |
pwd
cd ${{github.workspace}}/service/scripts
ls -la
npmv=$(npm --version)
echo "NPM version installed : " $npmv
nodev=$(node --version)
echo "Node version installed : " $nodev
npm install
echo " Repo: ${{ github.repository }}"
echo " Space: ${{ github.workspace }}"
result=$(node service.js ${{ github.event.issue.number }})
echo "********** TENANT CONFIGURATION *********************"
echo "$result"
if [[ $result == *'FAILED'* ]] ;then
echo "Onboarding config writer failed and exiting the Job..."
exit 1
else
echo "TENANT="$result >> $GITHUB_OUTPUT
echo "Onboarding config writer Ran Successfully....🍏"
cd ${{ github.workspace }}/service
tenant=$(./startup.sh -f '-rthde')
echo "tenant"
fi
- run: |
echo "🍏 This job's status is ${{ job.status }}."
pwd
cd ${{ github.workspace }}/service
pwd
ls -la
- name: Pushing tenant file to develop branch
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.ZIP_GENERATOR_ACTION }}
with:
source_file: '${{github.workspace}}/service/tenant.json'
destination_repo: 'Fiserv/${{steps.build.outputs.TENANT}}'
destination_folder: 'config'
destination_branch: 'develop'
user_email: 'supriya.nirmale@fiserv.com'
user_name: 'sfiserv'
commit_message: 'pushing tenant json file remotely'
- name: Pushing tenant file to stage branch
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.ZIP_GENERATOR_ACTION }}
with:
source_file: '${{github.workspace}}/service/tenant.json'
destination_repo: 'Fiserv/${{steps.build.outputs.TENANT}}'
destination_folder: 'config'
destination_branch: 'stage'
user_email: 'supriya.nirmale@fiserv.com'
user_name: 'sfiserv'
commit_message: 'pushing tenant json file remotely'
- name: Pushing tenant file to main branch
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.ZIP_GENERATOR_ACTION }}
with:
source_file: '${{github.workspace}}/service/tenant.json'
destination_repo: 'Fiserv/${{steps.build.outputs.TENANT}}'
destination_folder: 'config'
destination_branch: 'main'
user_email: 'supriya.nirmale@fiserv.com'
user_name: 'sfiserv'
commit_message: 'pushing tenant json file remotely'
- name: Pushing DbScript file remotely
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.ZIP_GENERATOR_ACTION }}
with:
source_file: '${{github.workspace}}/service/dbscripts/'
destination_repo: 'Fiserv/tenants-data'
destination_folder: 'dbscripts/${{steps.build.outputs.TENANT}}'
destination_branch: 'main'
user_email: 'supriya.nirmale@fiserv.com'
user_name: 'sfiserv'
commit_message: 'pushing DbScript file remotely'
- name: Applying Branch Protection.....
if: '!cancelled()'
env:
GITHUB_AUTH_TOKEN: ${{ secrets.ZIP_GENERATOR_ACTION }}
run: |
cd ${{ github.workspace }}/service
tenant=$(./startup.sh -f '-be')
echo "tenant"