Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Sync Things Job #2171

Closed
wants to merge 78 commits into from

Conversation

delager
Copy link
Contributor

@delager delager commented Jun 6, 2023

Description

What's new?

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

delager and others added 30 commits March 22, 2023 19:32
* #1793 Add AmazonIoTClient and AmazonIotDataClient configurations

- Add "CloudProvider" in configuration
- Add AmazonIoTClient and AmazonIotDataClient configurations when CloudProvider is AWS

* Update src/AzureIoTHub.Portal.Server/Startup.cs

Add OrdinalIgnoreCase string comparison for CloudProvider

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* Update src/AzureIoTHub.Portal.Server/Startup.cs

- Local variables camelCased
- Keep asynchronous
- Let the DI container build instances when it is called

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* #1793 update src\AzureIoTHub.Portal.Server\Startup.cs missing reference

- Missing reference

* #1793 Add CloudProvider for E2E tests

Add CloudProvider config for E2E tests
Add Azure in the current test pipeline (a new AWS test pipeline will be created in the next feature)

---------

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
…ider (#1972)

* #1925 & #1928 Specific config handler and throw error if no CloudProvider

- Add AWS & Azure specific config handlers
- Add AWSS3Storage configuration
- Throw exception if CloudProvider undefined or unknown

* #1925

- Missing TU for AWSS3StorageConnectionString in DevConfig

* #1925 Null reference

- Add ! for null reference possible
* #1929 Configuration logic by provider

- Add CloudProvider dependencies to the Server Startup
- Add CloudProvider dependencies to the Infrastructure Startup
- Azure first in the switch to unify

* #1929 Healthcheck config

- Move common healthcheck configuration

* #1929 Move AWS Client

- Move AWS client singletons into the infrastructure Layer
* #1942 Add CI for CloudFormation scripts

- Add new CI for AWS CloudFormation scripts
- Add label 'cfn-templates' on PR
- Add syntax checking of cfn scripts using scottbrenner/cfn-lint-action

* #1942 Remove schedule

No schedule needed for this workflow

* #1942 Add main branche

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

---------

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
With path option not possible with scottbrenner/cfn-lint-action@v2
Using with command instead
* #1943 Add AWS Deployment

- Add AWS Deployment
- Add AWS information in the different sections

* #1943 Update README.md

* #1943 CloudProvider choice

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* #1943 Quick Start update

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* #1943 Configure environment

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* #1943 Start using

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

* #1943 Quick start update

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>

---------

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
…ces images (#2032)

* AWS S3 store & expose device images

* s3 storage image + some unit testing

* #1935 code + tests

* #1935 code + tests

* AWS image cache control

* removing usersecret
… Runner (#1987)

* CloudFormation script initialization

* CloudFormation => PostgreSQL database & S3 storage

* CloudFormation(Draft) => PostgreSQL database & AWS S3 storage

* CloudFormation => some changes in AWS S3 storage & PostgreSQL database

* CloudFormation => AWS EC2 template

* CIDR IP adress putted as a param

* App Runner initialized

* CloudFormation => AppRunner service

* CloudFormation => AppRunner service => Add CLoudProvider

* S3 Storage and Database deployment tested

* Deploy pblm => error in assuming instance role

* AWS access key hided

* merge templates in one

* add secret Manager for the RuntimeEnvironmentSecrets

* instanceRoleArn pblm

* instanceRoleArn pblm

* instanceRoleArn pblm

* #1940 Update CloudFormation script

- Image retrieve from private registry
- Add the cloudformation.amazonaws.com service in the role

* #1940 Cloudformation script

- Add instance role
- Update Secret Manager

* #1940 CloudFormation script

- Multiple SecretsManager for environment variables
- PublicAccessBlockConfiguration for s3 Bucket
- Correct ImageIdentifier

* #1940 CloudFormation script

- Unique DBSubnetGroupName

* #1940 CloudFormation script

- Missing AuthenticationConfiguration

* #1940 CloudFormation script

- Give access to all UniqueSolutionPrefix-* secrets manager

* Add ACL public Read to allow publicRead device images

* Policy removed

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
Co-authored-by: delager <raphael.delage@cgi.com>
Co-authored-by: DELAGE Raphaël <36408929+delager@users.noreply.github.com>
* create Thing Type table

* PostgreSQL DB migration

* Model + Repo + Service Think Type

* Remove Gneric Thing Type

* Test API Done

* Testing ThingType Service (DONE)

* Create Thing Type Controller tested

* some changes in the Cloud Provider

* Add Thing Type Button OK

* Adapt CreateDeviceModelTests with Azure cloud Provider

* #1802 DONE without adding Migration Files

* #1802 DONE with Migration Files Added

* #1802 Correct COnflict Problem

* #1802 PG Migration new class

* create Thing Type table

* PostgreSQL DB migration

* Model + Repo + Service Think Type

* Remove Gneric Thing Type

* Test API Done

* Testing ThingType Service (DONE)

* Create Thing Type Controller tested

* some changes in the Cloud Provider

* Add Thing Type Button OK

* Adapt CreateDeviceModelTests with Azure cloud Provider

* #1802 DONE without adding Migration Files

* correcting Migration Pblm

* correcting conflicts & bugs in Migration files

* Update AWSImageManager

* Fix formatting

* Fix Build Problems

* Fixes on the PR

* change tag dictionary to tag DTO

* Add Copyright CGI

* remove unsused variables

* Using AWS ThingTypeID for my DB

* handle image in Thing type creation

* handle Thing Type image

* uploading avatar in Thing Type (DONE)

* adding test for InsertAndGetIdAsync function

* adding some tests for test cov
* getThingType created in Service

* getThingType created in Service

* listing thing types (Backend)

* fix test problems

* Listing Thing Type With pagination (Code + Tests=

* Get Thing Type And Deprecate Thing Type (Backend OK)

* Deprecate Thing Type Back & Front (Not tested yet)

* DONE. Some other tests to DO

* some tests added for the coverage

* some tests added for the coverage

* some new tests added for the coverage
* merge

* Sync Thing Type Job Task started

* sync Thing Type JOb (Test => TODO)

* Remove unecessary migrations

* Synchronize AWS Thing types DONE (wait for testing)

* Synchronize AWS Thing types (test failed)

* Update unit tests

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
* Add cd pipeline to build and deploy to aws app runner

* Fix ci

* Add env AWS_DEFAULT_REGION

* Configure AWS credentials to region us-east-1

* Update aws cd

* Update aws cd

* Update image tag name

* Comment Access role ARN

* Revert "Comment Access role ARN"

This reverts commit 8b7a3b01ecc7c3801c9190f4742567d11e443cb6.

* Change AWS authentication region during login

* use us-east-1 region to push to ECR

* Update CI

* Add variables to CD

* Update .github/workflows/aws_deploy_staging.yml

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
* Remove thing types entities

* Remove thing types repositories

* Remove thing types repositories interfaces

* Remove InsertAngGetIdAsync

* Add repos DeviceModelRepository and LabelRepository on uof

* Add AWS external service to manage aws iot

* Remove aws automappers

* Remove ThingTypeService

* Add AwsDeviceModelService

* Remove Aws thing type controller

* Update SyncThingTypesJob

* Add ef migration to remove thing types entities

* Update device model base controller to return device model dto on create

* Revert DeviceModelSearch component

* Revert DeviceModel pages

* Remove Thing Type client service

* Remove thing type validator

* Remove references to thing type client service

* Update CreateDeviceModel method

* Update unit tests after deletion of thing types references

* Add delete labels before delete device model on aws device model service

* Fix code scan warning on test Execute_SyncNewAndExistingAndDepprecatedThingTypes_DeviceModelsSynced

* Add unit tests on AwsDeviceModelService

* Update unit test SaveAsyncTest

* Update exceptions on AwsExternalDeviceService

* Fix unit test name

* Add unit tests on AwsExternalDeviceService

* Remove unused declaration on test CreateDeviceModel_ExistingThingType_ResourceAlreadyExistsExceptionIsThrown

* Remove IExternalDeviceServiceV2

* Move IExternalDeviceServiceV2 methods to IExternalDeviceService

* Implement IExternalDeviceService

* Update AwsDeviceModelService to use IExternalDeviceService

* Update unit tests on aws to use IExternalDeviceService

* Remove repositories from UnitOfWork

* Revert unit tests on UnitOfWorkTests

* Add unit tests on ExternalDeviceServiceTests
kbeaugrand and others added 28 commits June 1, 2023 15:15
* #1924 : Sync Things Device

- Sync Things Job
- Add Job Quartz
- TU Sync Things Job

* #1924 Sync Iot Things

- Fix for deletion at sync
- Remove unused references

* #1924 Fix TU

* #1924 Fix code scan missed opportunity to use Select

* #1924 Add TU and update log message type

* #1924 Amazon Exception Handling

* #1924 Fix Throw Exception
* Get AWS iot Edge Device

* Get AWS iot Edge Device

* Get AWS Edge Device Done

* use the act varaiable
* Fix code

* Use DeviceName for certificates

* Display certificates credentials on ConnectionStringDialog

* Add on edge device screen and allow file download

* Fix unit tests

---------

Co-authored-by: ropiteauxi <ivan.ropiteaux@cgi.com>
Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
* detach associated certificate in thing

* detach associated certificate in thing

* adding some tests
* Add edge module id to store greengrass public components

* Add GetPublicEdgeModules

* Add dialogs for aws json component + public components

* Update create and edit edge model pages to handle aws greengrass components

* Update GetPublicEdgeModules to load all public greengrass components + fix loading public component

* Update aws greengrass dialogs

* Fi edge model create/edit pages to handle public and private edge modules (aws components)

* Remove dead code from AwsConfigService

* Fix class AwsConfigService after rebase

* Fix #2145 - Move Savechanges at last step of CRUD in edge model service

* Fix duplication issue after selecting public components

* Fix unit tests

* Fix deployment model synchronization

* Fix Edgedevice load and update

* Add unit tests on GetPublicEdgeModules

* Fix codeql warning on CreateEdgeModelShouldThrowInternalServerErrorExceptionIfDbUpdateExceptionOccurs

* Rename AwsGreengrassPublicComponents to AwsGreengrassPublicComponentsDialog

* Add unit tests on AwsGreengrassComponentDialog and AwsGreengrassPublicComponentsDialog

* Add UT GetPublicEdgeModules_GetPublicEdgeModules_EdgeModulesReturned

* Add UT GetPublicEdgeModules_GetPublicEdgeModules_EdgeModulesReturned on EdgeModelService

* Add UT GetPublicEdgeModules_GetPublicEdgeModules_EdgeModulesReturned on EdgeModelClientService

* Add unit tests on EdgeModelDetailPage and CreateEdgeModelsPage on add edge module and public edge modules

* Fix codeql warning

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
* Hide certificates when getting the magic ommand

* Prefix Azure specific parameters

* Prefix Azure specific parameters

* fix test

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
* #2075 Sync AWS IoT Edge Device

- Sync AWS IoT Edge Device
- TU sync IoT Edge Device
- GetByName async for DeviceModel and EdgeDeviceModel

* #2075 Add GetByNameAsync TU

* #2075 Add greengras devices job to quartz

* #2075 Fix GetByNameAsync

* #2075 Add EdgeDevice properties

- NbModules / NbDevices / ConnectionState
- 1 job Sync things job => update device & edgedevice based on thingtype (iotEdge or not)
- Remove Sync GreenGrass Devices
- Update the job thingtype for isEdge method
@delager delager linked an issue Jun 6, 2023 that may be closed by this pull request
@delager delager closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: Refactoring Sync Thing & ThingType Job Bug: Edge device disappear from portal
5 participants