Automated local docker build is working.
This commit is contained in:
parent
0f12bcd086
commit
b0f72cf453
|
@ -13,7 +13,10 @@
|
|||
.Replace("]", "-")
|
||||
.Replace(",", "-");
|
||||
|
||||
return result.Trim('-');
|
||||
result = result.Trim('-');
|
||||
if (result.Length > 62) result = result.Substring(0, 62);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ namespace CodexNetDeployer
|
|||
{
|
||||
var dockerPassword = Environment.GetEnvironmentVariable("DOCKERPASSWORD");
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(dockerUsername) || string.IsNullOrEmpty(dockerPassword))
|
||||
{
|
||||
Log("Environment variable 'DOCKERPASSWORD' not provided.");
|
||||
|
@ -81,10 +83,21 @@ namespace CodexNetDeployer
|
|||
Docker("login", "-u", dockerUsername, "-p", dockerPassword);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Log("Docker login failed.");
|
||||
Log("Please check the docker username and password provided by the constructor arguments and/or");
|
||||
Log("set by 'DOCKERUSERNAME' and 'DOCKERPASSWORD' environment variables.");
|
||||
Log("Note: You can use a docker access token as DOCKERPASSWORD.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private string GenerateImageName()
|
||||
{
|
||||
return $"{dockerUsername!}/nim-codex-autoimage:{Guid.NewGuid().ToString().ToLowerInvariant()}";
|
||||
var tag = Environment.GetEnvironmentVariable("DOCKERTAG");
|
||||
if (string.IsNullOrEmpty(tag)) return $"{dockerUsername!}/nim-codex-autoimage:{Guid.NewGuid().ToString().ToLowerInvariant()}";
|
||||
return $"{dockerUsername}/nim-codex-autoimage:{tag}";
|
||||
}
|
||||
|
||||
private void Docker(params string[] args)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using CodexContractsPlugin;
|
||||
using CodexNetDeployer;
|
||||
using CodexPlugin;
|
||||
using Core;
|
||||
using DistTestCore;
|
||||
using DistTestCore.Helpers;
|
||||
using DistTestCore.Logs;
|
||||
using GethPlugin;
|
||||
using NUnit.Framework.Constraints;
|
||||
|
||||
|
@ -20,6 +22,13 @@ namespace Tests
|
|||
ProjectPlugin.Load<MetricsPlugin.MetricsPlugin>();
|
||||
}
|
||||
|
||||
protected override void Initialize(FixtureLog fixtureLog)
|
||||
{
|
||||
var localBuilder = new LocalCodexBuilder(fixtureLog);
|
||||
localBuilder.Intialize();
|
||||
localBuilder.Build();
|
||||
}
|
||||
|
||||
public ICodexNode AddCodex()
|
||||
{
|
||||
return AddCodex(s => { });
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace DistTestCore
|
|||
statusLog = new StatusLog(logConfig, startTime);
|
||||
|
||||
globalEntryPoint = new EntryPoint(fixtureLog, configuration.GetK8sConfiguration(new DefaultTimeSet(), TestNamespacePrefix), configuration.GetFileManagerFolder());
|
||||
|
||||
Initialize(fixtureLog);
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
|
@ -140,6 +142,10 @@ namespace DistTestCore
|
|||
Stopwatch.Measure(Get().Log, name, action);
|
||||
}
|
||||
|
||||
protected virtual void Initialize(FixtureLog fixtureLog)
|
||||
{
|
||||
}
|
||||
|
||||
protected TestLifecycle Get()
|
||||
{
|
||||
lock (lifecycleLock)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ArgsUniform;
|
||||
using CodexPlugin;
|
||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
||||
|
||||
namespace CodexNetDeployer
|
||||
{
|
||||
|
@ -16,7 +15,8 @@ namespace CodexNetDeployer
|
|||
public string KubeNamespace { get; set; } = string.Empty;
|
||||
|
||||
[Uniform("codex-local-repo", "cr", "CODEXLOCALREPOPATH", false, "If set, instead of using the default Codex docker image, the local repository will be used to build an image. " +
|
||||
"This requires the 'DOCKERUSERNAME' and 'DOCKERPASSWORD' environment variables to be set.")]
|
||||
"This requires the 'DOCKERUSERNAME' and 'DOCKERPASSWORD' environment variables to be set. (You can omit the password to use your system default, or use a docker access token as DOCKERPASSWORD.) You can set " +
|
||||
"'DOCKERTAG' to define the image tag. If not set, one will be generated.")]
|
||||
public string CodexLocalRepoPath { get; set; } = string.Empty;
|
||||
|
||||
[Uniform("nodes", "n", "NODES", true, "Number of Codex nodes to be created.")]
|
||||
|
@ -65,34 +65,6 @@ namespace CodexNetDeployer
|
|||
[Uniform("check-connect", "cc", "CHECKCONNECT", false, "If true, deployer check ensure peer-connectivity between all deployed nodes after deployment. Default is false.")]
|
||||
public bool CheckPeerConnection { get; set; } = false;
|
||||
|
||||
public Configuration()
|
||||
{
|
||||
// dotnet run \
|
||||
//--kube - config =/ opt / kubeconfig.yaml \
|
||||
//--kube -namespace=codex-continuous-tests \
|
||||
//--nodes=5 \
|
||||
//--validators=3 \
|
||||
//--log-level=Trace \
|
||||
//--storage-quota=2048 \
|
||||
//--storage-sell=1024 \
|
||||
//--min-price=1024 \
|
||||
//--max-collateral=1024 \
|
||||
//--max-duration=3600000 \
|
||||
//--block-ttl=180 \
|
||||
//--block-mi=120 \
|
||||
//--block-mn=10000 \
|
||||
//--metrics=1 \
|
||||
//--check-connect=1
|
||||
|
||||
KubeNamespace = "autodockertest";
|
||||
NumberOfCodexNodes = 3;
|
||||
NumberOfValidators = 1;
|
||||
StorageQuota = 2048;
|
||||
StorageSell = 1024;
|
||||
|
||||
CodexLocalRepoPath = "D:/Projects/nim-codex";
|
||||
}
|
||||
|
||||
public List<string> Validate()
|
||||
{
|
||||
var errors = new List<string>();
|
||||
|
|
Loading…
Reference in New Issue