Skip to content

Commit

Permalink
Bump AVPRIndex package in scripts, fix dev db seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Mar 19, 2024
1 parent 12e23f0 commit bae34bb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion StagingArea/test/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Tags:
- Name: validation
- Name: my-package
- Name: thing
ReleaseNotes: "add authors and tags for further testing"
ReleaseNotes: "Trigger another CI run"
---
*)

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-preview-index.fsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#r "nuget: AVPRIndex, 0.0.7"
#r "nuget: AVPRIndex, 0.0.8"

open AVPRIndex
open System.IO
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-publish-checks.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#r "nuget: dotenv.net, 3.1.3"
#r "nuget: AVPRIndex, 0.0.7"
#r "nuget: AVPRIndex, 0.0.8"
#r "nuget: AVPRClient, 0.0.4"
#r "nuget: FsHttp, 14.5.0"

Expand Down
2 changes: 1 addition & 1 deletion scripts/publish-pending-packages.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#r "nuget: dotenv.net, 3.1.3"
#r "nuget: AVPRIndex, 0.0.4"
#r "nuget: AVPRIndex, 0.0.8"
#r "nuget: AVPRClient, 0.0.4"

open AVPRIndex
Expand Down
15 changes: 10 additions & 5 deletions src/PackageRegistryService/Data/DataInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using PackageRegistryService.Models;
using System.Security.Policy;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using AVPRIndex;
using static AVPRIndex.Domain;
Expand Down Expand Up @@ -34,7 +35,9 @@ public static void SeedData(ValidationPackageDb context)
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (windows-latest)

Dereference of a possibly null reference.

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (windows-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (ubuntu-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (macos-latest)

Dereference of a possibly null reference.

Check warning on line 35 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (macos-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.
$"StagingArea/{i.Metadata.Name}/{i.FileName}"
);
var content = File.ReadAllBytes(path);
var content =
File.ReadAllText(path)
.ReplaceLineEndings("\n");
return new ValidationPackage
{
Expand All @@ -44,7 +47,7 @@ public static void SeedData(ValidationPackageDb context)
MajorVersion = i.Metadata.MajorVersion,
MinorVersion = i.Metadata.MinorVersion,
PatchVersion = i.Metadata.PatchVersion,
PackageContent = content,
PackageContent = Encoding.UTF8.GetBytes(content),
ReleaseDate = new(i.LastUpdated.Year, i.LastUpdated.Month, i.LastUpdated.Day),
Tags = i.Metadata.Tags,
ReleaseNotes = i.Metadata.ReleaseNotes,
Expand All @@ -63,9 +66,11 @@ public static void SeedData(ValidationPackageDb context)
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (windows-latest)

Dereference of a possibly null reference.

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (windows-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (ubuntu-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (macos-latest)

Dereference of a possibly null reference.

Check warning on line 66 in src/PackageRegistryService/Data/DataInitializer.cs

View workflow job for this annotation

GitHub Actions / Build and test projects / build-and-test (macos-latest)

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.
$"StagingArea/{i.Metadata.Name}/{i.FileName}"
);
var content = File.ReadAllBytes(path);
var content =
File.ReadAllText(path)
.ReplaceLineEndings("\n");
var hash = Convert.ToHexString(md5.ComputeHash(content));
var hash = Convert.ToHexString(md5.ComputeHash(Encoding.UTF8.GetBytes(content)));
if (hash != i.ContentHash)
{
throw new Exception($"Hash collision for indexed hash vs content hash: {$"StagingArea/{i.Metadata.Name}/{i.FileName}"}");
Expand All @@ -76,7 +81,7 @@ public static void SeedData(ValidationPackageDb context)
PackageMajorVersion = i.Metadata.MajorVersion,
PackageMinorVersion = i.Metadata.MinorVersion,
PackagePatchVersion = i.Metadata.PatchVersion,
Hash = Convert.ToHexString(md5.ComputeHash(content)),
Hash = hash,
};
});

Expand Down

0 comments on commit bae34bb

Please sign in to comment.