Skip to content

Commit f41990a

Browse files
Update content
2 parents 3e084af + 230639d commit f41990a

6 files changed

Lines changed: 56 additions & 16 deletions

File tree

.github/workflows/ci_cd.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/checkout@v4
3232

3333
- name: Set up Python 3.10
34-
uses: actions/setup-python@v4
34+
uses: actions/setup-python@v5
3535
with:
3636
python-version: "3.10"
3737

@@ -67,7 +67,7 @@ jobs:
6767

6868
- name: Upload test and coverage results
6969
if: success() || failure()
70-
uses: actions/upload-artifact@v3
70+
uses: actions/upload-artifact@v4
7171
with:
7272
name: pytest-results
7373
path: |
@@ -115,15 +115,15 @@ jobs:
115115
uses: actions/checkout@v4
116116

117117
- name: Log in to the Container registry
118-
uses: docker/login-action@v2
118+
uses: docker/login-action@v3
119119
with:
120120
registry: ${{ env.REGISTRY }}
121121
username: ${{ github.repository_owner }}
122122
password: ${{ secrets.GITHUB_TOKEN }}
123123

124124
- name: Build and push Docker image
125125
id: build-push-image
126-
uses: docker/build-push-action@v4
126+
uses: docker/build-push-action@v6
127127
with:
128128
context: ${{ github.workspace }}/src
129129
push: true

.github/workflows/codeql.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
uses: actions/checkout@v4
3333

3434
- name: Initialize codeql
35-
uses: github/codeql-action/init@v2
35+
uses: github/codeql-action/init@v3
3636
with:
3737
languages: 'python'
3838

3939
- name: Perform codeql analysis
40-
uses: github/codeql-action/analyze@v2
40+
uses: github/codeql-action/analyze@v3
4141
with:
4242
category: "/language:python"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: destroy-infra
2+
run-name: ${{ github.workflow }}
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
deployment_name:
7+
description: "Specify deployment name. Must have an output named 'resource_groups' which is an array with the names of the resource groups' to be deleted."
8+
default: dwg-prod-deployment
9+
required: true
10+
type: string
11+
12+
concurrency:
13+
group: ${{ github.workflow }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
approve:
18+
name: approve-infra-teardown
19+
runs-on: ubuntu-latest
20+
permissions:
21+
issues: write
22+
steps:
23+
- name: Manual approval
24+
uses: trstringer/manual-approval@v1.9.1
25+
with:
26+
approvers: christosgalano
27+
minimum-approvals: 1
28+
issue-title: "Approve teardown of infrastructure regarding deployment ${{ inputs.deployment_name }}"
29+
secret: ${{ secrets.GITHUB_TOKEN }}
30+
destroy:
31+
name: destroy-infra
32+
needs: approve
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Azure login
36+
uses: Azure/login@v2
37+
with:
38+
creds: ${{ secrets.AZURE_CREDENTIALS }}
39+
40+
- name: Delete resource groups
41+
shell: pwsh
42+
run: |
43+
$resource_groups = az deployment sub show -n ${{ inputs.deployment_name }} --query properties.outputs.resource_groups.value | convertfrom-json
44+
$resource_groups | foreach -parallel { Write-Host "Deleting resource group $_ ..."; az group delete -n $_ -y }

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# DevOps with GitHub: FastAPI example
22

3-
[![ci-cd](https://github.com/christosgalano/devops-with-github-example/actions/workflows/ci_cd.yaml/badge.svg)](https://github.com/christosgalano/devops-with-github-example/actions/workflows/ci_cd.yaml)
4-
[![codeql](https://github.com/christosgalano/devops-with-github-example/actions/workflows/codeql.yaml/badge.svg)](https://github.com/christosgalano/devops-with-github-example/actions/workflows/codeql.yaml)
5-
[![deploy-infra](https://github.com/christosgalano/devops-with-github-example/actions/workflows/deploy_infra.yaml/badge.svg)](https://github.com/christosgalano/devops-with-github-example/actions/workflows/deploy_infra.yaml)
6-
73
## Overview
84

95
The purpose of this repository is to demonstrate how someone can leverage GitHub's numerous DevOps capabilities to streamline both application and infrastructure development and deployment processes.
106

11-
It consists of a FastAPI application, Bicep infrastructure as code (IaC), and GitHub workflows, collectively showcasing how to leverage different GitHub capabilities to simplify and automate the deployment process of an application to the cloud in a secure and reliable way. The application is deployed to Azure, but the same principles can be applied to any cloud provider or even on-premises infrastructure.
7+
It consists of a FastAPI application, Bicep infrastructure as code (IaC), and GitHub workflows, collectively showcasing how to leverage different GitHub capabilities to simplify and automate the deployment process of an application to the cloud securely and reliably. The application is deployed to Azure, but the same principles can be applied to any cloud provider or even on-premises infrastructure.
128

13-
The application is a simple API that returns the message "Hello " followed by each value provided in the path parameters, separated by commas.
9+
The simple API application returns the message "Hello " followed by each value provided in the path parameters, separated by commas.
1410

1511
For example, if the path parameter is "world", the API will return "Hello world", whereas if the path parameters are "world" and "universe", the API will return "Hello world, universe".
1612

src/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
fastapi>=0.93.0,<1.0.0
2-
uvicorn>=0.20.0,<0.25.0
2+
uvicorn>=0.20.0,<0.35.0

src/test-requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
httpx>=0.23.0,<0.30.0
2-
black>=22.10.0,<24.0.0
3-
pytest>=7.2.2,<8.0.0
4-
pytest-cov>=4.0.0,<4.5.0
2+
black>=22.10.0,<25.0.0
3+
pytest>=7.2.2,<9.0.0
4+
pytest-cov>=4.0.0,<6.1.0

0 commit comments

Comments
 (0)