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
This commit is contained in:
Eric Mastro 2023-05-02 15:16:10 +10:00
parent c16055d7e4
commit 050bb85d27
No known key found for this signature in database
4 changed files with 25 additions and 5 deletions

View File

@ -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;

View File

@ -5,6 +5,13 @@
<RootNamespace>DistTestCore</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsArm64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">true</IsArm64>
<!-- <IsArm64 Condition="'$([Microsoft.Build.Utilities.ProcessorArchitecture]::CurrentProcessArchitecture($([System.Runtime.InteropServices.Architecture]::Arm64)))' == 'true'">true</IsArm64> -->
<!-- <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture($([System.Runtime.InteropServices.Architecture]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture($([System.Runtime.InteropServices.Architecture]::Linux)))' == 'true'">true</IsLinux> -->
</PropertyGroup>
<PropertyGroup Condition="'$(IsArm64)'=='true'">
<DefineConstants>Arm64</DefineConstants>
</PropertyGroup>
<ItemGroup>

View File

@ -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";

View File

@ -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";