30#pragma warning disable CA1506
149 StaticFiles.IConfiguration
231 logger.LogDebug(
"Stopping instance...");
252 logger.LogTrace(
"Cancelling auto-update task");
260 toWait = Task.CompletedTask;
265 logger.LogTrace(
"Auto-update disabled 0. Not starting task.");
274 logger.LogWarning(
"Aborting auto-update scheduling change due to race condition!");
290 logger.LogTrace(
"Cancelling auto-start task");
298 toWait = Task.CompletedTask;
303 logger.LogTrace(
"Auto-start disabled. Not starting task.");
312 logger.LogWarning(
"Aborting auto-start scheduling change due to race condition!");
328 logger.LogTrace(
"Cancelling auto-stop task");
336 toWait = Task.CompletedTask;
341 logger.LogTrace(
"Auto-stop disabled. Not stoping task.");
350 logger.LogWarning(
"Aborting auto-stop scheduling change due to race condition!");
376#pragma warning disable CA1502
383 => databaseContextFactory.UseContext(
384 async databaseContext =>
405 logger.LogTrace(
"Aborting repo update, no repository!");
412 logger.LogTrace(
"Aborting repo update, active ref not tracking any remote branch!");
433 logger.LogTrace(
"Loading revision info for commit {sha}...",
startSha[..7]);
438 .Include(
x =>
x.ActiveTestMerges!)
439 .ThenInclude(
x =>
x.TestMerge)
450 logger.LogTrace(
"Not updating rev-info, already in DB.");
494 repo.RemoteGitProvider!.Value);
515 logger.LogTrace(
"All test merges have been merged on remote");
534 throw new JobException(Api.Models.ErrorCode.InstanceUpdateTestMergeConflict);
538 const string StageName =
"Resetting to origin...";
539 logger.LogTrace(StageName);
590#pragma warning restore CA1502
603 logger.LogDebug(
"Entering auto-update loop");
610 logger.LogTrace(
"Using cron schedule: {cron}",
cron);
615 IncludingSeconds = true,
655 logger.LogInformation(
"Beginning auto update...");
667 logger.LogWarning(
"Aborting auto-update due to repository update error!");
675 throw new JobException(Api.Models.ErrorCode.RepoMissing);
680 logger.LogTrace(
"Aborting auto update, repository error!");
686 logger.LogTrace(
"Aborting auto update, same revision as latest CompileJob");
700 databaseContextFactory,
Metadata about a server instance.
async ValueTask DeploymentProcess(Models.Job job, IDatabaseContextFactory databaseContextFactory, JobProgressReporter progressReporter, CancellationToken cancellationToken)
Create and a compile job and insert it into the database. Meant to be called by a IJobManager....
Task StopAsync(CancellationToken cancellationToken)
async Task StartAsync(CancellationToken cancellationToken)
ValueTask< CompileJob?> LatestCompileJob()
Gets the latest CompileJob.A ValueTask<TResult> resulting in the latest CompileJob or null if none ar...
async Task StartAsync(CancellationToken cancellationToken)
Instance(Api.Models.Instance metadata, IRepositoryManager repositoryManager, IEngineManager engineManager, IDreamMaker dreamMaker, IWatchdog watchdog, IChatManager chat, StaticFiles.IConfiguration configuration, IDmbFactory dmbFactory, IJobManager jobManager, IEventConsumer eventConsumer, IRemoteDeploymentManagerFactory remoteDeploymentManagerFactory, IAsyncDelayer asyncDelayer, ILogger< Instance > logger)
Initializes a new instance of the Instance class.
readonly IEventConsumer eventConsumer
The IEventConsumer for the Instance.
Task? autoStartTask
The auto-start Task.
async ValueTask ScheduleServerStart(string? newCron)
Change the server auto-start timing for the IInstanceCore.A ValueTask representing the running operat...
IChatManager Chat
The IChatManager for the IInstanceCore.
StaticFiles.IConfiguration Configuration
The IConfiguration for the IInstanceCore.
readonly IDmbFactory dmbFactory
The IDmbFactory for the Instance.
CancellationTokenSource? autoUpdateCts
CancellationTokenSource for autoUpdateTask.
async ValueTask ScheduleAutoUpdate(uint newInterval, string? newCron)
Change the auto-update timing for the IInstanceCore.A ValueTask representing the running operation.
readonly IJobManager jobManager
The IJobManager for the Instance.
CancellationTokenSource? autoStartCts
CancellationTokenSource for autoStartTask.
CancellationTokenSource? autoStopCts
CancellationTokenSource for autoStopTask.
IWatchdog Watchdog
The IWatchdog for the IInstanceCore.
async ValueTask DisposeAsync()
async ValueTask AutoUpdateAction(CancellationToken cancellationToken)
Pulls the repository and compiles.
async ValueTask ScheduleServerStop(string? newCron)
Change the server auto-stop timing for the IInstanceCore.A ValueTask representing the running operati...
readonly IRemoteDeploymentManagerFactory remoteDeploymentManagerFactory
The IRemoteDeploymentManagerFactory for the Instance.
Task? autoUpdateTask
The auto-update Task.
readonly ILogger< Instance > logger
The ILogger for the Instance.
const string DifferentCoreExceptionMessage
Message for the InvalidOperationException if ever a job starts on a different IInstanceCore than the ...
readonly Api.Models.Instance metadata
The Api.Models.Instance for the Instance.
readonly IAsyncDelayer asyncDelayer
The IAsyncDelayer for the Instance.
async Task TimerLoop(Func< CancellationToken, ValueTask > timerAction, string description, uint minutes, string? cron, CancellationToken cancellationToken)
Runs a timerAction every set of given minutes or on a given cron schedule.
ValueTask RepositoryAutoUpdateJob(IInstanceCore? core, IDatabaseContextFactory databaseContextFactory, Job job, JobProgressReporter progressReporter, CancellationToken cancellationToken)
The JobEntrypoint for updating the repository.
readonly object timerLock
lock object for autoUpdateCts and autoUpdateTask.
ValueTask InstanceRenamed(string newName, CancellationToken cancellationToken)
Called when the owning Instance is renamed.A ValueTask representing the running operation.
async Task StopAsync(CancellationToken cancellationToken)
Task? autoStopTask
The auto-stop Task.
Repository(LibGit2Sharp.IRepository libGitRepo, ILibGit2Commands commands, IIOManager ioManager, IEventConsumer eventConsumer, ICredentialsProvider credentialsProvider, IPostWriteHandler postWriteHandler, IGitRemoteFeaturesFactory gitRemoteFeaturesFactory, ILibGit2RepositoryFactory submoduleFactory, ILogger< Repository > logger, GeneralConfiguration generalConfiguration, Action disposeAction)
Initializes a new instance of the Repository class.
async ValueTask< IRepository?> LoadRepository(CancellationToken cancellationToken)
Attempt to load the IRepository from the default location.A ValueTask<TResult> resulting in the loade...
Operation exceptions thrown from the context of a Models.Job.
Progress reporter for a Job.
JobProgressReporter CreateSection(string? newStageName, double percentage)
Create a subsection of the JobProgressReporter with its optional own stage name.
Represents an Api.Models.Instance in the database.
ICollection< RevisionInformation > RevisionInformations
The RevisionInformations in the Instance.
static Job Create(JobCode code, User? startedBy, Api.Models.Instance instance)
Creates a new job for registering in the Jobs.IJobService.
Many to many relationship for Models.RevisionInformation and Models.TestMerge.
Helpers for manipulating the Serilog.Context.LogContext.
const string InstanceIdContextProperty
The Serilog.Context.LogContext property name for Models.Instance Api.Models.EntityId....
For managing connected chat services.
Factory for IDmbProviders.
ValueTask CleanUnusedCompileJobs(CancellationToken cancellationToken)
Deletes all compile jobs that are inactive in the Game folder.
For managing the compiler.
ValueTask< CompileJob?> LatestCompileJob()
Gets the latest CompileJob.
Factory for creating IRemoteDeploymentManagers.
IRemoteDeploymentManager CreateRemoteDeploymentManager(Api.Models.Instance metadata, RemoteGitProvider remoteGitProvider)
Creates a IRemoteDeploymentManager for a given remoteGitProvider .
ValueTask< IReadOnlyCollection< TestMerge > > RemoveMergedTestMerges(IRepository repository, RepositorySettings repositorySettings, RevisionInformation revisionInformation, CancellationToken cancellationToken)
Get the updated list of TestMerges for an origin merge.
For managing the engine installations.
Consumes EventTypes and takes the appropriate actions.
ValueTask HandleEvent(EventType eventType, IEnumerable< string?> parameters, bool deploymentPipeline, CancellationToken cancellationToken)
Handle a given eventType .
For interacting with the instance services.
Component version of IInstanceCore.
ValueTask InstanceRenamed(string newInstanceName, CancellationToken cancellationToken)
Called when the owning Instance is renamed.
Factory for creating and loading IRepositorys.
For managing the Configuration directory.
Runs and monitors the twin server controllers.
ValueTask Launch(CancellationToken cancellationToken)
Start the IWatchdog.
ValueTask Terminate(bool graceful, CancellationToken cancellationToken)
Stops the watchdog.
Factory for scoping usage of IDatabaseContexts. Meant for use by Components.
Manages the runtime of Jobs.
ValueTask< bool?> WaitForJobCompletion(Job job, User? canceller, CancellationToken jobCancellationToken, CancellationToken cancellationToken)
Wait for a given job to complete.
ValueTask RegisterOperation(Job job, JobEntrypoint operation, CancellationToken cancellationToken)
Registers a given Job and begins running it.
For waiting asynchronously.
ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)
Create a Task that completes after a given timeSpan .
@ List
User may list files if the Models.Instance allows it.
DreamMakerRights
Rights for deployment.
RepositoryRights
Rights for the git repository.
EventType
Types of events. Mirror in tgs.dm. Prefer last listed name for script.