Skip to content

Commit

Permalink
merge from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
paullocknimble committed May 1, 2024
2 parents b3abfa2 + 8c2bfc9 commit 3798f06
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 72 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ jobs:
release: ${{ steps.var.outputs.release }}
checked-out-sha: ${{ steps.var.outputs.checked-out-sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v4

- id: var
run: |
GIT_REF=${{ env.branch_ref }}
GIT_REF=${{ github.ref_name }}
GIT_BRANCH=${GIT_REF##*/}
INPUT=${{ github.event.inputs.environment }}
ENVIRONMENT=${INPUT:-"development"}
Expand All @@ -47,17 +46,16 @@ jobs:
deploy-image:
name: Deploy '${{ needs.set-env.outputs.branch }}' to ${{ needs.set-env.outputs.environment }}
needs: [ set-env ]
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v1.1.0
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v2.1.0
with:
docker-image-name: 'aca-app'
docker-build-file-name: './Dockerfile'
environment: ${{ needs.set-env.outputs.environment }}
docker-build-args: |
COMMIT_SHA="${{ needs.set-env.outputs.checked-out-sha }}"
secrets:
azure-acr-client-id: ${{ secrets.AZURE_ACR_CLIENTID }}
azure-acr-secret: ${{ secrets.AZURE_ACR_SECRET }}
azure-acr-url: ${{ secrets.AZURE_ACR_URL }}
azure-acr-name: ${{ secrets.ACR_NAME }}
azure-acr-credentials: ${{ secrets.ACR_CREDENTIALS }}
azure-aca-credentials: ${{ secrets.AZURE_ACA_CREDENTIALS }}
azure-aca-name: ${{ secrets.AZURE_ACA_NAME }}
azure-aca-resource-group: ${{ secrets.AZURE_ACA_RESOURCE_GROUP }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dfe.Academies.Academisation.Domain.SeedWork;
using System.Threading;
using Dfe.Academies.Academisation.Domain.SeedWork;
using Dfe.Academies.Academisation.Domain.TransferProjectAggregate;
using Dfe.Academies.Academisation.IDomain.TransferProjectAggregate;
using Microsoft.EntityFrameworkCore;
Expand All @@ -21,7 +22,7 @@ public TransferProjectRepository(AcademisationContext context) : base(context)
}
public async Task<(IEnumerable<ITransferProject>, int totalcount)> SearchProjects(IEnumerable<string>? states, string? title, IEnumerable<string>? deliveryOfficers, int page, int count)
{
IQueryable<TransferProject> queryable = this.dbSet;
IQueryable<TransferProject> queryable = DefaultIncludes();

// Region & Local Authority isn't on Transfers right now
//queryable = FilterByRegion(regions, queryable);
Expand Down Expand Up @@ -65,29 +66,16 @@ private static IQueryable<TransferProject> FilterByKeyword(string? title, IQuery
{
if (!string.IsNullOrWhiteSpace(title))
{

queryable = FilterIncomingTrust(title, queryable);
queryable = FilterOutgoingTrust(title, queryable);
queryable = FilterURN(title, queryable);

queryable = queryable.Where(p =>
p.TransferringAcademies.Any(x =>
EF.Functions.Like(x.IncomingTrustName, $"%{title}%"))
|| EF.Functions.Like(p.OutgoingTrustName, $"%{title}%")
|| EF.Functions.Like(p.Urn.ToString(), $"%{title}%"));
}

return queryable;
}

private static IQueryable<TransferProject> FilterIncomingTrust(string title, IQueryable<TransferProject> queryable)
{
return queryable.Where(p =>
p.TransferringAcademies.Any(x =>
x.IncomingTrustName != null &&
x.IncomingTrustName.Contains(title, StringComparison.CurrentCultureIgnoreCase)
)
);
}
private static IQueryable<TransferProject> FilterOutgoingTrust(string title, IQueryable<TransferProject> queryable)
{
return queryable.Where(p => p.OutgoingTrustName != null && p.OutgoingTrustName.Contains(title, StringComparison.CurrentCultureIgnoreCase));
}
private static IQueryable<TransferProject> FilterURN(string title, IQueryable<TransferProject> queryable)
{
return queryable.Where(p => p.Urn.ToString().Contains(title, StringComparison.CurrentCultureIgnoreCase));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public interface ITransferringAcademy
{
int Id { get; }
string? IncomingTrustUkprn { get; }
string IncomingTrustName { get; }
string? IncomingTrustName { get; }
string? KeyStage2PerformanceAdditionalInformation { get; }
string? KeyStage4PerformanceAdditionalInformation { get; }
string? KeyStage5PerformanceAdditionalInformation { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class TransferringAcademiesResponse
{
public string OutgoingAcademyUkprn { get; set; }
public string? IncomingTrustUkprn { get; set; }
public string IncomingTrustName { get; set; }
public string? IncomingTrustName { get; set; }


public string PupilNumbersAdditionalInformation { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Dfe.Academies.Academisation.IService.Commands.Legacy.Project;
using Dfe.Academies.Academisation.IService.Query;
using Dfe.Academies.Academisation.IService.ServiceModels.Legacy.ProjectAggregate;
using Dfe.Academisation.ExtensionMethods;

namespace Dfe.Academies.Academisation.Service.Queries
{
Expand Down Expand Up @@ -39,71 +38,68 @@ private async Task<Stream> GenerateSpreadsheet(IEnumerable<ConversionProjectServ
{
var workbook = new XLWorkbook();
var worksheet = workbook.Worksheets.Add("Projects");

// Add headers and set styles
worksheet.Cell(1, 1).Value = "School";
worksheet.Cell(1, 1).Style.Font.Bold = true;
worksheet.Cell(1, 2).Value = "URN";
worksheet.Cell(1, 2).Style.Font.Bold = true;
worksheet.Cell(1, 3).Value = "School type";
worksheet.Cell(1, 3).Style.Font.Bold = true;
worksheet.Cell(1, 4).Value = "Incoming Trust";
worksheet.Cell(1, 4).Style.Font.Bold = true;
worksheet.Cell(1, 5).Value = "Incoming Trust Reference Number";
worksheet.Cell(1, 5).Style.Font.Bold = true;
worksheet.Cell(1, 6).Value = "Local Authority";
worksheet.Cell(1, 6).Style.Font.Bold = true;
worksheet.Cell(1, 7).Value = "Region";
worksheet.Cell(1, 7).Style.Font.Bold = true;
worksheet.Cell(1, 8).Value = "Advisory Board Date";
worksheet.Cell(1, 8).Style.Font.Bold = true;
worksheet.Cell(1, 9).Value = "Decision Date";
worksheet.Cell(1, 9).Style.Font.Bold = true;
worksheet.Cell(1, 10).Value = "Status";
worksheet.Cell(1, 10).Style.Font.Bold = true;
worksheet.Cell(1, 11).Value = "Assigned To";
worksheet.Cell(1, 11).Style.Font.Bold = true;
worksheet.Cell(1, 12).Value = "Academy Type and Route";
worksheet.Cell(1, 12).Style.Font.Bold = true;
worksheet.Cell(1, 13).Value = "Part of PFI scheme";
worksheet.Cell(1, 13).Style.Font.Bold = true;
worksheet.Cell(1, 3).Value = "School Type";
worksheet.Cell(1, 4).Value = "School Phase";
worksheet.Cell(1, 5).Value = "Incoming Trust";
worksheet.Cell(1, 6).Value = "Incoming Trust Reference Number";
worksheet.Cell(1, 7).Value = "Local Authority";
worksheet.Cell(1, 8).Value = "Region";
worksheet.Cell(1, 9).Value = "Advisory Board Date";
worksheet.Cell(1, 10).Value = "Decision Date";
worksheet.Cell(1, 11).Value = "Status";
worksheet.Cell(1, 12).Value = "Assigned To";
worksheet.Cell(1, 13).Value = "Academy Type and Route";
worksheet.Cell(1, 14).Value = "Part of PFI scheme";
worksheet.Cell(1, 15).Value = "Date AO issued";
worksheet.Cell(1, 16).Value = "Date dAO issued";

// Bold headers
for (int col = 1; col <= 16; col++)
{
worksheet.Cell(1, col).Style.Font.Bold = true;
}

worksheet.Cell(1, 14).Value = "Date AO issued";
worksheet.Cell(1, 14).Style.Font.Bold = true;
worksheet.Cell(1, 15).Value = "Date dAO issued";
worksheet.Cell(1, 15).Style.Font.Bold = true;
int row = 2;
foreach (var project in projects)
{
worksheet.Cell(row, 1).Value = project.SchoolName;
worksheet.Cell(row, 2).Value = project.Urn;
worksheet.Cell(row, 3).Value = project.SchoolType;
worksheet.Cell(row, 4).Value = project.NameOfTrust;
worksheet.Cell(row, 5).Value = project.TrustReferenceNumber;
worksheet.Cell(row, 6).Value = project.LocalAuthority;
worksheet.Cell(row, 7).Value = project.Region;
worksheet.Cell(row, 8).Value = project.HeadTeacherBoardDate;
var advisoryBoardDecision = await _advisoryBoardDecisionQueryService.GetByProjectId(project.Id);
worksheet.Cell(row, 9).Value = advisoryBoardDecision?.AdvisoryBoardDecisionDate;
worksheet.Cell(row, 10).Value = project.ProjectStatus;
worksheet.Cell(row, 11).Value = project.AssignedUser?.FullName;
worksheet.Cell(row, 12).Value = project.AcademyTypeAndRoute;
worksheet.Cell(row, 13).Value = project.PartOfPfiScheme;
worksheet.Cell(row, 4).Value = project.SchoolPhase;
worksheet.Cell(row, 5).Value = project.NameOfTrust;
worksheet.Cell(row, 6).Value = project.TrustReferenceNumber;
worksheet.Cell(row, 7).Value = project.LocalAuthority;
worksheet.Cell(row, 8).Value = project.Region;
worksheet.Cell(row, 9).Value = project.HeadTeacherBoardDate;
var advisoryBoardDecision = await _advisoryBoardDecisionQueryService.GetByProjectId(project.Id);
worksheet.Cell(row, 10).Value = advisoryBoardDecision?.AdvisoryBoardDecisionDate;
worksheet.Cell(row, 11).Value = project.ProjectStatus;
worksheet.Cell(row, 12).Value = project.AssignedUser?.FullName;
worksheet.Cell(row, 13).Value = project.AcademyTypeAndRoute;
worksheet.Cell(row, 14).Value = project.PartOfPfiScheme;

if (project.AcademyTypeAndRoute?.ToLower().Equals("sponsored") ?? false)
{
worksheet.Cell(row, 15).Value = project.DaoPackSentDate.ToDateString();
worksheet.Cell(row, 16).Value = project.DaoPackSentDate;
}
else
{
worksheet.Cell(row, 14).Value = advisoryBoardDecision?.AcademyOrderDate.ToDateString();
worksheet.Cell(row, 15).Value = advisoryBoardDecision?.AdvisoryBoardDecisionDetails.AcademyOrderDate;
}
row++;
}

worksheet.Columns().AdjustToContents();
var stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;

return stream;
}

}
}
2 changes: 2 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ No resources.
| <a name="input_container_health_probe_path"></a> [container\_health\_probe\_path](#input\_container\_health\_probe\_path) | Specifies the path that is used to determine the liveness of the Container | `string` | n/a | yes |
| <a name="input_container_scale_http_concurrency"></a> [container\_scale\_http\_concurrency](#input\_container\_scale\_http\_concurrency) | When the number of concurrent HTTP requests exceeds this value, then another replica is added. Replicas continue to add to the pool up to the max-replicas amount. | `number` | `10` | no |
| <a name="input_container_secret_environment_variables"></a> [container\_secret\_environment\_variables](#input\_container\_secret\_environment\_variables) | Container secret environment variables | `map(string)` | n/a | yes |
| <a name="input_dns_mx_records"></a> [dns\_mx\_records](#input\_dns\_mx\_records) | DNS MX records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(<br> object({<br> preference : number,<br> exchange : string<br> })<br> )<br> })<br> )</pre> | `{}` | no |
| <a name="input_dns_ns_records"></a> [dns\_ns\_records](#input\_dns\_ns\_records) | DNS NS records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | n/a | yes |
| <a name="input_dns_txt_records"></a> [dns\_txt\_records](#input\_dns\_txt\_records) | DNS TXT records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | n/a | yes |
| <a name="input_dns_zone_domain_name"></a> [dns\_zone\_domain\_name](#input\_dns\_zone\_domain\_name) | DNS zone domain name. If created, records will automatically be created to point to the CDN. | `string` | n/a | yes |
Expand Down Expand Up @@ -194,6 +195,7 @@ No resources.
| <a name="input_project_name"></a> [project\_name](#input\_project\_name) | Project name. Will be used along with `environment` as a prefix for all resources. | `string` | n/a | yes |
| <a name="input_registry_admin_enabled"></a> [registry\_admin\_enabled](#input\_registry\_admin\_enabled) | Do you want to enable access key based authentication for your Container Registry? | `bool` | `false` | no |
| <a name="input_registry_managed_identity_assign_role"></a> [registry\_managed\_identity\_assign\_role](#input\_registry\_managed\_identity\_assign\_role) | Assign the 'AcrPull' Role to the Container App User-Assigned Managed Identity. Note: If you do not have 'Microsoft.Authorization/roleAssignments/write' permission, you will need to manually assign the 'AcrPull' Role to the identity | `bool` | `false` | no |
| <a name="input_registry_server"></a> [registry\_server](#input\_registry\_server) | Container registry server (required if `enable_container_registry` is false) | `string` | `""` | no |
| <a name="input_registry_use_managed_identity"></a> [registry\_use\_managed\_identity](#input\_registry\_use\_managed\_identity) | Create a User-Assigned Managed Identity for the Container App. Note: If you do not have 'Microsoft.Authorization/roleAssignments/write' permission, you will need to manually assign the 'AcrPull' Role to the identity | `bool` | `true` | no |
| <a name="input_statuscake_api_token"></a> [statuscake\_api\_token](#input\_statuscake\_api\_token) | API token for StatusCake | `string` | `"00000000000000000000000000000"` | no |
| <a name="input_statuscake_contact_group_email_addresses"></a> [statuscake\_contact\_group\_email\_addresses](#input\_statuscake\_contact\_group\_email\_addresses) | List of email address that should receive notifications from StatusCake | `list(string)` | `[]` | no |
Expand Down
2 changes: 2 additions & 0 deletions terraform/container-apps-hosting.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module "azure_container_apps_hosting" {
registry_admin_enabled = local.registry_admin_enabled
registry_use_managed_identity = local.registry_use_managed_identity
registry_managed_identity_assign_role = local.registry_managed_identity_assign_role
registry_server = local.registry_server

image_name = local.image_name
container_command = local.container_command
Expand All @@ -35,6 +36,7 @@ module "azure_container_apps_hosting" {
dns_zone_domain_name = local.dns_zone_domain_name
dns_ns_records = local.dns_ns_records
dns_txt_records = local.dns_txt_records
dns_mx_records = local.dns_mx_records

enable_cdn_frontdoor = local.enable_cdn_frontdoor
cdn_frontdoor_forwarding_protocol = local.cdn_frontdoor_forwarding_protocol
Expand Down
2 changes: 2 additions & 0 deletions terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ locals {
registry_admin_enabled = var.registry_admin_enabled
registry_use_managed_identity = var.registry_use_managed_identity
registry_managed_identity_assign_role = var.registry_managed_identity_assign_role
registry_server = var.registry_server
image_name = var.image_name
container_command = var.container_command
container_secret_environment_variables = var.container_secret_environment_variables
Expand All @@ -27,6 +28,7 @@ locals {
dns_zone_domain_name = var.dns_zone_domain_name
dns_ns_records = var.dns_ns_records
dns_txt_records = var.dns_txt_records
dns_mx_records = var.dns_mx_records
enable_cdn_frontdoor = var.enable_cdn_frontdoor
container_apps_allow_ips_inbound = var.container_apps_allow_ips_inbound
cdn_frontdoor_enable_rate_limiting = var.cdn_frontdoor_enable_rate_limiting
Expand Down
22 changes: 22 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ variable "enable_container_registry" {
type = bool
}

variable "registry_server" {
description = "Container registry server (required if `enable_container_registry` is false)"
type = string
default = ""
}

variable "registry_admin_enabled" {
description = "Do you want to enable access key based authentication for your Container Registry?"
type = bool
Expand Down Expand Up @@ -265,6 +271,22 @@ variable "dns_ns_records" {
)
}

variable "dns_mx_records" {
description = "DNS MX records to add to the DNS Zone"
type = map(
object({
ttl : optional(number, 300),
records : list(
object({
preference : number,
exchange : string
})
)
})
)
default = {}
}

variable "dns_txt_records" {
description = "DNS TXT records to add to the DNS Zone"
type = map(
Expand Down

0 comments on commit 3798f06

Please sign in to comment.