Update nuget packages and added logging to the Updater #865

pull/1510/head
tidusjar 7 years ago
parent 23efcd3dce
commit d754ef6b81

@ -8,7 +8,7 @@
<PackageReference Include="Moq" Version="4.7.99" />
<PackageReference Include="xunit" Version="2.3.0-beta5-build3769" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta5-build3769" />
<PackageReference Include="Nunit" Version="3.7.1" />
<PackageReference Include="Nunit" Version="3.8.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />

@ -9,8 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" />
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Hangfire" Version="1.6.16" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.0" />

@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.0" />
<PackageReference Include="AutoMapper.Collection" Version="3.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" />
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="AutoMapper.Collection" Version="3.1.2" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.0.1" />
</ItemGroup>
<ItemGroup>

@ -8,7 +8,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Moq" Version="4.7.99" />
<PackageReference Include="Nunit" Version="3.7.1" />
<PackageReference Include="Nunit" Version="3.8.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
<packagereference Include="Microsoft.NET.Test.Sdk" Version="15.0.0"></packagereference>

@ -31,7 +31,7 @@ namespace Ombi.Schedule
RecurringJob.AddOrUpdate(() => EmbyContentCacher.Start(), Cron.Hourly);
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
RecurringJob.AddOrUpdate(() => PlexUserImporter.Start(), Cron.Daily);
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily);
RecurringJob.AddOrUpdate(() => Updater.Update(null), Cron.Daily);
//BackgroundJob.Enqueue(() => PlexUserImporter.Start());
}

@ -1,9 +1,10 @@
using System.Threading.Tasks;
using Hangfire.Server;
namespace Ombi.Schedule.Ombi
{
public interface IOmbiAutomaticUpdater
{
Task Update();
Task Update(PerformContext context);
}
}

@ -8,6 +8,8 @@ using System.Net.Http;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Hangfire.Console;
using Hangfire.Server;
using Microsoft.Extensions.Logging;
using Ombi.Api.Service;
@ -28,15 +30,17 @@ namespace Ombi.Schedule.Jobs.Ombi
private ILogger<OmbiAutomaticUpdater> Logger { get; }
private IOmbiService OmbiService { get; }
public async Task Update()
public async Task Update(PerformContext c)
{
c.WriteLine("Starting the updater");
// IF AutoUpdateEnabled =>
// ELSE Return;
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
c.WriteLine("Path: {0}", currentLocation);
var productVersion = AssemblyHelper.GetRuntimeVersion();
Logger.LogInformation(LoggingEvents.Updater, "Product Version {0}", productVersion);
c.WriteLine("Product Version {0}", productVersion);
var productArray = productVersion.Split('-');
var version = productArray[0];
@ -46,15 +50,17 @@ namespace Ombi.Schedule.Jobs.Ombi
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
try
{
var updates = await OmbiService.GetUpdates(branch);
var serverVersion = updates.UpdateVersionString;
Logger.LogInformation(LoggingEvents.Updater, "Service Version {0}", updates.UpdateVersionString);
c.WriteLine("Service Version {0}", updates.UpdateVersionString);
if (!serverVersion.Equals(version, StringComparison.CurrentCultureIgnoreCase))
{
// Let's download the correct zip
var desc = RuntimeInformation.OSDescription;
var proce = RuntimeInformation.ProcessArchitecture;
@ -161,6 +167,12 @@ namespace Ombi.Schedule.Jobs.Ombi
}
}
catch (Exception e)
{
c.WriteLine(e);
throw;
}
}
public static async Task DownloadAsync(string requestUri, string filename)
{

@ -11,9 +11,10 @@
<ItemGroup>
<PackageReference Include="Hangfire" Version="1.6.16" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.16" />
<PackageReference Include="Hangfire.Console" Version="1.3.6" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
<PackageReference Include="Serilog" Version="2.4.0" />
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
</ItemGroup>

@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.0" />
<PackageReference Include="AutoMapper" Version="6.1.1" />
</ItemGroup>
<ItemGroup>

@ -46,9 +46,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.0" />
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.16" />
<PackageReference Include="Hangfire.Console" Version="1.3.6" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
@ -57,8 +58,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.0.0-alpha6-79" />
<PackageReference Include="Serilog" Version="2.4.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
<PackageReference Include="Serilog.Sinks.File" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.SQLite" Version="3.8.3" />

@ -5,6 +5,7 @@ using System.Text;
using AutoMapper;
using AutoMapper.EquivalencyExpression;
using Hangfire;
using Hangfire.Console;
using Hangfire.Dashboard;
using Hangfire.MemoryStorage;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -179,6 +180,7 @@ namespace Ombi
x.UseMemoryStorage(new MemoryStorageOptions());
//x.UseSQLiteStorage("Data Source=Ombi.db;");
x.UseActivator(new IoCJobActivator(services.BuildServiceProvider()));
x.UseConsole();
});

Loading…
Cancel
Save