attempt to fix contract deployment in testnet mode
This commit is contained in:
parent
b2b338d0a5
commit
2fae9505d6
|
@ -81,10 +81,6 @@ namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
DeleteNamespace(ns);
|
DeleteNamespace(ns);
|
||||||
}
|
}
|
||||||
foreach (var ns in namespaces)
|
|
||||||
{
|
|
||||||
WaitUntilNamespaceDeleted(ns);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteNamespace()
|
public void DeleteNamespace()
|
||||||
|
@ -94,7 +90,6 @@ namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
client.Run(c => c.DeleteNamespace(K8sNamespace, null, null, gracePeriodSeconds: 0));
|
client.Run(c => c.DeleteNamespace(K8sNamespace, null, null, gracePeriodSeconds: 0));
|
||||||
}
|
}
|
||||||
WaitUntilNamespaceDeleted();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteNamespace(string ns)
|
public void DeleteNamespace(string ns)
|
||||||
|
@ -645,16 +640,6 @@ namespace KubernetesWorkflow
|
||||||
WaitUntil(() => IsNamespaceOnline(K8sNamespace));
|
WaitUntil(() => IsNamespaceOnline(K8sNamespace));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WaitUntilNamespaceDeleted()
|
|
||||||
{
|
|
||||||
WaitUntil(() => !IsNamespaceOnline(K8sNamespace));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WaitUntilNamespaceDeleted(string name)
|
|
||||||
{
|
|
||||||
WaitUntil(() => !IsNamespaceOnline(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WaitUntilDeploymentOnline(string deploymentName)
|
private void WaitUntilDeploymentOnline(string deploymentName)
|
||||||
{
|
{
|
||||||
WaitUntil(() =>
|
WaitUntil(() =>
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace KubernetesWorkflow
|
||||||
|
|
||||||
foreach (var port in container.ContainerPorts)
|
foreach (var port in container.ContainerPorts)
|
||||||
{
|
{
|
||||||
if (PingHost(Format(port.ExternalAddress)))
|
if (port.ExternalAddress.IsValid() && PingHost(Format(port.ExternalAddress)))
|
||||||
{
|
{
|
||||||
return RunnerLocation.ExternalToCluster;
|
return RunnerLocation.ExternalToCluster;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Newtonsoft.Json;
|
using Utils;
|
||||||
using Utils;
|
|
||||||
|
|
||||||
namespace KubernetesWorkflow
|
namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
|
@ -39,14 +38,19 @@ namespace KubernetesWorkflow
|
||||||
public Port[] ServicePorts { get; }
|
public Port[] ServicePorts { get; }
|
||||||
public ContainerPort[] ContainerPorts { get; }
|
public ContainerPort[] ContainerPorts { get; }
|
||||||
|
|
||||||
|
public ContainerPort GetContainerPort(string portTag)
|
||||||
|
{
|
||||||
|
return ContainerPorts.Single(c => c.Port.Tag == portTag);
|
||||||
|
}
|
||||||
|
|
||||||
public Address GetAddress(string portTag)
|
public Address GetAddress(string portTag)
|
||||||
{
|
{
|
||||||
var containerPort = ContainerPorts.Single(c => c.Port.Tag == portTag);
|
var containerPort = GetContainerPort(portTag);
|
||||||
if (RunnerLocationUtils.DetermineRunnerLocation(this) == RunnerLocation.InternalToCluster)
|
if (RunnerLocationUtils.DetermineRunnerLocation(this) == RunnerLocation.InternalToCluster)
|
||||||
{
|
{
|
||||||
return containerPort.InternalAddress;
|
return containerPort.InternalAddress;
|
||||||
}
|
}
|
||||||
if (containerPort.ExternalAddress == Address.InvalidAddress) throw new Exception($"Getting address by tag {portTag} resulted in an invalid address.");
|
if (!containerPort.ExternalAddress.IsValid()) throw new Exception($"Getting address by tag {portTag} resulted in an invalid address.");
|
||||||
return containerPort.ExternalAddress;
|
return containerPort.ExternalAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
result.Add(new ContainerPort(
|
result.Add(new ContainerPort(
|
||||||
internalPort,
|
internalPort,
|
||||||
Address.InvalidAddress,
|
new Address(string.Empty, 0),
|
||||||
GetContainerInternalAddress(internalPort)));
|
GetContainerInternalAddress(internalPort)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
{
|
{
|
||||||
public class Address
|
public class Address
|
||||||
{
|
{
|
||||||
public static readonly Address InvalidAddress = new Address(string.Empty, 0);
|
|
||||||
|
|
||||||
public Address(string host, int port)
|
public Address(string host, int port)
|
||||||
{
|
{
|
||||||
Host = host;
|
Host = host;
|
||||||
|
@ -17,5 +15,10 @@
|
||||||
{
|
{
|
||||||
return $"{Host}:{Port}";
|
return $"{Host}:{Port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsValid()
|
||||||
|
{
|
||||||
|
return !string.IsNullOrEmpty(Host) && Port > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using KubernetesWorkflow;
|
using GethPlugin;
|
||||||
|
using KubernetesWorkflow;
|
||||||
|
|
||||||
namespace CodexContractsPlugin
|
namespace CodexContractsPlugin
|
||||||
{
|
{
|
||||||
|
@ -16,8 +17,10 @@ namespace CodexContractsPlugin
|
||||||
{
|
{
|
||||||
var config = startupConfig.Get<CodexContractsContainerConfig>();
|
var config = startupConfig.Get<CodexContractsContainerConfig>();
|
||||||
|
|
||||||
|
var containerPort = config.GethNode.StartResult.Container.GetContainerPort(GethContainerRecipe.HttpPortTag);
|
||||||
|
|
||||||
var ip = config.GethNode.StartResult.Container.Pod.PodInfo.Ip;
|
var ip = config.GethNode.StartResult.Container.Pod.PodInfo.Ip;
|
||||||
var port = config.GethNode.StartResult.HttpPort.Number;
|
var port = containerPort.InternalAddress.Port;
|
||||||
|
|
||||||
AddEnvVar("DISTTEST_NETWORK_URL", $"http://{ip}:{port}");
|
AddEnvVar("DISTTEST_NETWORK_URL", $"http://{ip}:{port}");
|
||||||
AddEnvVar("HARDHAT_NETWORK", "codexdisttestnetwork");
|
AddEnvVar("HARDHAT_NETWORK", "codexdisttestnetwork");
|
||||||
|
|
Loading…
Reference in New Issue