umbraco / Umbraco.Cloud.Issues

Public issue tracker for Umbraco Cloud
25 stars 2 forks source link

Enabling RestorePackagesWithLockFile breaks push/deploy #830

Open skttl opened 3 months ago

skttl commented 3 months ago

Issue description

When enabling RestorePackagesWithLockFile, generating the packages.lock.json file locally and then committing/pushing to Cloud, the build fails with the following message:

remote: Updating branch 'master'.        
remote: Updating submodules.        
remote: Preparing deployment for commit id '0f3107e182'.        
remote: Running custom deployment command...        
remote: Running deployment command...        
remote: Ensuring git configuration        
remote: Handling ASP.NET Core Web Application deployment        
remote: CsProjFile location C:\home\site\repository\src\UmbracoProject\UmbracoProject.csproj        
remote: Target Major and Minor dotnet sdk version found via the csproj file '8.0'        
remote: Working Sdk version '8.0.303'        
remote: Wrote global.json in the repository for version '8.0.303'        
remote:   Determining projects to restore...        
remote: .....        
remote: C:\home\site\repository\src\UmbracoProject\UmbracoProject.csproj : error NU1403: Package content hash validation failed for System.Numerics.Vectors.4.5.0. The package is different than the last restore.        
remote: C:\home\site\repository\src\UmbracoProject\UmbracoProject.csproj : error NU1403:         
remote:   Failed to restore C:\home\site\repository\src\UmbracoProject\UmbracoProject.csproj (in 9.77 sec).        
remote: Failed exitCode=1, command=dotnet restore "C:\home\site\repository\src\UmbracoProject\UmbracoProject.csproj"        
remote: An error has occurred during web site deployment.        
remote: 
remote: Deployment Failed.        
remote: Error - Changes committed to remote repository but deployment to website failed.   
BenDuguid-MRM commented 3 weeks ago

I received the error @skttl reports when attempting to deploy a "failed" build to the next environment, after a CI/CD triggered deployment.

The CI/CD deployment reports success, but Kudu actually just shows a "failed message":

Project information set
Deployment pending
DownloadUri set
Deployment queued
Deployment triggered
Deployment started
Check blocking markers
Create updating marker
Git Clone
Download update
Extract Update
Checking versions
Deleting repository files
Copying files to repository
NuGet Restore
Dotnet Build
Git Stage
Git Commit
Git Tag
Git Push
Delete updating marker
Deployment successful
Deployment completed successfully

Finishing: Wait for deployment completed

However when you check the site\deployments folder on Kudu, the latest.json file contains:

  "TimeStamp": "2024-11-01T10:28:58Z",
  "SiteName": "a7f2bcbe-653d-4068-a4b5-42afbdb637c0",
  "RequestId": "f0da3f73-1ead-4c2c-9ee0-4ed9f8ab951e",
  "Kind": "GitPush",
  "Status": "Failed",
  "Details": "{\"Id\":\"1d680764a11a78f5a595d9178a18b55ede9ab8ea\",
               \"Status\":3,
               \"StatusText\":\"\",
               \"AuthorEmail\":\"support@umbraco.io\",
               \"Author\":\"Umbraco Cloud\",
               \"Message\":\"Deployment e7fe5338-a1ed-44fc-93cb-dd5a12af2427: Deploying 0.0.269\",
               \"Progress\":\"\",
               \"Deployer\":\"$a7f2bcbe-653d-xxxx-xxxx-xxxxxxxxxxxx\",
               \"ReceivedTime\":\"2024-11-01T10:28:24.1180229Z\",
               \"StartTime\":\"2024-11-01T10:28:50.9004774Z\",
               \"EndTime\":\"2024-11-01T10:28:58.8069149Z\",
               \"LastSuccessEndTime\":null,
               \"Complete\":true,
               \"IsTemporary\":false,
               \"IsReadOnly\":false,
               \"SiteName\":\"a7f2bcbe-653d-xxxx-xxxx-xxxxxxxxxxxx\",
               \"HostName\":\"a7f2bcbe-653d-xxxx-xxxx-xxxxxxxxxxxx.scm.azurewebsites.net\",
               \"ProjectType\":\"CUSTOM DEPLOYMENT\",
               \"VsProjectId\":null}"
}

With the contents of the deployment ID folder limited to the single file log.log with the contents:

2024-11-01T10:28:59.0256893Z,Deployment Failed.,e10da34e-3ed3-41fa-a045-a0ce8e1bfa05,0

The failed deployments do not appear in the Cloud Portal Deployment Logs.

We're looking to use the RestorePackagesWithLockFile and corresponding RestoreLockedMode flag to provide us with:

  1. Consistent, repeatable package restores across all deployments, especially with regards to transient references.
  2. Enable reliable, valid Software Composition Analysis of vulnerabilities in the solution and its dependent packages.
  3. Speed up our CI/CD validation builds by caching the package caches between runs, and not having to compute the full dependency graph each run.