From 050bb85d27a5af26d512ff48260928612d931edc Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Tue, 2 May 2023 15:16:10 +1000 Subject: [PATCH] add arch preprocessor directive Add preprocessor directive that checks if the current platform architecture is ARM64. The preprocessor directive checks for ARM64 architecture and changes which docker image to load in the recipes. # Conflicts: # DistTestCore/Codex/CodexContainerRecipe.cs --- DistTestCore/Codex/CodexContainerRecipe.cs | 11 ++++++++--- DistTestCore/DistTestCore.csproj | 7 +++++++ .../Marketplace/CodexContractsContainerRecipe.cs | 6 +++++- DistTestCore/Marketplace/GethContainerRecipe.cs | 6 +++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/DistTestCore/Codex/CodexContainerRecipe.cs b/DistTestCore/Codex/CodexContainerRecipe.cs index c3095b1..ff263a7 100644 --- a/DistTestCore/Codex/CodexContainerRecipe.cs +++ b/DistTestCore/Codex/CodexContainerRecipe.cs @@ -1,12 +1,17 @@ -using DistTestCore.Marketplace; +using System.Runtime.InteropServices; +using DistTestCore.Marketplace; using KubernetesWorkflow; namespace DistTestCore.Codex { public class CodexContainerRecipe : ContainerRecipeFactory { - //public const string DockerImage = "thatbenbierens/nim-codex:sha-9716635"; - public const string DockerImage = "thatbenbierens/codexlocal:latest"; + #if Arm64 + public const string DockerImage = "emizzle/nim-codex-arm64:sha-c7af585"; + #else + //public const string DockerImage = "thatbenbierens/nim-codex:sha-9716635"; + public const string DockerImage = "thatbenbierens/codexlocal:latest"; + #endif public const string MetricsPortTag = "metrics_port"; protected override string Image => DockerImage; diff --git a/DistTestCore/DistTestCore.csproj b/DistTestCore/DistTestCore.csproj index 6c4a133..3e06fa7 100644 --- a/DistTestCore/DistTestCore.csproj +++ b/DistTestCore/DistTestCore.csproj @@ -5,6 +5,13 @@ DistTestCore enable enable + true + + + + + Arm64 diff --git a/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs b/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs index 42bbeca..00a9a7c 100644 --- a/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs +++ b/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs @@ -4,7 +4,11 @@ namespace DistTestCore.Marketplace { public class CodexContractsContainerRecipe : ContainerRecipeFactory { - public const string DockerImage = "thatbenbierens/codex-contracts-deployment"; + #if Arm64 + public const string DockerImage = "emizzle/codex-contracts-deployment:latest"; + #else + public const string DockerImage = "thatbenbierens/codex-contracts-deployment"; + #endif public const string MarketplaceAddressFilename = "/usr/app/deployments/codexdisttestnetwork/Marketplace.json"; public const string MarketplaceArtifactFilename = "/usr/app/artifacts/contracts/Marketplace.sol/Marketplace.json"; diff --git a/DistTestCore/Marketplace/GethContainerRecipe.cs b/DistTestCore/Marketplace/GethContainerRecipe.cs index f2693ac..008d293 100644 --- a/DistTestCore/Marketplace/GethContainerRecipe.cs +++ b/DistTestCore/Marketplace/GethContainerRecipe.cs @@ -4,7 +4,11 @@ namespace DistTestCore.Marketplace { public class GethContainerRecipe : ContainerRecipeFactory { - public const string DockerImage = "thatbenbierens/geth-confenv:latest"; + #if Arm64 + public const string DockerImage = "emizzle/geth-confenv:latest"; + #else + public const string DockerImage = "thatbenbierens/geth-confenv:latest"; + #endif public const string HttpPortTag = "http_port"; public const string DiscoveryPortTag = "disc_port"; private const string defaultArgs = "--ipcdisable --syncmode full";