cs-codex-dist-tests/ProjectPlugins/DeployAndRunPlugin/DeployAndRunPlugin.cs

38 lines
1.0 KiB
C#
Raw Normal View History

2023-10-31 10:15:08 +00:00
using Core;
using KubernetesWorkflow;
using KubernetesWorkflow.Types;
2023-10-31 10:15:08 +00:00
namespace DeployAndRunPlugin
{
public class DeployAndRunPlugin : IProjectPlugin
{
private readonly IPluginTools tools;
public DeployAndRunPlugin(IPluginTools tools)
{
this.tools = tools;
}
public void Announce()
{
tools.GetLog().Log("Deploy-and-Run plugin loaded.");
}
public void Decommission()
{
}
public RunningContainer Run(RunConfig config)
{
var workflow = tools.CreateWorkflow();
var startupConfig = new StartupConfig();
startupConfig.NameOverride = "dnr-" + config.Name;
startupConfig.Add(config);
var location = workflow.GetAvailableLocations().Get("fixed-s-4vcpu-16gb-amd-yz8rd");
var containers = workflow.Start(1, location, new DeployAndRunContainerRecipe(), startupConfig);
2023-10-31 10:15:08 +00:00
return containers.Containers.Single();
}
}
}