Skip to content

Commit 45ffbfb

Browse files
authored
Merge pull request #108 from NHSDigital/DTOSS-9251-audit-functionality-1
DTOSS-9251 preparatory refactoring
2 parents 15a6db2 + 7eddf49 commit 45ffbfb

39 files changed

Lines changed: 84 additions & 76 deletions

.azuredevops/pipelines/deploy.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,48 @@ trigger: none
22
pr: none
33

44
parameters:
5-
- name: commitSHA
6-
displayName: Commit SHA
7-
type: string
8-
- name: environments
9-
type: object
10-
default:
11-
- dev
5+
- name: commitSHA
6+
displayName: Commit SHA
7+
type: string
8+
- name: environments
9+
type: object
10+
default:
11+
- dev
1212

1313
stages:
14-
- ${{ each env in parameters.environments }}:
15-
- stage: ${{ env }}
16-
displayName: Deploy to ${{ env }} environment
17-
pool:
18-
name: private-pool-dev-uks
19-
lockBehavior: sequential
20-
isSkippable: false
14+
- ${{ each env in parameters.environments }}:
15+
- stage: ${{ env }}
16+
displayName: Deploy to ${{ env }} environment
17+
pool:
18+
name: private-pool-dev-uks
19+
lockBehavior: sequential
20+
isSkippable: false
2121

22-
jobs:
23-
- deployment: DeployApp
24-
displayName: Deploy application
25-
environment: ${{ env }}
26-
strategy:
27-
runOnce:
28-
deploy:
29-
steps:
30-
- checkout: self
22+
jobs:
23+
- deployment: DeployApp
24+
displayName: Deploy application
25+
environment: ${{ env }}
26+
strategy:
27+
runOnce:
28+
deploy:
29+
steps:
30+
- checkout: self
3131

32-
- task: TerraformInstaller@1
33-
displayName: Install Terraform
34-
inputs:
35-
terraformVersion: 1.7.0
32+
- task: TerraformInstaller@1
33+
displayName: Install Terraform
34+
inputs:
35+
terraformVersion: 1.7.0
3636

37-
- task: AzureCLI@2
38-
name: RunTerraform
39-
inputs:
40-
azureSubscription: manbrs-${{ env }}
41-
scriptType: bash
42-
scriptLocation: inlineScript
43-
addSpnToEnvironment: true
44-
inlineScript: |
45-
export ARM_TENANT_ID="$tenantId"
46-
export ARM_CLIENT_ID="$servicePrincipalId"
47-
export ARM_OIDC_TOKEN="$idToken"
48-
export ARM_USE_OIDC=true
49-
make ci ${{ env }} terraform-apply DOCKER_IMAGE_TAG=git-sha-${{ parameters.commitSHA }}
37+
- task: AzureCLI@2
38+
name: RunTerraform
39+
inputs:
40+
azureSubscription: manbrs-${{ env }}
41+
scriptType: bash
42+
scriptLocation: inlineScript
43+
addSpnToEnvironment: true
44+
inlineScript: |
45+
export ARM_TENANT_ID="$tenantId"
46+
export ARM_CLIENT_ID="$servicePrincipalId"
47+
export ARM_OIDC_TOKEN="$idToken"
48+
export ARM_USE_OIDC=true
49+
make ci ${{ env }} terraform-apply DOCKER_IMAGE_TAG=git-sha-${{ parameters.commitSHA }}

.github/pull_request_template.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<!-- Prefix the PR title with the Jira issue number in square brackets (eg - [DTOSS-XXXX]), if applicable -->
22

33
## Description
4-
<!-- Add screenshots if there are any UI updates. -->
54

5+
<!-- Add screenshots if there are any UI updates. -->
66

77
## Jira link
88

9-
109
## Review notes
11-
<!-- Add notable context, discussion items, and anything else that would be helpful for a reviewer to know. -->
1210

11+
<!-- Add notable context, discussion items, and anything else that would be helpful for a reviewer to know. -->

.github/workflows/stage-4-deploy.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ jobs:
1515
environment: azure
1616

1717
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
18+
- name: Checkout code
19+
uses: actions/checkout@v4
2020

21-
- uses: azure/login@v2
22-
with:
23-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
24-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
25-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
21+
- uses: azure/login@v2
22+
with:
23+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
24+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
25+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
2626

27-
- name: Call deployment pipeline
28-
run: |
29-
az pipelines run --commit-id ${{inputs.commit_sha}} --name "Deploy to Azure" --org https://dev.azure.com/nhse-dtos --project dtos-manage-breast-screening \
30-
--parameters commitSHA=${{inputs.commit_sha}}
27+
- name: Call deployment pipeline
28+
run: |
29+
az pipelines run --commit-id ${{inputs.commit_sha}} --name "Deploy to Azure" --org https://dev.azure.com/nhse-dtos --project dtos-manage-breast-screening \
30+
--parameters commitSHA=${{inputs.commit_sha}}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ manage_breast_screening/assets/compiled
1818
manage_breast_screening/staticfiles
1919
manage_breast_screening/static
2020

21+
# Files that aren't checked in
22+
.pytest_cache
23+
.terraform

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ WORKDIR /app
1010
RUN apk add --no-cache bash
1111

1212
# Compile static assets
13-
COPY .browserslistrc babel.config.js package.json package-lock.json rollup.config.js ./
13+
COPY .browserslistrc babel.config.cjs package.json package-lock.json rollup.config.js ./
1414
COPY manage_breast_screening ./manage_breast_screening
1515
RUN npm ci
1616
RUN npm run compile

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ For each environment, e.g. 'dev':
131131
1. The web app URL will be displayed as output. Copy it into a browser on the AVD to access the app.
132132

133133
## Continuous deployment
134+
134135
When a PR is merged, Github actions securely triggers the deployment pipeline on the Azure devops pool running on the internal network. It currently deploys the dev environment automatically.
135136

136137
Access [Azure devops](https://dev.azure.com/nhse-dtos/dtos-manage-breast-screening/_build?definitionId=86) to see the pipeline.

babel.config.js renamed to babel.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @type {TransformOptions}
33
*/
4-
export default {
4+
module.exports = {
55
browserslistEnv: 'javascripts',
66
presets: [
77
[

manage_breast_screening/clinics/models.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import uuid
21
from datetime import date
32
from enum import StrEnum
43

54
from django.db import models
65

7-
8-
class BaseModel(models.Model):
9-
class Meta:
10-
abstract = True
11-
12-
id = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
13-
created_at = models.DateTimeField(auto_now_add=True)
14-
updated_at = models.DateTimeField(auto_now=True)
6+
from ..core.models import BaseModel
157

168

179
class Provider(BaseModel):

manage_breast_screening/clinics/presenters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from ..utils.date_formatting import format_date, format_time_range
2-
from ..utils.string_formatting import sentence_case
1+
from ..core.utils.date_formatting import format_date, format_time_range
2+
from ..core.utils.string_formatting import sentence_case
33
from .models import Clinic
44

55

manage_breast_screening/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def boolean_env(key, default=None):
5757
"django.contrib.sessions",
5858
"django.contrib.messages",
5959
"django.contrib.staticfiles",
60+
"manage_breast_screening.core",
6061
"manage_breast_screening.clinics",
6162
"manage_breast_screening.participants",
6263
"manage_breast_screening.mammograms",
@@ -73,7 +74,7 @@ def boolean_env(key, default=None):
7374
"django.middleware.clickjacking.XFrameOptionsMiddleware",
7475
]
7576

76-
ROOT_URLCONF = "manage_breast_screening.config.urls"
77+
ROOT_URLCONF = "manage_breast_screening.core.urls"
7778

7879
TEMPLATES = [
7980
{

0 commit comments

Comments
 (0)