Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3dce16d
Set up CI with Azure Pipelines
GliciniaD Mar 1, 2026
a86aacc
Set up CI with Azure Pipelines
GliciniaD Mar 1, 2026
9b4a944
Update azure-pipelines.yml to save to artifact
GliciniaD Mar 1, 2026
a1ea7e2
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
04fa940
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
7dc05c6
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
d552604
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
a4f3336
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
00de496
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 1, 2026
ba371f4
Set up CI with Azure Pipelines
GliciniaD Mar 1, 2026
241c3f4
Update azure-pipelines-2.yml for Azure Pipelines
GliciniaD Mar 1, 2026
645e0fa
Update azure-pipelines-2.yml for Azure Pipelines
GliciniaD Mar 1, 2026
a6ac991
Set up CI with Azure Pipelines
GliciniaD Mar 1, 2026
ccb7bac
Set up CI with Azure Pipelines
GliciniaD Mar 1, 2026
6641de1
Update azure-pipelines-4.yml for Azure Pipelines
GliciniaD Mar 1, 2026
596869f
Update azure-pipelines-4.yml for Azure Pipelines
GliciniaD Mar 1, 2026
4b2667c
Update azure-pipelines-4.yml for Azure Pipelines
GliciniaD Mar 1, 2026
3f730e4
Set up CI with Azure Pipelines
GliciniaD Mar 7, 2026
b986c46
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 7, 2026
24f2ece
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 7, 2026
d030736
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
7dce120
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
7b88b87
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
7a06d3a
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
1ed6412
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
1b99d43
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
c441a94
Create app.py
GliciniaD Mar 8, 2026
be328f7
Update requirements.txt
GliciniaD Mar 8, 2026
e821e60
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
3905a4d
Update azure-pipelines.yml for Azure Pipelines
GliciniaD Mar 8, 2026
457e0d4
Update azure-pipelines-2.yml for Azure Pipelines
GliciniaD Mar 8, 2026
b084e01
Update azure-pipelines-5.yml for Azure Pipelines
GliciniaD Mar 8, 2026
c8bd291
Update azure-pipelines-4.yml for Azure Pipelines
GliciniaD Mar 8, 2026
d8ed07a
test to see if all pipelines run again
GliciniaD Mar 8, 2026
50b2d46
test 2
GliciniaD Mar 8, 2026
3a4d9ba
Create Create k8s.yaml
GliciniaD Mar 20, 2026
bd13f69
Update and rename Create k8s.yaml to k8s.yaml
GliciniaD Mar 20, 2026
7c5b86c
Rename azure-pipelines-2.yml to environments-play.yml
GliciniaD Mar 21, 2026
812f201
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
fc9af55
Rename azure-pipelines-3.yml to code-coverage-pay.yml
GliciniaD Mar 21, 2026
3a5e29c
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
5523948
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
cfeb1d4
Rename azure-pipelines-5.yml to web-app-creation-and-app-deployment.yml
GliciniaD Mar 21, 2026
7140630
Delete temporary2.yml
GliciniaD Mar 21, 2026
5ae1665
Delete azure-pipelines-1.yml
GliciniaD Mar 21, 2026
c21d184
Delete temporary3delete.yml
GliciniaD Mar 21, 2026
2f6b286
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
b870646
Rename azure-pipelines-4.yml to test-and-coverage-report.yml
GliciniaD Mar 21, 2026
bfc33a2
Delete code-coverage-pay.yml
GliciniaD Mar 21, 2026
20d8060
Delete todelete12.yml
GliciniaD Mar 21, 2026
ec8ef62
Rename azure-pipelines.yml to Artifact-to-ADO-feed.yml
GliciniaD Mar 21, 2026
fcf6fa0
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
6229ad7
Delete 123.yml
GliciniaD Mar 21, 2026
4ef4e36
Set up CI with Azure Pipelines
GliciniaD Mar 21, 2026
03ab1ac
Update Deploy-SQL.yml for Azure Pipelines
GliciniaD Mar 21, 2026
2823411
Update Deploy-SQL.yml for Azure Pipelines
GliciniaD Mar 21, 2026
23d19a5
Create schema.sql
GliciniaD Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Artifact-to-ADO-feed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

pool:
vmImage: 'ubuntu-latest'

variables:
feedName: 'Test-feed' # <-- Replace with your Azure Artifacts feed
packageName: 'flask-sample-app' # <-- Name for the universal package
packageVersion: '1.0.$(Build.BuildId)'

steps:

# 1️⃣ Checkout your GitHub repo
- checkout: self
displayName: 'Checkout repository'

# 2️⃣ Optional: Debug repo contents
- script: |
echo "Repo root: $(Build.SourcesDirectory)"
echo "Contents:"
ls -la $(Build.SourcesDirectory)
displayName: 'List repo root contents'

# 3️⃣ Ensure artifact staging directory exists
- script: mkdir -p $(Build.ArtifactStagingDirectory)
displayName: 'Ensure artifact staging directory exists'

# 4️⃣ Archive the entire repo into a zip
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)' # <-- This is the correct folder
includeRootFolder: false # <-- Include only contents
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/flask-app.zip'
replaceExistingArchive: true
displayName: 'Archive repository'

# 5️⃣ Publish the zip as a Universal Package
- task: UniversalPackages@0
inputs:
command: publish
publishDirectory: '$(Build.ArtifactStagingDirectory)'
feedsToUsePublish: 'internal'
vstsFeedPublish: 'DevOpsAZ400 Pratice (Agile one)/Test-Feed'
vstsFeedPackagePublish: '$(packageName)'
versionOption: 'custom'
versionPublish: '$(packageVersion)'
packagePublishDescription: 'Simple Flask sample app packaged as Universal Package'
displayName: 'Publish Universal Package'
73 changes: 73 additions & 0 deletions Deploy-SQL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
trigger:
- main

variables:
resourceGroup: my-sql-rg
location: uksouth
sqlServer: mysqlserver12345
sqlDatabase: mydatabase
adminUser: sqladmin
adminPassword: $(SQL_ADMIN_PASSWORD) # store in pipeline secrets

stages:
- stage: DeploySQL
jobs:
- job: Deploy
pool:
vmImage: ubuntu-latest

steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'SPN-Dev-01'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |

echo "Checking Resource Group..."
if az group exists --name $resourceGroup; then
echo "Resource Group already exists"
else
echo "Creating Resource Group..."
az group create --name $resourceGroup --location $location
fi

echo "Checking SQL Server..."
if az sql server show --name $sqlServer --resource-group $resourceGroup > /dev/null 2>&1; then
echo "SQL Server already exists"
else
echo "Creating SQL Server..."
az sql server create \
--name $sqlServer \
--resource-group $resourceGroup \
--location $location \
--admin-user $adminUser \
--admin-password $adminPassword
fi

echo "Checking SQL Database..."
if az sql db show --name $sqlDatabase --server $sqlServer --resource-group $resourceGroup > /dev/null 2>&1; then
echo "Database already exists"
else
echo "Creating Database..."
az sql db create \
--resource-group $resourceGroup \
--server $sqlServer \
--name $sqlDatabase \
--service-objective S0
fi

echo "Allow Azure services..."
az sql server firewall-rule create \
--resource-group $resourceGroup \
--server $sqlServer \
--name AllowAllAzureIPs \
--start-ip-address 0.0.0.0 \
--end-ip-address 0.0.0.0

echo "Running SQL script..."
sqlcmd -S ${sqlServer}.database.windows.net \
-d $sqlDatabase \
-U $adminUser \
-P $adminPassword \
-i schema.sql
7 changes: 7 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
return "Hello from Flask!If you can see this, the code has been deployed to your webapp. Test to see if all pipelines run again 2x"
19 changes: 19 additions & 0 deletions delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- main

pool:
vmImage: ubuntu-latest

steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'

- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
40 changes: 40 additions & 0 deletions environments-play.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

#trigger removed to avoid it all running and taking up microsoft agents

pool:
vmImage: ubuntu-latest

stages:
#Build Stage
- stage: Build
jobs:
- job: BuildJob
steps:
- script: echo "Hey there, this is the building stage!"
#Dev Environment
- stage: Dev
dependsOn: Build
jobs:
- deployment: DeployDev
environment: Dev
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying to Dev!"

#Prod Environment
- stage: Prod
dependsOn: Dev
jobs:
- deployment: DeployProd
environment: Prod
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying to Prod!"
32 changes: 32 additions & 0 deletions k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: flaskapp
spec:
replicas: 1
selector:
matchLabels:
app: flaskapp
template:
metadata:
labels:
app: flaskapp
spec:
containers:
- name: flaskapp
image: myacr12345gd.azurecr.io/flaskapp:v1
ports:
- containerPort: 5000

---
apiVersion: v1
kind: Service
metadata:
name: flaskapp-service
spec:
type: LoadBalancer
selector:
app: flaskapp
ports:
- port: 80
targetPort: 5000
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Flask
Flask==2.3.0
gunicorn==20.1.0
8 changes: 8 additions & 0 deletions schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE Users (
Id INT PRIMARY KEY,
Name NVARCHAR(100),
Email NVARCHAR(100)
);

INSERT INTO Users (Id, Name, Email)
VALUES (1, 'Test User', 'test@email.com');
36 changes: 36 additions & 0 deletions test-and-coverage-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

pool:
vmImage: ubuntu-latest

jobs:
- job: TestAndCoverage
displayName: 'Run Python Tests and collect Coverage'
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
# Install Python and the coverage checker
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'

- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
displayName: 'Install dependencies'

# Run tests and collect coverage
- script: |
pytest --cov=. --cov-report=xml
displayName: 'Run Tests and Coverage'

# Publish coverage results
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: 'coverage.xml'
displayName: 'Publish Code Coverage to ADO'
77 changes: 77 additions & 0 deletions web-app-creation-and-app-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Pipeline to create webapp, build, deploy, and reminder

pool:
vmImage: ubuntu-latest

stages:
# ===============================
# Stage 1: Create Web App
# ===============================
- stage: CreateWebApp
displayName: Create Web App on Azure
jobs:
- job: CreateApp
displayName: Create app via CLI
steps:
- task: AzureCLI@2
displayName: "Create Web App if not exists"
inputs:
azureSubscription: SPN-Dev-01
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
if az webapp show --name flaskappgmd28 --resource-group AZ400-play &>/dev/null; then
echo "Web app already exists, skipping creation"
else
az webapp create --resource-group AZ400-play --plan ASP-AzureAppIncidentProjectgroup-8d3f --name flaskappgmd28 --runtime "PYTHON:3.10"
fi

# ===============================
# Stage 2: Build Python App
# ===============================
- stage: BuildApp
displayName: 'Build Python Stage'
dependsOn: CreateWebApp
jobs:
- job: BuildAppOnDevops
displayName: 'Build App on DevOps'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
addToPath: true
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'

# ===============================
# Stage 3: Deploy App
# ===============================
- stage: DeployApp
displayName: 'Deploy App Stage'
dependsOn: BuildApp
jobs:
- job: DeployToAzure
displayName: 'Deploy Build App to Azure'
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: SPN-Dev-01
appType: webApp
appName: flaskappgmd28
package: '$(System.DefaultWorkingDirectory)'
startupCommand: 'gunicorn --bind 0.0.0.0:8000 app:app'

# ===============================
# Stage 4: Reminder
# ===============================
- stage: ReminderToDelete
displayName: 'Reminder to delete'
dependsOn: DeployApp
jobs:
- job: Reminder
displayName: 'Text reminder'
steps:
- script: |
echo "Delete or at least stop"