Skip to content

Commit

Permalink
Featutre/merge latest to staging (#80)
Browse files Browse the repository at this point in the history
* WIP: Consume Nuget package

* Consume NuGet package

* Solved issue with tests

* Updated package

* added CW dashboard (#62)

* added CW dashboard

* use module output for SSM param

* Fix error (#64)

* fixed error

* fix error

* increase node count to fix yellow status (#66)

* increased instance count for staging (#67)

* Updated package

* change to use regional API gateway endpoint (#70)

* revert change to regional api (#71)

* Account Elastic Search

* rebase from master

* Revert "Merge branch 'master' of https://github.com/LBHackney-IT/housing-search-api"

This reverts commit 339d301, reversing
changes made to cf0159b.

* Revert "rebase from master"

This reverts commit cf0159b.

* Revert "Account Elastic Search"

This reverts commit 69f433b.

* revert to edge endpoint (#72)

* added Terraform Compliance checks (#75)

* added Terraform Comliance checks

* added staging and prod checks

* Fix test (#76)

* comment tests out

* comment tests out to fix error

* add tests

* fix syntax error

* update tests

* comment out all tests except 1 (#77)

* comment out all tests except 1

* remove branch filter to test

* test

* test

* fix test

* re-added test

* re-added test

* re-added test

* re-added test

* re-added test

* re-added test

* re-added test

* fix tests

* add filter back

* fixed error (#78)

Co-authored-by: humulla <[email protected]>
Co-authored-by: Charnjit Sohal <[email protected]>
Co-authored-by: Evangelos Aktoudianakis <[email protected]>
Co-authored-by: Evangelos Aktoudianakis <[email protected]>
Co-authored-by: Hamid Jolany <[email protected]>
  • Loading branch information
6 people authored Nov 18, 2021
1 parent 25b05aa commit 5522033
Show file tree
Hide file tree
Showing 58 changed files with 259 additions and 831 deletions.
140 changes: 125 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ commands:
root: *workspace_root
paths:
- .aws
terraform-init-then-apply:
description: "Initializes and applies terraform configuration"
terraform-init-then-plan:
description: "Initializes and run plan from terraform configuration"
parameters:
environment:
type: string
Expand All @@ -52,11 +52,55 @@ commands:
terraform get -update=true
terraform init
name: get and init
- run:
name: plan
command: |
cd ./terraform/<<parameters.environment>>/
terraform plan -out=plan.out
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
- project/*
terraform-compliance:
description: "Run Terraform Compliance checks"
parameters:
environment:
type: string
steps:
- *attach_workspace
- checkout
- run:
command: |
cd ./terraform/<<parameters.environment>>/
apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
apk add --update --no-cache g++ gcc libxslt-dev python3-dev
python3 -m ensurepip
pip3 install --no-cache --upgrade pip setuptools
pip install terraform-compliance
terraform-compliance -f terraform-compliance/ -p plan.out
name: terraform compliance
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
terraform-apply:
description: "Runs Terraform Apply"
parameters:
environment:
type: string
steps:
- *attach_workspace
- checkout
- run:
name: apply
command: |
cd ./terraform/<<parameters.environment>>/
terraform apply -auto-approve
terraform apply -auto-approve plan.out
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
deploy-lambda:
description: "Deploys API via Serverless"
parameters:
Expand Down Expand Up @@ -123,20 +167,50 @@ jobs:
steps:
- assume-role-and-persist-workspace:
aws-account: $AWS_ACCOUNT_PRODUCTION
terraform-init-and-apply-to-development:
terraform-init-and-plan-development:
executor: docker-terraform
steps:
- terraform-init-then-plan:
environment: "development"
terraform-compliance-development:
executor: docker-terraform
steps:
- terraform-compliance:
environment: "development"
terraform-apply-development:
executor: docker-terraform
steps:
- terraform-init-then-apply:
- terraform-apply:
environment: "development"
terraform-init-and-apply-to-staging:
terraform-init-and-plan-staging:
executor: docker-terraform
steps:
- terraform-init-then-apply:
- terraform-init-then-plan:
environment: "staging"
terraform-init-and-apply-to-production:
terraform-compliance-staging:
executor: docker-terraform
steps:
- terraform-init-then-apply:
- terraform-compliance:
environment: "staging"
terraform-apply-staging:
executor: docker-terraform
steps:
- terraform-apply:
environment: "staging"
terraform-init-and-plan-production:
executor: docker-terraform
steps:
- terraform-init-then-plan:
environment: "production"
terraform-compliance-production:
executor: docker-terraform
steps:
- terraform-compliance:
environment: "production"
terraform-apply-production:
executor: docker-terraform
steps:
- terraform-apply:
environment: "production"
deploy-to-development:
executor: docker-dotnet
Expand Down Expand Up @@ -166,15 +240,27 @@ workflows:
filters:
branches:
only: master
- terraform-init-and-apply-to-development:
- terraform-init-and-plan-development:
requires:
- assume-role-development
filters:
branches:
only: master
- terraform-compliance-development:
requires:
- terraform-init-and-plan-development
filters:
branches:
only: master
- terraform-apply-development:
requires:
- terraform-compliance-development
filters:
branches:
only: master
- deploy-to-development:
requires:
- terraform-init-and-apply-to-development
- terraform-apply-development
filters:
branches:
only: master
Expand All @@ -192,15 +278,27 @@ workflows:
filters:
branches:
only: release
- terraform-init-and-apply-to-staging:
- terraform-init-and-plan-staging:
requires:
- assume-role-staging
filters:
branches:
only: release
- terraform-compliance-staging:
requires:
- terraform-init-and-plan-staging
filters:
branches:
only: release
- terraform-apply-staging:
requires:
- terraform-compliance-staging
filters:
branches:
only: release
- deploy-to-staging:
requires:
- terraform-init-and-apply-to-staging
- terraform-apply-staging
filters:
branches:
only: release
Expand All @@ -215,16 +313,28 @@ workflows:
filters:
branches:
only: release
- terraform-init-and-apply-to-production:
- terraform-init-and-plan-production:
requires:
- assume-role-production
filters:
branches:
only: release
- terraform-compliance-production:
requires:
- terraform-init-and-plan-production
filters:
branches:
only: release
- terraform-apply-production:
requires:
- terraform-compliance-production
filters:
branches:
only: release
- permit-production-release:
type: approval
requires:
- terraform-init-and-apply-to-production
- terraform-apply-production
filters:
branches:
only: release
Expand Down
1 change: 1 addition & 0 deletions HousingSearchApi.Tests/HousingSearchApi.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<PackageReference Include="Docker.DotNet" Version="3.125.4" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Hackney.Core.ElasticSearch" Version="1.45.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
Expand Down
4 changes: 2 additions & 2 deletions HousingSearchApi.Tests/V1/E2ETests/Fixtures/AssetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using System.Threading;
using AutoFixture;
using Elasticsearch.Net;
using HousingSearchApi.V1.Gateways.Models.Assets;
using HousingSearchApi.V1.Gateways.Models.Persons;
using Hackney.Shared.HousingSearch.Gateways.Models.Assets;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using Nest;

namespace HousingSearchApi.Tests.V1.E2ETests.Fixtures
Expand Down
4 changes: 2 additions & 2 deletions HousingSearchApi.Tests/V1/E2ETests/Fixtures/PersonsFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using AutoFixture;
using Elasticsearch.Net;
using HousingSearchApi.V1.Domain;
using HousingSearchApi.V1.Gateways.Models.Persons;
using Hackney.Shared.HousingSearch.Domain;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using HousingSearchApi.V1.Infrastructure;
using Nest;
using System;
Expand Down
4 changes: 2 additions & 2 deletions HousingSearchApi.Tests/V1/E2ETests/Fixtures/TenureFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using System.Threading;
using AutoFixture;
using Elasticsearch.Net;
using HousingSearchApi.V1.Gateways.Models.Persons;
using HousingSearchApi.V1.Gateways.Models.Tenures;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using Hackney.Shared.HousingSearch.Gateways.Models.Tenures;
using Nest;

namespace HousingSearchApi.Tests.V1.E2ETests.Fixtures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using System.Text.Json;
using System.Threading.Tasks;
using FluentAssertions;
using Hackney.Shared.HousingSearch.Domain;
using HousingSearchApi.Tests.V1.E2ETests.Fixtures;
using HousingSearchApi.Tests.V1.E2ETests.Steps.Base;
using HousingSearchApi.V1.Boundary.Responses;
using HousingSearchApi.V1.Boundary.Responses.Metadata;
using HousingSearchApi.V1.Domain;
using HousingSearchApi.V1.Infrastructure;

namespace HousingSearchApi.Tests.V1.E2ETests.Steps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using HousingSearchApi.Tests.V1.E2ETests.Fixtures;
using HousingSearchApi.Tests.V1.E2ETests.Steps;
using HousingSearchApi.V1.Domain;
using TestStack.BDDfy;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FluentAssertions;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using HousingSearchApi.V1.Boundary.Requests;
using HousingSearchApi.V1.Gateways.Models.Persons;
using HousingSearchApi.V1.Interfaces.Sorting;
using Xunit;

Expand Down
2 changes: 1 addition & 1 deletion HousingSearchApi.Tests/V1/Helper/SearchPhraseTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using FluentAssertions;
using Hackney.Core.ElasticSearch;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using HousingSearchApi.V1.Boundary.Requests;
using HousingSearchApi.V1.Gateways.Models.Persons;
using HousingSearchApi.V1.Infrastructure;
using HousingSearchApi.V1.Interfaces;
using Nest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentAssertions;
using HousingSearchApi.V1.Domain;
using Hackney.Shared.HousingSearch.Domain;
using HousingSearchApi.V1.Infrastructure;
using System;
using System.Collections.Generic;
Expand Down
7 changes: 4 additions & 3 deletions HousingSearchApi.Tests/V1/Interfaces/IndexSelectorTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using FluentAssertions;
using HousingSearchApi.V1.Gateways.Models.Assets;
using HousingSearchApi.V1.Gateways.Models.Persons;
using Hackney.Shared.HousingSearch.Gateways.Models.Assets;
using Hackney.Shared.HousingSearch.Gateways.Models.Persons;
using Hackney.Shared.HousingSearch.Gateways.Models.Tenures;
using HousingSearchApi.V1.Interfaces;
using Xunit;

Expand Down Expand Up @@ -39,7 +40,7 @@ public void GivenAnIndexSelectorWhenQueryableAssetShouldReturnAssetsIndex()
public void GivenAnIndexSelectorWhenQueryableTenureShouldReturnTenuresIndex()
{
// Arrange + act
var result = _sut.Create<HousingSearchApi.V1.Gateways.Models.Tenures.QueryableTenure>();
var result = _sut.Create<QueryableTenure>();

// Assert
result.Indices[0].Should().Be("tenures");
Expand Down
5 changes: 1 addition & 4 deletions HousingSearchApi/HousingSearchApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<Compile Remove="V1\Domain\ElasticSearch\**" />
<Compile Remove="V1\Factories\**" />
<Content Remove="V1\Domain\ElasticSearch\**" />
<Content Remove="V1\Factories\**" />
<EmbeddedResource Remove="V1\Domain\ElasticSearch\**" />
<EmbeddedResource Remove="V1\Factories\**" />
<None Remove="V1\Domain\ElasticSearch\**" />
<None Remove="V1\Factories\**" />
</ItemGroup>

Expand All @@ -35,6 +31,7 @@
<PackageReference Include="Hackney.Core.Logging" Version="1.30.0" />
<PackageReference Include="Hackney.Core.Middleware" Version="1.30.0" />
<PackageReference Include="Hackney.Core.Validation" Version="1.30.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.6.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using HousingSearchApi.V1.Domain;
using Hackney.Shared.HousingSearch.Domain;
using Microsoft.AspNetCore.Mvc;

namespace HousingSearchApi.V1.Boundary.Requests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using HousingSearchApi.V1.Domain.Asset;
using Hackney.Shared.HousingSearch.Domain.Asset;

namespace HousingSearchApi.V1.Boundary.Responses
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Hackney.Shared.HousingSearch.Domain.Person;
using System.Collections.Generic;
using HousingSearchApi.V1.Domain.Person;

namespace HousingSearchApi.V1.Boundary.Responses
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Hackney.Shared.HousingSearch.Domain.Tenure;
using System.Collections.Generic;

namespace HousingSearchApi.V1.Boundary.Responses
Expand All @@ -6,11 +7,11 @@ public class GetTenureListResponse
{
private long _total;

public List<Domain.Tenure.Tenure> Tenures { get; set; }
public List<Tenure> Tenures { get; set; }

public GetTenureListResponse()
{
Tenures = new List<Domain.Tenure.Tenure>();
Tenures = new List<Tenure>();
}

public void SetTotal(long total)
Expand Down
Loading

0 comments on commit 5522033

Please sign in to comment.