Skip to content

Commit 3e084af

Browse files
Update content
1 parent 02dc4bf commit 3e084af

6 files changed

Lines changed: 90 additions & 69 deletions

File tree

.github/workflows/ci_cd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
uses: actions/checkout@v4
144144

145145
- name: Azure login
146-
uses: Azure/login@v1
146+
uses: Azure/login@v2
147147
with:
148148
creds: ${{ secrets.AZURE_CREDENTIALS }}
149149

.github/workflows/deploy_infra.yaml

Lines changed: 77 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,70 @@ jobs:
5656
compare_to_earlier_commit: true
5757
check_run_annotations: all tests, skipped tests
5858

59-
deploy-infrastructure:
60-
name: deploy-infrastructure
59+
deploy-development:
60+
name: deploy-development
6161
needs: psrule-scan
6262
runs-on: ubuntu-latest
63+
environment: development-infrastructure
64+
permissions:
65+
contents: read
66+
defaults:
67+
run:
68+
shell: bash
69+
working-directory: ${{ env.BICEP_DIR }}
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
74+
- name: Azure login
75+
uses: Azure/login@v2
76+
with:
77+
creds: ${{ secrets.AZURE_CREDENTIALS }}
78+
79+
- name: Lint template
80+
run: az bicep build --file main.bicep
81+
82+
- name: Validate template
83+
run: |
84+
az stack sub validate \
85+
--name "${{ vars.DEPLOYMENT_STACK_NAME }}" \
86+
--location "${{ vars.LOCATION }}" \
87+
--template-file main.bicep \
88+
--parameters @environments/development.bicepparam \
89+
--action-on-unmanage 'deleteAll' \
90+
--deny-settings-mode 'denyDelete'
91+
92+
- name: Deploy template
93+
run: |
94+
az stack sub create \
95+
--name "${{ vars.DEPLOYMENT_STACK_NAME }}" \
96+
--location "${{ vars.LOCATION }}" \
97+
--template-file main.bicep \
98+
--parameters @environments/development.bicepparam \
99+
--action-on-unmanage 'deleteAll' \
100+
--deny-settings-mode 'denyDelete' \
101+
--yes
102+
103+
# approve:
104+
# name: approve-promotion
105+
# needs: deploy-development
106+
# runs-on: ubuntu-latest
107+
# permissions:
108+
# issues: write
109+
# steps:
110+
# - name: Manual approval
111+
# uses: trstringer/manual-approval@v1.9.0
112+
# with:
113+
# approvers: christosgalano
114+
# minimum-approvals: 1
115+
# issue-title: "Approve promotion to production"
116+
# secret: ${{ secrets.GITHUB_TOKEN }}
117+
118+
deploy-production:
119+
name: deploy-production
120+
# needs: approve
121+
needs: deploy-development
122+
runs-on: ubuntu-latest
63123
environment: production-infrastructure
64124
permissions:
65125
contents: read
@@ -72,7 +132,7 @@ jobs:
72132
uses: actions/checkout@v4
73133

74134
- name: Azure login
75-
uses: Azure/login@v1
135+
uses: Azure/login@v2
76136
with:
77137
creds: ${{ secrets.AZURE_CREDENTIALS }}
78138

@@ -81,16 +141,21 @@ jobs:
81141

82142
- name: Validate template
83143
run: |
84-
az deployment sub validate \
85-
--name "${{ vars.DEPLOYMENT_NAME }}" \
86-
--location "${{ vars.LOCATION }}" \
87-
--template-file azure.deploy.bicep \
88-
--parameters azure.deploy.parameters.json
144+
az stack sub validate \
145+
--name "${{ vars.DEPLOYMENT_STACK_NAME }}" \
146+
--location "${{ vars.LOCATION }}" \
147+
--template-file main.bicep \
148+
--parameters @environments/production.bicepparam \
149+
--action-on-unmanage 'deleteAll' \
150+
--deny-settings-mode 'denyDelete'
89151
90152
- name: Deploy template
91153
run: |
92-
az deployment sub create \
93-
--name "${{ vars.DEPLOYMENT_NAME }}" \
154+
az stack sub create \
155+
--name "${{ vars.DEPLOYMENT_STACK_NAME }}" \
94156
--location "${{ vars.LOCATION }}" \
95-
--template-file azure.deploy.bicep \
96-
--parameters azure.deploy.parameters.json
157+
--template-file main.bicep \
158+
--parameters @environments/production.bicepparam \
159+
--action-on-unmanage 'deleteAll' \
160+
--deny-settings-mode 'denyDelete' \
161+
--yes

.github/workflows/destroy_infra.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ USER fastapi
1919

2020
EXPOSE 8000
2121

22-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
22+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

src/app/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ def get_hello_3(string_1: str, string_2: str, string_3: str):
3131
return f"Hello {string_1}, {string_2}, {string_3}"
3232

3333

34-
@app.get(
35-
"/{string_1}/{string_2}/{string_3}/{string_4}",
36-
response_model=str,
37-
status_code=status.HTTP_200_OK,
38-
)
39-
def get_hello_4(string_1: str, string_2: str, string_3: str, string_4: str):
40-
return f"Hello {string_1}, {string_2}, {string_3}, {string_4}"
34+
# @app.get(
35+
# "/{string_1}/{string_2}/{string_3}/{string_4}",
36+
# response_model=str,
37+
# status_code=status.HTTP_200_OK,
38+
# )
39+
# def get_hello_4(string_1: str, string_2: str, string_3: str, string_4: str):
40+
# return f"Hello {string_1}, {string_2}, {string_3}, {string_4}"
4141

4242

4343
if __name__ == "__main__":

src/tests/test_main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def test_get_hello_3():
2929
assert response.json() == "Hello devops, engineers, again"
3030

3131

32-
def test_get_hello_4():
33-
response = client.get(url="/devops/engineers/once/more")
34-
assert response.status_code == 200
35-
assert response.json() == "Hello devops, engineers, once, more"
32+
# def test_get_hello_4():
33+
# response = client.get(url="/devops/engineers/once/more")
34+
# assert response.status_code == 200
35+
# assert response.json() == "Hello devops, engineers, once, more"
3636

3737

3838
def test_not_found():

0 commit comments

Comments
 (0)