Adds deployment complete event

This commit is contained in:
Jordan Brown
2020-04-27 22:21:56 -04:00
parent 0a6022ceb4
commit 74f276668b
3 changed files with 26 additions and 17 deletions
+2 -2
View File
@@ -68,9 +68,9 @@
#define TGS_EVENT_COMPILE_START 8
#define TGS_EVENT_COMPILE_CANCELLED 9
#define TGS_EVENT_COMPILE_FAILURE 10
#define TGS_EVENT_COMPILE_COMPLETE 11
#define TGS_EVENT_COMPILE_COMPLETE 11 // Note, this event fires before the new .dmb is loaded into the watchdog. Consider using the TGS_EVENT_DEPLOYMENT_COMPLETE instead
#define TGS_EVENT_INSTANCE_AUTO_UPDATE_START 12
#define TGS_EVENT_REPO_MERGE_CONFLICT 13
#define TGS_EVENT_DEPLOYMENT_COMPLETE 13
//OTHER ENUMS
@@ -8,71 +8,76 @@
/// <summary>
/// Parameters: Reference name, commit sha
/// </summary>
RepoResetOrigin = 0,
RepoResetOrigin,
/// <summary>
/// Parameters: Checkout target
/// </summary>
RepoCheckout = 1,
RepoCheckout,
/// <summary>
/// No parameters
/// </summary>
RepoFetch = 2,
RepoFetch,
/// <summary>
/// Parameters: Pull request number, pull request sha, merger message
/// </summary>
RepoMergePullRequest = 3,
RepoMergePullRequest,
/// <summary>
/// Parameters: Absolute path to repository root
/// </summary>
RepoPreSynchronize = 4,
RepoPreSynchronize,
/// <summary>
/// Parameters: Version being installed
/// </summary>
ByondInstallStart = 5,
ByondInstallStart,
/// <summary>
/// Parameters: Error string
/// </summary>
ByondInstallFail = 6,
ByondInstallFail,
/// <summary>
/// Parameters: Old active version, new active version
/// </summary>
ByondActiveVersionChange = 7,
ByondActiveVersionChange,
/// <summary>
/// Parameters: Game directory path, origin commit sha
/// </summary>
CompileStart = 8,
CompileStart,
/// <summary>
/// No parameters
/// </summary>
CompileCancelled = 9,
CompileCancelled,
/// <summary>
/// Parameters: Game directory path, "1" if compile succeeded and api validation failed, "0" otherwise
/// </summary>
CompileFailure = 10,
CompileFailure,
/// <summary>
/// Parameters: Game directory path
/// </summary>
CompileComplete = 11,
CompileComplete,
/// <summary>
/// No parameters
/// </summary>
InstanceAutoUpdateStart = 12,
InstanceAutoUpdateStart,
/// <summary>
/// Parameters: Base sha, target sha, base reference, target reference
/// </summary>
RepoMergeConflict = 13,
RepoMergeConflict,
/// <summary>
/// No parameters
/// </summary>
DeploymentComplete
}
}
@@ -256,7 +256,11 @@ namespace Tgstation.Server.Host.Components
databaseContext.CompileJobs.Add(compileJob); // will be saved by job context
job.PostComplete = ct => compileJobConsumer.LoadCompileJob(compileJob, ct);
job.PostComplete = async postCompleteCancellationToken =>
{
await compileJobConsumer.LoadCompileJob(compileJob, postCompleteCancellationToken).ConfigureAwait(false);
await eventConsumer.HandleEvent(EventType.DeploymentComplete, null, postCompleteCancellationToken).ConfigureAwait(false);
};
if (repositorySettings?.AccessToken != null)
{