2
0
mirror of synced 2025-01-12 17:44:08 +00:00
Giuliano Mega ec0f7a6790
Remove run ID and introduce deploy ID (#93)
This PR removes the notion of a run id and replaces it with a deploy id in continuous tests. Deploy ids can be set at deploy time only (duh), and will be picked up by the test runner from the deploy file on subsequent runs of the continuous test runner. As a consequence, the deploy id becomes a deployer parameter, and can no longer be overridden at the runner. For non-continuous tests, the deploy ID is created on-the-fly.
2024-02-22 10:41:07 -03:00

42 lines
1.1 KiB
C#

using DistTestCore;
using KubernetesWorkflow;
using KubernetesWorkflow.Recipe;
using KubernetesWorkflow.Types;
namespace CodexNetDeployer
{
public class K8sHook : IK8sHooks
{
private readonly string testsTypeLabel;
private readonly string deployId;
private readonly Dictionary<string, string> metadata;
public K8sHook(string testsTypeLabel, string deployId, Dictionary<string, string> metadata)
{
this.testsTypeLabel = testsTypeLabel;
this.deployId = deployId;
this.metadata = metadata;
}
public void OnContainersStarted(RunningContainers rc)
{
}
public void OnContainersStopped(RunningContainers rc)
{
}
public void OnContainerRecipeCreated(ContainerRecipe recipe)
{
recipe.PodLabels.Add("tests-type", testsTypeLabel);
recipe.PodLabels.Add("deployid", deployId);
recipe.PodLabels.Add("testid", NameUtils.GetTestId());
foreach (var pair in metadata)
{
recipe.PodLabels.Add(pair.Key, pair.Value);
}
}
}
}