Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix export comparison #3567

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@
<HealthcareSharedPackageVersion>7.0.29</HealthcareSharedPackageVersion>
<Hl7FhirVersion>4.3.0</Hl7FhirVersion>
</PropertyGroup>

<ItemGroup Label="CVE Mitigation">
<!--Please include the CGA id if possible-->

<PackageVersion Include="System.Security.Cryptography.Xml" Version="7.0.1" />

<!--CVE-2023-29331-->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="7.0.3" />

<!-- CVE-2021-26701 -->
<PackageVersion Include="System.Text.Encodings.Web" Version="7.0.0" />

<!-- CVE-2020-1045 -->
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.2.2" />

<!-- CVE-2022-26907 -->
<PackageVersion Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
</ItemGroup>

<!-- SDK Packages -->
<Choose>
<When Condition="'$(TargetFramework)' == 'net7.0'">
Expand All @@ -47,7 +40,7 @@
<ItemGroup>
<PackageVersion Include="AngleSharp" Version="1.0.4" />
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
<PackageVersion Include="Azure.Identity" Version="1.10.1" />
<PackageVersion Include="Azure.Identity" Version="1.10.3" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.0.0-beta.6" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.17.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
Expand Down Expand Up @@ -136,4 +129,4 @@
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="Moq" Version="4.18.1" />
</ItemGroup>
</Project>
</Project>
8 changes: 0 additions & 8 deletions build/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ steps:
arguments: '--configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -p:AssemblyVersion="$(assemblySemVer)" -p:FileVersion="$(assemblySemFileVer)" -p:InformationalVersion="$(informationalVersion)" -p:Version="$(majorMinorPatch)" -warnaserror -f ${{parameters.targetBuildFramework}}'
workingDirectory: $(System.DefaultWorkingDirectory)

- ${{ if eq(parameters.componentGovernance, 'true') }}:
- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'
failOnAlert: true

- ${{ if eq(parameters.unitTest, 'true') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,28 @@ public ExportJobFilter()

[JsonProperty(JobRecordProperties.SearchParams)]
public IList<Tuple<string, string>> Parameters { get; private set; }

public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}

return GetHashCode() == obj.GetHashCode();
}

public override int GetHashCode()
{
var paramHash = default(HashCode);
foreach (var param in Parameters)
{
paramHash.Add(param.Item1);
paramHash.Add(param.Item2);
}

paramHash.Add(ResourceType);
return paramHash.ToHashCode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,25 @@ public async Task<UpsertOutcome> UpsertAsync(ResourceWrapperOperation resource,
}
else
{
return await InternalUpsertAsync(
resource.Wrapper,
resource.WeakETag,
resource.AllowCreate,
resource.KeepHistory,
cancellationToken,
resource.RequireETagOnUpdate);
try
{
return await InternalUpsertAsync(
resource.Wrapper,
resource.WeakETag,
resource.AllowCreate,
resource.KeepHistory,
cancellationToken,
resource.RequireETagOnUpdate);
}
catch (FhirException fhirException)
{
// This block catches only FhirExceptions. FhirException can be thrown by the data store layer
// in different situations, like: Failed pre-conditions, bad requests, resource not found, etc.

_logger.LogInformation("Upserting failed. {ExceptionType}: {ExceptionMessage}", fhirException.GetType().ToString(), fhirException.Message);

throw;
}
}
}

Expand All @@ -262,7 +274,7 @@ private async Task<UpsertOutcome> InternalUpsertAsync(
var partitionKey = new PartitionKey(cosmosWrapper.PartitionKey);
AsyncPolicy retryPolicy = _retryExceptionPolicyFactory.RetryPolicy;

_logger.LogDebug("Upserting {ResourceType}/{ResourceId}, ETag: \"{Tag}\", AllowCreate: {AllowCreate}, KeepHistory: {KeepHistory}", resource.ResourceTypeName, resource.ResourceId, weakETag?.VersionId, allowCreate, keepHistory);
_logger.LogInformation("Upserting {ResourceType}/{ResourceId}, ETag: \"{Tag}\", AllowCreate: {AllowCreate}, KeepHistory: {KeepHistory}", resource.ResourceTypeName, resource.ResourceId, weakETag?.VersionId, allowCreate, keepHistory);

if (weakETag == null && allowCreate && !cosmosWrapper.IsDeleted)
{
Expand Down