Skip to content

Commit

Permalink
New Environments for IAT and PreProd also update Elastic and add chan…
Browse files Browse the repository at this point in the history
…ges for FileTransformV2 (#212)

* Td/abzu 137905 app insights upgrade2 (#118)

* Bump the all-packages group (#114)

Bumps the all-packages group in /UKHO.ExternalNotificationService.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the all-packages group (#115)

Bumps the all-packages group in /UKHO.D365CallbackDistributorStub.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Abzu 137905 - update App Insights (#116)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Develop merge (#119)

* Bump the all-packages group (#114)

Bumps the all-packages group in /UKHO.ExternalNotificationService.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the all-packages group (#115)

Bumps the all-packages group in /UKHO.D365CallbackDistributorStub.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Abzu 137905 - update App Insights (#116)

* Update .NET SDK to 6.0.419 (#117)

* Update .NET SDK

Update .NET SDK to version 6.0.419.

---
updated-dependencies:
- dependency-name: Microsoft.NET.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Bump .NET NuGet packages with 6 updates

Bump .NET NuGet packages with 6 updates:

Update Microsoft.AspNetCore.Authentication.JwtBearer from 6.0.26 to 6.0.27.
Update Microsoft.AspNetCore.HeaderPropagation from 6.0.26 to 6.0.27.
Update Microsoft.AspNetCore.Mvc.NewtonsoftJson from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Http.Polly from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Logging.AzureAppServices from 6.0.26 to 6.0.27.

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authentication.JwtBearer
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.AspNetCore.HeaderPropagation
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.AspNetCore.Mvc.NewtonsoftJson
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Http.Polly
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Logging.AzureAppServices
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Dev/abzu 143974 dependabot updates (#121)

* Bump the all-packages group (#114)

Bumps the all-packages group in /UKHO.ExternalNotificationService.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the all-packages group (#115)

Bumps the all-packages group in /UKHO.D365CallbackDistributorStub.API with 1 update: [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest).


Updates `Microsoft.NET.Test.Sdk` from 17.8.0 to 17.9.0
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Abzu 137905 - update App Insights (#116)

* Update .NET SDK to 6.0.419 (#117)

* Update .NET SDK

Update .NET SDK to version 6.0.419.

---
updated-dependencies:
- dependency-name: Microsoft.NET.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Bump .NET NuGet packages with 6 updates

Bump .NET NuGet packages with 6 updates:

Update Microsoft.AspNetCore.Authentication.JwtBearer from 6.0.26 to 6.0.27.
Update Microsoft.AspNetCore.HeaderPropagation from 6.0.26 to 6.0.27.
Update Microsoft.AspNetCore.Mvc.NewtonsoftJson from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Http.Polly from 6.0.26 to 6.0.27.
Update Microsoft.Extensions.Logging.AzureAppServices from 6.0.26 to 6.0.27.

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Authentication.JwtBearer
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.AspNetCore.HeaderPropagation
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.AspNetCore.Mvc.NewtonsoftJson
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Http.Polly
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.Extensions.Logging.AzureAppServices
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Bump the all-packages group in /UKHO.ExternalNotificationService.API with 3 updates (#120)

* Bump the all-packages group

Bumps the all-packages group in /UKHO.ExternalNotificationService.API with 3 updates: [Azure.Extensions.AspNetCore.Configuration.Secrets](https://github.com/Azure/azure-sdk-for-net), [Azure.Security.KeyVault.Secrets](https://github.com/Azure/azure-sdk-for-net) and [Azure.Messaging.EventGrid](https://github.com/Azure/azure-sdk-for-net).


Updates `Azure.Extensions.AspNetCore.Configuration.Secrets` from 1.3.0 to 1.3.1
- [Release notes](https://github.com/Azure/azure-sdk-for-net/releases)
- [Commits](Azure/azure-sdk-for-net@Azure.Extensions.AspNetCore.Configuration.Secrets_1.3.0...Azure.Extensions.AspNetCore.Configuration.Secrets_1.3.1)

Updates `Azure.Security.KeyVault.Secrets` from 4.5.0 to 4.6.0
- [Release notes](https://github.com/Azure/azure-sdk-for-net/releases)
- [Commits](Azure/azure-sdk-for-net@Azure.Security.KeyVault.Secrets_4.5.0...Azure.Security.KeyVault.Secrets_4.6.0)

Updates `Azure.Messaging.EventGrid` from 4.21.0 to 4.22.0
- [Release notes](https://github.com/Azure/azure-sdk-for-net/releases)
- [Commits](Azure/azure-sdk-for-net@Azure.Messaging.EventGrid_4.21.0...Azure.Messaging.EventGrid_4.22.0)

---
updated-dependencies:
- dependency-name: Azure.Extensions.AspNetCore.Configuration.Secrets
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-packages
- dependency-name: Azure.Security.KeyVault.Secrets
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
- dependency-name: Azure.Messaging.EventGrid
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-packages
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update packages

* Remove unused suppression

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HugoBurgess <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Remove depricated azure packages from API

* Remove obsolete Microsoft.Azure.EventGrid from Common

* First attempt migrate Microsoft.Azure.Management.EventGrid to
Azure.ResourceManager.EventGrid

* fixing DeadLetter callback test

* Re organise code

* Remove comments and tidy

* Updated Stub
Removed NewtonSoft references

* Remove CustomCloudEvent from functional tests

* Reset stub back to old version

* fix missing  newtonsoft package

* Remove secrets again

Removed newtonsoft from most of the api code

Remove secrets

Removed newtonsoft from most of the api code

* Json convert problem in health check

* System.Text.Json my not be able to deserialize dynamic

* Fix json dynamic conversion issue

* Fix and tidy json dynamic issue

* ConvertObjectTo needs to convert JsonElement.

* Abzu-103814-Replaced default ubuntu pool with Mare Nectaris (#130) (#131)

* Update API Packages

* Add JsonSerializerOptions set to case insensative

* Minor Package updates

* Add JsonOptions CaseInsensitive = true

* add serialization options CaseInsensitive = true

* Update CustomCloudEvent and DistributorRequest
Remove CustomCloudEvent dependency on EventGridEvent.
DistributorRequst.StatusCode properly cased

* Add check that the stub return is ok
Something has changed

* Add JsonPropertyName attribute

* Set test EventBodyData method attributes to camelcCase

* Add serializeOptions to base controller which will be applied to incoming data.

* add serializeoptions to ConvertObjectTo

* Add JsonSerializerOptions to FssEventDataMapping

* Alter Failing Test, not a fix

* Add more checks

* More checks added

* Remove Tracing code

* Remove newtonsoft from common, Tidy and trace DeadLetterCallback

* Add Json Options to ScsEventDataMapping
Remove tracing from DeadLetterCallback
Update Assert that stubRequest was successful
Mark WebJobHelper Deserializer for review

* Add trace to DeadLetterCallback test

* Remove newtonsoft from API and related FTs

* LoggingMiddleware add protected blocks to redact
comment out trace from DeadLetterCallback

* Remove trace from  DeadLetterCallback

* Remove dependency on Microsoft.Azure.EventGrid
Remove dependency on Newtonsoft

* Remove reference to Newtonsoft

* Remove comments

* First attempt at uplifting to .NET 8
stub no longer uses startup.cs

* Enable nullable at a global level

* Update Azure.Identity and Microsoft.Identity.Client

* Update all Packages

* address Dereference of possible null reference warning

* Suspend a test assertion in SubscritionControllerTest.cs

* Remove nullable warnings
Fix SubscriptionControllerTest to include CorrelationId

* Set class property default values

* Update NVD
Set Class Properties to default
Resolve other null reference issues

* Fix failed test

* Remove sdk update based on Global entry
FssEventData contained classes instantiated by default
Cache serialization options and ignore some nulls

* Remove  null reference issues

* Added new process methods to reduce the serialization effort

* Comment out methods
Remove null issues
update unit tests for code additions

* Remove Comments and null reference issues
Change Headers.Add to Headers.Append

* Use Headers.Append instead of Headers.Add

* Remove Comments

* This commit includes several updates to improve code readability. Commented out code in `CustomCloudEvent.cs` and `DistributorRequest.cs` has been removed. Method summaries have been added or updated in `FssEventValidationAndMappingService.cs`, `EventProcessorBase.cs`, `AzureEventGridDomainService.cs`, `EventSubscriptionConfiguration.cs`, and `SubscriptionServiceData.cs` to provide additional context and explanation.

* Remove comments and commented code.

* Remove Dotnet 6.0 reference

* Updating NVD Suppression

* Updating NVD Suppressions

* Updating NVD Suppressions

* Update NVD Suppressions

* Checking Terraform staging and stub_service slots .Net version

* Update NVD Suppression

* Update Nuget packages

* Update Nuget packages and NVD suppression

* Update NVD Suppressions

* Update NVD Suppressions

* Update stub packages

* Update NVD Suppressions

* Update NVD Suppression

* Update NVD Suppression

* Update NVD Suppression

* Update NVD Suppressions

* Update NVD Suppression

* Update NVD Suppression

* Update NVD Suppression

* Update Webapp/main.tf to net 8 for staging and stub_webapp_service

* Added clear queue endpoint to stub

* Enhance CI/CD pipeline

This commit improves the CI/CD pipeline by introducing deployment and testing parameters in `app-deploy.yml`, enhancing the build and test pipeline in `build-test-publish.yml`, and deploying SOLAS APIM with configurable options in `deploy-solas-apim.yml`. New parameters and jobs have been added to increase flexibility, control, and configurability of deployments and testing. Additionally, the management of variables has been streamlined with the introduction of `common.yml`, `dev-deploy.yml`, `dev-groups.yml`, `iatvnext-deploy.yml`, and `iatvnext-groups.yml`, focusing on better organization and maintainability.

* Refactor Azure Pipelines for efficiency

This commit overhauls the Azure Pipelines configuration to enhance efficiency and manageability. Key changes include the removal of specific jobs like dependency checking and unit tests in favor of a streamlined approach using templates. A global retention policy was introduced, and a repository resource for shared pipeline templates from `UKHO/devops-pipelinetemplates` was added. The build, test, and publish steps have been consolidated into a single "BuildTestPublish" stage using a `build-test-publish.yml` template, simplifying the pipeline and reducing complexity. Deployment stages for Devdeploy, IATvNextDeploy, E2EvNextDeploy have been restructured to use two templates, significantly cutting down on repetition. New variable group templates for E2E vNext deployments were also added to organize environment-specific variables, further streamlining the pipeline configuration.

* Fix incorrect stage dependencies in Azure pipeline

Corrected the dependency format in `azure-pipelines.yml` for two stages: `Devdeploy` and `E2EvNextDeploy`. Removed extraneous dashes that incorrectly indicated dependencies, ensuring `Devdeploy` correctly depends on `BuildTestPublish` and `E2EvNextDeploy` on `IATvNextDeploy`. This fix ensures proper execution order of pipeline stages.

* Update APM integration and package versions

- Integrated Elastic APM using `Elastic.Apm.NetCoreAll` v1.28.0, simplifying the monitoring setup.
- Replaced `app.UseElasticApm` with `services.AddAllElasticApm` for APM services registration.
- Updated `FluentValidation` to v11.9.2, and several Microsoft packages to v8.0.7 for enhanced security and performance.
- Added `System.Text.Json` v8.0.4 for improved JSON processing capabilities.
- Continued refining application configurations and service registrations, including telemetry and logging, for better performance and maintainability.

* Add CVE suppressions for Elastic/MongoDB pkgs

Added new CVE suppressions to the `NVDSuppressions.xml` file for various Elastic and MongoDB related packages to enhance security measures. These suppressions target specific vulnerabilities in packages such as `Elastic.Apm.Elasticsearch`, `Elastic.Apm.EntityFrameworkCore`, `Elastic.Apm.GrpcClient`, `Elastic.Apm.MongoDb`, `Elastic.Apm.NetCoreAll`, `Elasticsearch.Net`, `MongoDB.Bson`, `MongoDB.Driver.Core`, and `MongoDB.Libmongocrypt`. Each suppression entry includes detailed notes, package URLs with regex patterns, and a list of the CVEs being suppressed, covering a range of years and vulnerability aspects. This proactive approach helps in managing known vulnerabilities effectively, ensuring a robust security posture for applications utilizing these packages.

* Add System.Text.Json v8.0.4 to projects

Added the System.Text.Json package version 8.0.4 to both the UKHO.ExternalNotificationService.API.FunctionalTests and UKHO.ExternalNotificationService.SubscriptionService project files. This update introduces enhanced JSON processing capabilities, supporting new or improved functionalities in both projects.

* Comment out test code in DeadLetterCallbackToD365Test.cs

Temporarily commented out code in DeadLetterCallbackToD365Test.cs
including DateTime initialization, Task.Delay, HTTP request, and
assertions. These changes are made to figure out the correct
response for the callback.

* Update Azure Pipelines and add new variable templates

- Comment out the Devdeploy and IATvNextDeploy stages in azure-pipelines.yml. (For testing)
- Rename IATvNextDeploy to IATDeploy and update its dependencies and conditions.
- Modify parameters in IATDeploy stage.
- Add iat-groups.yml and common.yml variable templates to iat-deploy.yml.
- Create iat-groups.yml with ENS-IAT variable groups.

* Comment out dependsOn in IATDeploy stage

The `dependsOn` section for the `IATDeploy` stage in the `azure-pipelines.yml` file has been commented out. Previously, it was an empty list, indicating no dependencies. Now, it is commented out entirely, effectively removing any dependency configuration for this stage.

* Re-enable Devdeploy, comment out E2EvNextDeploy

The Devdeploy stage has been uncommented and re-enabled. This stage depends on the BuildTestPublish stage and includes a display name "Devdeploy (inc terraform, webapp deploy)".

The E2EvNextDeploy stage has been commented out. This stage previously depended on the IATvNextDeploy stage and included a condition to run only if the build succeeded and the source branch was 'refs/heads/develop'. It also included jobs for deploying using deploy-solas-apim.yml and app-deploy.yml templates with specific parameters.

* change for test

* Merge main hotfixes into develop (#168)

* Use correct variable library for QA (#137)

* Update Azure subscription for deployment (#160)

* Update Azure subscription for deployment

Updated the Azure subscription in `azure-pipelines.yml` from "UKHO-APIM-SOLAS-NonLive" to "UKHO-APIM-SOLAS-Live", shifting deployment to the live environment.

* NVD suppressions

* Abzu-164809 - Add event publish delay configuration (#164)

This commit introduces a new configuration for controlling the delay before publishing events, aiming to enhance the flexibility and reliability of the event processing system. The key changes include:

- Updated `appsettings.json` to include `EventProcessorConfiguration` with a `ScsEventPublishDelayInSeconds` property, initially set to 2, later updated to 10 seconds.
- Modified `ScsEventProcessor.cs` and `ScsEventProcessorTest.cs` to utilize the new configuration, adding necessary `using` directives, a private configuration field, and adjusting the constructor to accept the configuration as a parameter. Also, implemented logic to calculate the delay in milliseconds, ensuring it falls within defined min and max bounds.
- Added `EventProcessorConfiguration.cs` class to define the configuration structure.
- Updated `Startup.cs` to bind the new configuration to the `EventProcessorConfiguration` class, making it available through dependency injection.
- Enhanced testing by adding new test cases in `ScsEventProcessorTest.cs` and `EventProcessorBaseTest.cs` to verify the behavior of the event processor with different configured delays and the successful delay of event publication, respectively.

* Refactor event processing and add JSON package

- Updated `System.Text.Json` package from version '8.0.0' to version `8.0.4` to remove  vulnerabilities in `UKHO.ExternalNotificationService.API.FunctionalTests`, `UKHO.ExternalNotificationService.API`, and `UKHO.ExternalNotificationService.SubscriptionService`.
- Re-introduce the following code, removed due to manual merge correction;
- Initialized `_errors` list in `ScsEventProcessor.cs` to an empty list to avoid null reference exceptions when adding errors.
- Refactored event data processing in `ScsEventProcessor.cs` for improved robustness. This includes changing the method of converting `customCloudEvent` to `CloudEventCandidate<ScsEventData>` and updating the validation and mapping processes to handle non-null `candidate.Data`.

* Refactor event data mapping methods

Updated the `ScsEventProcessorTest.cs` in the `UKHO.ExternalNotificationService.API.UnitTests.Services` namespace to enhance event data mapping and conversion. Replaced `_fakeScsEventValidationAndMappingService.ScsEventDataMapping` with `_fakeScsEventValidationAndMappingService.MapToCloudEvent` for improved event data to cloud event format mapping. Also, switched from `_fakeAzureEventGridDomainService.JsonDeserialize<ScsEventData>` to `_fakeAzureEventGridDomainService.ConvertObjectTo<ScsEventData>` for a more flexible JSON to `ScsEventData` conversion approach.

* Refine assertion in ScsEventProcessorTest

Updated the assertion in a test method within ScsEventProcessorTest.cs to check if `result.Errors` is `Empty` rather than `null`. This adjustment ensures the test accurately verifies the absence of errors, accommodating both null and empty scenarios.

* Refactor code and update package dependencies in `UKHO.ExternalNotificationService.API.FunctionalTests.csproj`

- Removed `Microsoft.Azure.EventGrid.Models` namespace usage from `CustomCloudEvent.cs`, indicating a shift away from the `Microsoft.Azure.EventGrid` package for this file.
- Microsoft.AspNetCore.Mvc.Core ` version `2.2.5` has been deprecated as it is legacy and is no longer maintained. Replaced with Microsoft.AspNetCore.Mvc.Testing version '8.0.7'
- Removed  `Microsoft.Azure.EventGrid` version `3.2.1` , this package is obsolete as of 3/31/2023 and not used.

- Updated `Azure.Storage.Queues` to `12.19.0`
- Updated `Microsoft.Extensions.Configuration.Binder` to `8.0.2`
- Updated `Microsoft.NET.Test.Sdk` to `17.10.0`

* Refactor status code assertions in tests

Updated assertions in `DeadLetterCallbackToD365Test.cs` to enhance readability and type safety by replacing direct integer comparisons with `HttpStatusCode.OK` enum comparisons. This change affects two sections within the `UKHO.ExternalNotificationService.API.FunctionalTests.FunctionalTests` namespace, making the code more maintainable and the intent clearer. Original assertions are commented out for reference, marked with `// rhz`.

* attempting to get more info for test failure

* Looking into test failure

* Testing failing test

* Temporarily disable parts of DeadLetterCallbackToD365Test

Commented out initialization, HTTP request, deserialization, and assertions in DeadLetterCallbackToD365Test.cs. These changes are intended to temporarily disable certain parts of the test until they can be fixed, as indicated by the comment `// rhz - Disabled until the test is fixed.`.

* Clarify reason for disabled test in DeadLetterCallbackToD365Test

Updated the comment for the disabled HTTP request and response
validation test in DeadLetterCallbackToD365Test.cs. The new
comment explains that the code is removed until the correct
response can be determined, replacing the previous comment
which suggested a temporary disablement. The actual commented-
out code remains unchanged.

---------

Co-authored-by: HugoBurgess <[email protected]>
Co-authored-by: JiviteshT <[email protected]>

* Add "iat" environment with PremiumV3 configuration

Added a new environment suffix "iat" with the value "IAT" to the `env_suffix_text` variable in `variables.tf`. Also, added a new configuration for the "iat" environment to the `app_service_sku` variable, specifying the tier as "PremiumV3" and the size as "P1v3".

* Disable solas-apim deployment in pipeline

Commented out the solas-apim deployment template and its parameters in the azure-pipelines.yml file. This change skips or disables the deployment process for solas-apim while keeping the rest of the pipeline configuration, including the app-deploy.yml template, unchanged.

* Remove dependency in app-deploy.yml

Commented out the `dependsOn` section in `app-deploy.yml`, removing the explicit dependency on `${{ upper(parameters.ShortName) }}DeployApimSolas` for the deployment job.

* Update deployment dependencies and include APIM template

The changes in `app-deploy.yml` ensure that the deployment job now explicitly depends on the `${{ upper(parameters.ShortName) }}DeployApimSolas` job, which was previously commented out.

The changes in `azure-pipelines.yml` ensure that the `deploy-solas-apim.yml` template is now included in the pipeline with the necessary parameters, which were previously commented out.

* Temporarily disable APIM deployment steps

Commented out the `dependsOn` sections and the deployment of the `deploy-solas-apim.yml` template in both `app-deploy.yml` and `azure-pipelines.yml`. This removes the dependency on the `DeployApimSolas` job and the `deploy-solas-apim.yml` template from the pipeline execution for debugging or testing purposes.

* Re-enable Solas APIM deployment in pipeline

Uncommented and formatted the `deploy-solas-apim.yml` template to re-enable the deployment of Solas APIM using the specified parameters. This change ensures that the Solas APIM deployment process is now active and will be executed as part of the pipeline.

* Remove APIM import blocks and related local variables

This commit removes the Terraform configuration for importing an existing Azure API Management (APIM) instance. Specifically, it eliminates the `data "azurerm_api_management" "apim_instance"` block, the `locals` block defining naming conventions, and multiple `import` blocks for various APIM resources. These changes suggest a significant refactor or cleanup, possibly due to a new infrastructure setup or the import process no longer being necessary. The initial import process was used for a one-time migration of APIMs from TPE to UKHO tenants, which is now obsolete.

* Uncomment and modify dependsOn in app-deploy.yml

The dependsOn section in the app-deploy.yml file was uncommented and updated to depend on ${{ upper(parameters.ShortName) }}DeployApimSolas. This ensures the deployment job runs only after the specified job completes.

* Re-enable Devdeploy stage and update dependencies

The `azure-pipelines.yml` file has been updated to re-enable the `Devdeploy` stage, which was previously commented out. This stage includes deploying with Terraform and web app deployment.

The `Devdeploy` stage now depends on the `BuildTestPublish` stage and includes two job templates: `deploy-solas-apim.yml` and `app-deploy.yml`. Parameters for these templates have been specified, such as `ContinueEvenIfResourcesAreGettingDestroyed`, `AzureEnvironment`, `ShortName`, `Container`, `ApimShortName`, `AzureSubscriptionVersion`, and `RunFunctionalTests`.

Additionally, the `IATDeploy` stage has been updated to depend on the `DevDeploy` stage. The condition for this stage to run has been uncommented, ensuring it only runs if the build succeeds and the source branch is either `refs/heads/develop` or starts with `refs/heads/dev/`.

* Update IATDeploy stage dependency in azure-pipelines.yml

Modified the IATDeploy stage in azure-pipelines.yml to explicitly
depend on the DevDeploy stage. This ensures that IATDeploy will
only run after DevDeploy has successfully completed.

* Refactor deployment stages and update dependencies

- Commented out the `Devdeploy` stage, disabling it.
- Added `IATvNextDeploy` stage with conditions for `develop` and `dev/*` branches.
- Updated `IATDeploy` stage to depend on `IATvNextDeploy` instead of `DevDeploy`.

* Comment out IATvNextDeploy stage and its dependencies

The `IATvNextDeploy` stage has been commented out, including its
dependencies, display name, condition, and jobs. Additionally,
the `IATDeploy` stage has had its dependency on `IATvNextDeploy`
and its condition commented out.

* Add "pre" environment and PreProd deployment stage

Added a new "pre" environment to `variables.tf` with specific configurations for the "PremiumV3" tier and "P1v3" size. Introduced a "PreProdDeploy" stage in `azure-pipelines.yml` for deploying APIM and the web app under certain conditions. Added variable templates in `preprod-deploy.yml` and created `preprod-groups.yml` to define variable groups for the "ENS-PreProd" environment.

* Refactor preprod configs and update pipeline parameters

Removed variable templates from preprod-deploy.yml.
Removed variable groups from preprod-groups.yml.
Updated AzureEnvironment, ShortName, and AzureSubscriptionVersion in azure-pipelines.yml.
Created pre-deploy.yml with variable templates from pre-groups.yml and common.yml.
Created pre-groups.yml with variable groups from preprod-groups.yml.

* Standardize AzureSubscriptionVersion format in pipeline

The `AzureSubscriptionVersion` parameter value in the `azure-pipelines.yml` file was modified. The previous value `"Pre - A.011.08"` was changed to `"PRE- A.011.08"`. This change standardizes the casing and spacing of the version string.

* Comment out IATDeploy stage and update dependencies

The IATDeploy stage has been commented out in the azure-pipelines.yml
file, including all its dependencies, display name, conditions, and
job templates. Additionally, the QAdeploy stage now depends on the
PreProdDeploy stage instead of the IATDeploy stage.

* Change WEBSITE_RUN_FROM_PACKAGE to "0" in main.tf

Updated the WEBSITE_RUN_FROM_PACKAGE setting in the webapp_service
module from "1" to "0" in two places within the main.tf file. This
change ensures that the web app will not run from a package file.

* Uncomment and format IATDeploy stage in pipeline

The IATDeploy stage in the azure-pipelines.yml file, which was previously commented out, has been uncommented and properly formatted. This stage includes deployment templates and parameters necessary for the deployment process. The PreProdDeploy stage remains unchanged.

* Enable WEBSITE_RUN_FROM_PACKAGE in main.tf

Updated the `WEBSITE_RUN_FROM_PACKAGE` setting back to `"1"`
in the `webapp_service` module within the `main.tf` file.

* Comment out IATDeploy stage in azure-pipelines.yml

The IATDeploy stage, including deployment steps for both
deploy-solas-apim.yml and app-deploy.yml templates, has been
commented out. This disables the IATDeploy stage from executing
in the pipeline.

* Update task display names and remove Azure subscription name

The display name for the "File Transform" task now includes the
environment variable `$(Environment)`. The display name for the
"terraform deploy" task has been corrected to include a space
between `$(Environment)` and `deploy`.

* Uncomment and format IATDeploy stage in pipeline

The `IATDeploy` stage in `azure-pipelines.yml` has been uncommented and properly formatted. This stage includes deployment templates (`deploy-solas-apim.yml` and `app-deploy.yml`) and their respective parameters. The `PreProdDeploy` stage remains unchanged.

* Remove AzureWebJobHealthCheck from health checks

Commented out and removed AzureWebJobHealthCheck from Startup.cs.
AzureMessageQueueHealthCheck remains active.

* Update health checks in Startup.cs

Re-added AzureMessageQueueHealthCheck and uncommented AzureWebJobHealthCheck in Startup.cs to enhance application monitoring.

* Re-enable pipeline stages and add new parameter

Re-enabled `Devdeploy`, `IATvNextDeploy`, and `E2EvNextDeploy` stages in the Azure Pipelines YAML configuration. Introduced a new boolean parameter `TestIatandPreProd` to control the execution of `IATDeploy` and `PreProdDeploy` stages. Updated dependencies for `IATDeploy`, `PreProdDeploy`, and `QAdeploy` stages to ensure correct execution order.

* Reintroduce PreProdDeploy stage with new configuration

- Reintroduced `PreProdDeploy` stage with a condition to check if `TestIatandPreProd` is true.

- Commented out the previously defined `PreProdDeploy` stage.
- Modified `IATvNextDeploy` stage's condition to check if `TestIatandPreProd` is false instead of the branch name.

* Re-add PreProdDeploy stage and update conditions

Re-added the PreProdDeploy stage to azure-pipelines.ym in correct order
Modified Devdeploy stage to run only when TestIatandPreProd is false.

* Update pipeline configs and simplify stage conditions

- Updated `deploy-solas-apim.yml` to remove commented-out environment value and dynamically set `environment` using `${{ parameters.AzureEnvironment }}`.
- Removed `TestIatandPreProd` parameter from `azure-pipelines.yml`.
- Simplified `Devdeploy` stage condition by removing dependency on `TestIatandPreProd` parameter.
- Updated `IATDeploy`, `PreProdDeploy`, and `IATvNextDeploy` stage conditions to always run for the `develop` branch or branches starting with `dev/`, removing dependency on `TestIatandPreProd` parameter.

* Update deployment stage conditions

Modified the `IATDeploy` stage condition to run if the build succeeded and the source branch is not `refs/heads/develop` and does not start with `refs/heads/dev/`.

Updated the `PreProdDeploy` stage condition to run if the build succeeded and the source branch is either `refs/heads/main` or starts with `refs/heads/release/`.

* Restrict IATDeploy stage to 'main' branch in pipeline

The condition for the `IATDeploy` stage in the `azure-pipelines.yml` file has been updated. The stage now runs only if the build succeeds and the source branch is 'main' or does not start with 'dev/'. This change ensures more controlled deployments, limiting them to the main branch or specific branches that do not start with 'dev/'.

* Update IATDeploy condition in azure-pipelines.yml

Replaced `!startsWith` with `not` for better readability and consistency.
The new condition is: `and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dev/'))))`.

* Remove commented branch conditions from deploy stages in pipeline

* Update for old APIM removal

* Update package versions in project file

Updated the following package references in `UKHO.ExternalNotificationService.API.csproj`:
- `Azure.Identity` from `1.12.1` to `1.13.1`
- `Azure.Security.KeyVault.Secrets` from `4.6.0` to `4.7.0`
- `Elastic.Apm.NetCoreAll` from `1.28.0` to `1.30.0`
- `Microsoft.Identity.Client` from `4.66.1` to `4.66.2`

* Add xmlTransformationRules to FileTransform@2 tasks

Updated continuous-deployment.yml, functional-test-process.yml,
and azure-pipelines.yml to include the xmlTransformationRules
parameter with an empty string value ('') in all instances of
the FileTransform@2 task. This ensures XML transformation rules
are explicitly set to an empty value, even when enableXmlTransform
is set to false, targeting appsettings.json files in various
directories and zip files.

* Add task to copy OpenAPI spec in build pipeline

A new task has been added to the build-test-publish.yml file to copy the OpenAPI specification for the ENS Monitor. This task uses the `CopyFiles@2` task to copy the `external-notification-service-monitor.openApi.yaml` file from the source directory to the target directory specified. The display name for this task is "Copy OpenAPI spec for deployment (ENS Monitor)".

* Remove comment

* Correct error after merge from main

* Further fix from merge from main

* Package updates

* Update NVD suppressions

* Update IAT rule

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: HugoBurgess <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: HugoBurgess <[email protected]>
Co-authored-by: JiviteshT <[email protected]>
Co-authored-by: onesixtyfourth <[email protected]>
  • Loading branch information
8 people authored Nov 27, 2024
1 parent 6a57987 commit bd0ff0c
Show file tree
Hide file tree
Showing 30 changed files with 732 additions and 470 deletions.
2 changes: 2 additions & 0 deletions Deployment/src/APIM/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ variable "env_suffix_text" {
"live" = " "
"vne" = "VNE"
"vni" = "VNI"
"iat" = "IAT"
"pre" = "PRE"
}
}

Expand Down
8 changes: 8 additions & 0 deletions Deployment/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ variable "app_service_sku" {
tier = "PremiumV3"
size = "P1v3"
}
"iat" = {
tier = "PremiumV3"
size = "P1v3"
}
"pre" = {
tier = "PremiumV3"
size = "P1v3"
}
}
}

Expand Down
69 changes: 69 additions & 0 deletions Deployment/templates/app-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
parameters:
# If set to true, the pipeline will continue even if resources are getting destroyed. Default is false.
- name: ContinueEvenIfResourcesAreGettingDestroyed
type: boolean
# The name of the environment to be used in Azure DevOps.
- name: AzureEnvironment
type: string
# The name of the Terraform workspace to use. Will also be used to generate job names and, in lower case, used to select the correct var/x-deploy.yml variable file.
- name: ShortName
type: string
# The apim short name
- name: ApimShortName
type: string
# The Terraform Azure PowerShell container.
- name: Container
type: string
# The Azure Subscription version
- name: AzureSubscriptionVersion
type: string
# Run functional tests.
- name: RunFunctionalTests
type: boolean
default: false

jobs:
- deployment: ${{ upper(parameters.ShortName) }}DeployApp
displayName: "${{ upper(parameters.ShortName) }} - deploy terraform and dotnet App"
environment: ${{ parameters.AzureEnvironment }}
pool: $(DeploymentPool)
container: ${{parameters.Container}}
workspace:
clean: all
variables:
- template: var/${{ lower(parameters.ShortName) }}-deploy.yml

strategy:
runOnce:
deploy:
steps:
- template: /Deployment/templates/continuous-deployment.yml
parameters:
ContinueEvenIfResourcesAreGettingDestroyed: ${{ parameters.ContinueEvenIfResourcesAreGettingDestroyed }}
AzureSubscription: External Notification Service ${{ parameters.AzureSubscriptionVersion }}

- template: /Deployment/templates/continuous-deployment-apim.yml
parameters:
ContinueEvenIfResourcesAreGettingDestroyed: ${{ parameters.ContinueEvenIfResourcesAreGettingDestroyed }}
AzureSubscription: UKHO-APIM-SOLAS-${{ parameters.ApimShortName }}
TerraformKeyVault: $(APIM_TERRAFORM_KEYVAULT)
APIMResourceGroup: $(APIM_RESOURCE_GROUP_NAME)
APIMServiceInstance: $(APIM_SERVICE_NAME)
tfstateStorageAccountName: $(APIM_TFSTATE_STORAGE_ACCOUNT_NAME)

- ${{ if eq(parameters.RunFunctionalTests, true) }}:
- template: /Deployment/templates/functional-test-process.yml
parameters:
TestTitle: "Dev-AutomationTests"

- ${{ if eq(parameters.RunFunctionalTests, true) }}:
- task: AzureCLI@2
displayName: "Swap Stub URL"
condition: always()
inputs:
azureSubscription: External Notification Service ${{ parameters.AzureSubscriptionVersion }}
scriptType: 'pscore'
scriptLocation: 'scriptPath'
scriptPath: '$(Pipeline.Workspace)/terraformartifact/set_stub_url.ps1'
arguments: '-d365uri $(D365EnvApiUri) -resourceGroup $(ResourceGroup) -webappName $(WEB_APP_NAME)'

296 changes: 296 additions & 0 deletions Deployment/templates/build-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
parameters:
# Disable the NVD dependency check job.
- name: DisableDependencyCheck
type: boolean
default: false

- name: DotNetVersion
type: string
default: '8.0.x'

jobs:
- job: Dependencychecker
condition: eq('${{ parameters.DisableDependencyCheck }}', false)
workspace:
clean: all
displayName: "Dependencychecker"
steps:
- task: UseDotNet@2
displayName: 'Use .NET ${{ parameters.DotNetVersion }} sdk'
inputs:
packageType: sdk
version: '${{ parameters.DotNetVersion }}'
workingDirectory: '$(Build.SourcesDirectory)'
- task: DotNetCoreCLI@2
displayName: ".Net Core - NuGet restore non test projects only"
inputs:
command: "restore"
projects: |
**/*.csproj
!**/*Tests.csproj
feedsToUse: config
noCache: true
nugetConfigPath: '$(Build.SourcesDirectory)\BuildNuget.config'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API'
packagesDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API\packages'

- task: CmdLine@1
displayName: "Run OWASP Dependency Checker"
inputs:
filename: 'dependency-check.bat'
arguments: '--project "External-Notification-Service - $(Build.SourceBranchName)" --scan "$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API" --out "$(Build.ArtifactStagingDirectory)\DCReport" --suppression $(Build.SourcesDirectory)\NVDSuppressions.xml --noupdate'

- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: OWASP Dependency Checker Report"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\DCReport'
ArtifactName: "OWASP Dependency Checker Report"

- task: PowerShell@1
displayName: "Fail Build if Dependency Check Finds Any Vulnerabilities"
inputs:
scriptType: inlineScript
arguments: '-ReportLocation $(Build.ArtifactStagingDirectory)\DCReport\*'
inlineScript: |
param($ReportLocation)
Invoke-VulnerabilityCheck -ReportLocation $ReportLocation
- job: UnitTestsAndCodeCoverage
workspace:
clean: all
displayName: "Dotnet Test and Publish Code Coverage"
steps:
- task: UseDotNet@2
displayName: Use .NET ${{ parameters.DotNetVersion }} sdk
inputs:
packageType: sdk
version: '${{ parameters.DotNetVersion }}'
workingDirectory: '$(Build.SourcesDirectory)'

- task: DotNetCoreCLI@2
displayName: ".Net Core - NuGet restore test projects only"
inputs:
command: "restore"
projects: "**/*Tests.csproj"
feedsToUse: config
noCache: true
nugetConfigPath: '$(Build.SourcesDirectory)\BuildNuget.config'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API'
packagesDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API\packagesForTests'

- task: DotNetCoreCLI@2
displayName: "dotnet test - Perform Unit Tests"
inputs:
command: "test"
projects: "**/*UnitTests.csproj"
arguments: '--configuration $(BuildConfiguration) --settings "$(Build.SourcesDirectory)\test.runsettings" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
publishTestResults: true
testRunTitle: "UnitTests"

- task: PowerShell@2
displayName: "Generate code coverage report"
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)\CodeCoverageReport.ps1'
arguments: '-source "$(Build.SourcesDirectory)" -reportFolder "$(Build.ArtifactStagingDirectory)"'

- task: PublishBuildArtifacts@1
displayName: "Publish Code coverage"
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)/codecoveragereport"
ArtifactName: codecoveragereport

- job: BuildAndPublishAPI
workspace:
clean: all
displayName: "Dotnet Build publish API"
steps:
- task: PowerShell@2
displayName: "Set assembly version numbers based on build ID"
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)\Apply-AssemblyVersionAndDefaults.ps1'
arguments: '-buildNumber "$(Build.BuildNumber)" -solutionDirectory "$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API\" -UKHOAssemblyCompany "$env:UKHOAssemblyCompany" -UKHOAssemblyCopyright "$(UKHOAssemblyCopyright)" -UKHOAssemblyVersionPrefix "$env:UKHOAssemblyVersionPrefix" -UKHOAssemblyProduct "$env:UKHOAssemblyProduct"'

- task: UseDotNet@2
displayName: Use .NET ${{ parameters.DotNetVersion }} sdk
inputs:
packageType: sdk
version: '${{ parameters.DotNetVersion }}'
workingDirectory: '$(Build.SourcesDirectory)'

- task: DotNetCoreCLI@2
displayName: ".Net Core - NuGet restore"
inputs:
command: restore
projects: |
**/*.csproj
feedsToUse: config
noCache: true
nugetConfigPath: '$(Build.SourcesDirectory)\BuildNuget.config'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API'

- task: DotNetCoreCLI@2
displayName: "dotnet build task"
inputs:
command: "build"
projects: "**/*.csproj"
arguments: '--configuration $(BuildConfiguration) --output $(Build.BinariesDirectory)'

- task: DotNetCoreCLI@2
displayName: "Publish WebAPI"
inputs:
command: "publish"
publishWebProjects: false
projects: '**/*UKHO.ExternalNotificationService.API.csproj'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)\ExternalNotificationServiceWebAPI'
zipAfterPublish: false
modifyOutputPath: false

- task: DotNetCoreCLI@2
displayName: "Publish SubscriptionServiceWebJob Code"
inputs:
command: "publish"
publishWebProjects: false
projects: "**/*UKHO.ExternalNotificationService.SubscriptionService.csproj"
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)\ExternalNotificationServiceWebAPI\App_Data\jobs\continuous\SubscriptionServiceWebJob'
zipAfterPublish: false
modifyOutputPath: false

- task: ArchiveFiles@2
displayName: "Zip ENS service"
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\ExternalNotificationServiceWebAPI\'
includeRootFolder: false
archiveType: "zip"
archiveFile: '$(Build.ArtifactStagingDirectory)\ExternalNotificationServiceWebAPI\UKHO.ExternalNotificationService.API.zip'
replaceExistingArchive: true

- task: PublishBuildArtifacts@1
displayName: "Publish WebAPI Artifact"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\ExternalNotificationServiceWebAPI\UKHO.ExternalNotificationService.API.zip'
ArtifactName: ExternalNotificationService

- job: PublishFunctionalTestsAndTerraform
workspace:
clean: all
displayName: "Publish Functional Tests And Terraform"
steps:
- task: UseDotNet@2
displayName: Use .NET ${{ parameters.DotNetVersion }} sdk
inputs:
packageType: sdk
version: '${{ parameters.DotNetVersion }}'
workingDirectory: '$(Build.SourcesDirectory)'

- task: DotNetCoreCLI@2
displayName: ".Net Core - NuGet restore"
inputs:
command: restore
projects: |
**/*.csproj
feedsToUse: config
noCache: true
nugetConfigPath: '$(Build.SourcesDirectory)\BuildNuget.config'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API'

- task: DotNetCoreCLI@2
displayName: "Publish functional test"
inputs:
command: "publish"
publishWebProjects: false
projects: "**/*UKHO.ExternalNotificationService.API.FunctionalTests.csproj"
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)\UKHO.ExternalNotificationService.API.FunctionalTests'
zipAfterPublish: false

- task: PublishBuildArtifacts@1
displayName: "Publish Functional test Artifact"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\UKHO.ExternalNotificationService.API.FunctionalTests'
ArtifactName: functionaltests

- task: CopyFiles@2
displayName: Copy ExternalNotificationService Config
inputs:
SourceFolder: '$(Build.SourcesDirectory)\UKHO.ExternalNotificationService.API\UKHO.ExternalNotificationService.API\'
Contents: 'appsettings.json'
TargetFolder: '$(Build.SourcesDirectory)\Deployment\src'

- task: CopyFiles@2
displayName: "Copy OpenAPI spec for deployment"
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: 'external-notification-service.openApi.yaml'
TargetFolder: '$(Build.SourcesDirectory)\Deployment\src\APIM'

- task: CopyFiles@2
displayName: "Copy OpenAPI spec for deployment (ENS Monitor)"
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: 'external-notification-service-monitor.openApi.yaml'
TargetFolder: '$(Build.SourcesDirectory)\Deployment\src\APIM'

- task: PublishBuildArtifacts@1
displayName: "Publish terraform Artifacts"
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\Deployment'
ArtifactName: terraformartifact

- job: BuildAndPublishStubAPIAndTerraform
workspace:
clean: all
displayName: "Build and Publish Stub API And Terraform"
steps:
- task: PowerShell@2
displayName: "Set assembly version numbers based on build ID"
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)\Apply-AssemblyVersionAndDefaults.ps1'
arguments: '-buildNumber "$(Build.BuildNumber)" -solutionDirectory "$(Build.SourcesDirectory)\UKHO.D365CallbackDistributorStub.API\" -UKHOAssemblyCompany "$env:UKHOAssemblyCompany" -UKHOAssemblyCopyright "$(UKHOAssemblyCopyright)" -UKHOAssemblyVersionPrefix "$env:UKHOAssemblyVersionPrefix" -UKHOAssemblyProduct "$(UKHOAssemblyProduct) Stub"'

- task: UseDotNet@2
displayName: Use .NET ${{ parameters.DotNetVersion }} sdk
inputs:
packageType: sdk
version: '${{ parameters.DotNetVersion }}'
workingDirectory: '$(Build.SourcesDirectory)'

- task: DotNetCoreCLI@2
displayName: ".Net Core - NuGet restore"
inputs:
command: restore
projects: |
**/*.csproj
feedsToUse: config
noCache: true
nugetConfigPath: '$(Build.SourcesDirectory)\BuildNuget.config'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.D365CallbackDistributorStub.API'

- task: DotNetCoreCLI@2
displayName: "dotnet build task"
inputs:
command: "build"
projects: "**/*UKHO.D365CallbackDistributorStub.API.csproj"
arguments: '--configuration $(BuildConfiguration) --output $(Build.BinariesDirectory)'
workingDirectory: '$(Build.SourcesDirectory)\UKHO.D365CallbackDistributorStub.API'

- task: DotNetCoreCLI@2
displayName: "Publish StubWebAPI"
inputs:
command: "publish"
publishWebProjects: false
projects: '**/*UKHO.D365CallbackDistributorStub.API.csproj'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)\StubWebAPI'
zipAfterPublish: true
modifyOutputPath: true

- task: PublishBuildArtifacts@1
displayName: "Publish Stub WebAPI Artifact"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\StubWebAPI'
ArtifactName: StubWebAPI




Loading

0 comments on commit bd0ff0c

Please sign in to comment.