Skip to content

Commit ed70562

Browse files
committed
fix: TT-418 serverless corrected and github files retored
1 parent 4e51c43 commit ed70562

File tree

3 files changed

+119
-16
lines changed

3 files changed

+119
-16
lines changed

.github/workflows/time-tracker-v1-on-pull-request-workflow.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Time Tacker V1 CI
1+
name: Time Tacker V1 CI - ON PR
22

33
on:
44
pull_request:
55
branches: [master]
66

77
jobs:
8-
time-tracker-ci:
8+
time-tracker-ci-v1-on-pr:
99
runs-on: ubuntu-latest
1010

1111
strategy:
@@ -26,7 +26,6 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install -r requirements/time_tracker_api/dev.txt
2828
pip install -r requirements/time_tracker_events/dev.txt
29-
3029
- name: Login to azure
3130
uses: Azure/login@v1
3231
with:
@@ -54,7 +53,6 @@ jobs:
5453
AZURE_STORAGE_ACCOUNT_KEY: ${{ steps.timeTrackerAzureVault.outputs.AZURE-STORAGE-ACCOUNT-KEY }}
5554
run: |
5655
pytest tests
57-
5856
- name: Test the build of the app
5957
run: |
60-
docker build .
58+
docker build .
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Time Tacker V1 CI - ON PUSH
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
time-tracker-ci-v1-on-push:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
python-version: [3.9]
14+
15+
steps:
16+
- name: Checking out code from the repository
17+
uses: actions/checkout@v2
18+
19+
- name: Setting up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements/time_tracker_api/dev.txt
28+
pip install -r requirements/time_tracker_events/dev.txt
29+
- name: Login to azure
30+
uses: Azure/login@v1
31+
with:
32+
creds: ${{ secrets.AZURE_CREDENTIALS }}
33+
34+
- name: Get vault from azure
35+
uses: Azure/get-keyvault-secrets@v1
36+
with:
37+
keyvault: "time-tracker-secrets"
38+
secrets: "MS-CLIENT-ID, MS-AUTHORITY, MS-SCOPE, MS-SECRET, MS-ENDPOINT, USERID, AZURE-APP-CONFIGURATION-CONNECTION-STRING, DATABASE-ACCOUNT-URI, DATABASE-MASTER-KEY, DATABASE-NAME, AZURE-STORAGE-ACCOUNT-KEY"
39+
id: timeTrackerAzureVault
40+
41+
- name: Run tests
42+
env:
43+
MS_AUTHORITY: ${{ steps.timeTrackerAzureVault.outputs.MS-AUTHORITY }}
44+
MS_CLIENT_ID: ${{ steps.timeTrackerAzureVault.outputs.MS-CLIENT-ID }}
45+
MS_SCOPE: ${{ steps.timeTrackerAzureVault.outputs.MS-SCOPE }}
46+
MS_SECRET: ${{ steps.timeTrackerAzureVault.outputs.MS-SECRET }}
47+
MS_ENDPOINT: ${{ steps.timeTrackerAzureVault.outputs.MS-ENDPOINT }}
48+
USERID: ${{ steps.timeTrackerAzureVault.outputs.USERID }}
49+
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ steps.timeTrackerAzureVault.outputs.AZURE-APP-CONFIGURATION-CONNECTION-STRING }}
50+
DATABASE_ACCOUNT_URI: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-ACCOUNT-URI }}
51+
DATABASE_MASTER_KEY: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-MASTER-KEY }}
52+
DATABASE_NAME: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-NAME }}
53+
AZURE_STORAGE_ACCOUNT_KEY: ${{ steps.timeTrackerAzureVault.outputs.AZURE-STORAGE-ACCOUNT-KEY }}
54+
run: |
55+
pytest tests
56+
- name: Login to docker registry
57+
uses: azure/docker-login@v1
58+
with:
59+
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
60+
username: ${{ secrets.REGISTRY_USERNAME }}
61+
password: ${{ secrets.REGISTRY_PASSWORD }}
62+
- name: Build and push image
63+
run: |
64+
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/timetrackerapi:${{ github.sha }}
65+
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/timetrackerapi:${{ github.sha }}

V2/serverless.yml

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ service: azure-time-tracker
22

33
frameworkVersion: "2"
44

5-
#region start Config
6-
75
provider:
86
name: azure
97
region: westus2
@@ -38,13 +36,11 @@ package:
3836
- "!.gitignore"
3937
- "!.git/**"
4038

41-
#endregion end Config
42-
4339
#region start Functions
4440

4541
functions:
4642

47-
#region start Activities
43+
#region Start Functions Activities
4844

4945
get_activities:
5046
handler: time_tracker/activities/interface.get_activities
@@ -86,9 +82,9 @@ functions:
8682
route: activities/
8783
authLevel: anonymous
8884

89-
#endregion end Activities
85+
#endregion End Functions Activities
9086

91-
#region start Time-Entries
87+
#region Start Functions Time-Entries
9288

9389
create_time_entry:
9490
handler: time_tracker/time_entries/interface.create_time_entry
@@ -130,9 +126,9 @@ functions:
130126
route: time-entries/{id}
131127
authLevel: anonymous
132128

133-
#endregion end Time-Entries
129+
#endregion End Functions Time-Entries
134130

135-
#region start Customer
131+
#region Start Functions Customers
136132

137133
create_customer:
138134
handler: time_tracker/customers/interface.create_customer
@@ -174,6 +170,50 @@ functions:
174170
route: customers/{id}
175171
authLevel: anonymous
176172

177-
#endregion end Customer
173+
#endregion End Functions Customers
174+
175+
#region Start Functions Projects
176+
177+
get_projects:
178+
handler: time_tracker/projects/interface.get_projects
179+
events:
180+
- http: true
181+
x-azure-settings:
182+
methods:
183+
- GET
184+
route: projects/{id:?}
185+
authLevel: anonymous
186+
187+
delete_project:
188+
handler: time_tracker/projects/interface.delete_project
189+
events:
190+
- http: true
191+
x-azure-settings:
192+
methods:
193+
- DELETE
194+
route: projects/{id}
195+
authLevel: anonymous
196+
197+
update_project:
198+
handler: time_tracker/projects/interface.update_project
199+
events:
200+
- http: true
201+
x-azure-settings:
202+
methods:
203+
- PUT
204+
route: projects/{id}
205+
authLevel: anonymous
206+
207+
create_project:
208+
handler: time_tracker/projects/interface.create_project
209+
events:
210+
- http: true
211+
x-azure-settings:
212+
methods:
213+
- POST
214+
route: projects/
215+
authLevel: anonymous
216+
217+
#endregion End Functions Projects
178218

179-
#endregion end Functions
219+
#endregion End Functions

0 commit comments

Comments
 (0)