runner-s390x.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. diff --git a/src/Directory.Build.props b/src/Directory.Build.props
  2. index 9db5fac..f02e235 100644
  3. --- a/src/Directory.Build.props
  4. +++ b/src/Directory.Build.props
  5. @@ -44,6 +44,9 @@
  6. <PropertyGroup Condition="'$(BUILD_OS)' == 'Linux' AND '$(PackageRuntime)' == 'linux-arm64'">
  7. <DefineConstants>$(DefineConstants);ARM64</DefineConstants>
  8. </PropertyGroup>
  9. + <PropertyGroup Condition="'$(BUILD_OS)' == 'Linux' AND '$(PackageRuntime)' == 'linux-s390x'">
  10. + <DefineConstants>$(DefineConstants);S390X</DefineConstants>
  11. + </PropertyGroup>
  12. <!-- Set TRACE/DEBUG vars -->
  13. <PropertyGroup>
  14. diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh
  15. index 383221e..1555f67 100755
  16. --- a/src/Misc/externals.sh
  17. +++ b/src/Misc/externals.sh
  18. @@ -189,3 +189,8 @@ if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then
  19. acquireExternalTool "$NODE_URL/v${NODE16_VERSION}/node-v${NODE16_VERSION}-linux-armv7l.tar.gz" node16 fix_nested_dir
  20. acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-armv7l.tar.gz" node20 fix_nested_dir
  21. fi
  22. +
  23. +if [[ "$PACKAGERUNTIME" == "linux-s390x" ]]; then
  24. + acquireExternalTool "$NODE_URL/v${NODE16_VERSION}/node-v${NODE16_VERSION}-linux-s390x.tar.gz" node16 fix_nested_dir
  25. + acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-s390x.tar.gz" node20 fix_nested_dir
  26. +fi
  27. diff --git a/src/Misc/layoutroot/config.sh b/src/Misc/layoutroot/config.sh
  28. index 14cc6ba..9b5b8e6 100755
  29. --- a/src/Misc/layoutroot/config.sh
  30. +++ b/src/Misc/layoutroot/config.sh
  31. @@ -20,25 +20,29 @@ then
  32. message="Execute sudo ./bin/installdependencies.sh to install any missing Dotnet Core 6.0 dependencies."
  33. - ldd ./bin/libcoreclr.so | grep 'not found'
  34. - if [ $? -eq 0 ]; then
  35. - echo "Dependencies is missing for Dotnet Core 6.0"
  36. - echo $message
  37. - exit 1
  38. - fi
  39. + ARCH=`uname -m`
  40. + if [ "${ARCH}" != "s390x" -a "${ARCH}" != "ppc64le" ]
  41. + then
  42. + ldd ./bin/libcoreclr.so | grep 'not found'
  43. + if [ $? -eq 0 ]; then
  44. + echo "Dependencies is missing for Dotnet Core 6.0"
  45. + echo $message
  46. + exit 1
  47. + fi
  48. - ldd ./bin/libSystem.Security.Cryptography.Native.OpenSsl.so | grep 'not found'
  49. - if [ $? -eq 0 ]; then
  50. - echo "Dependencies is missing for Dotnet Core 6.0"
  51. - echo $message
  52. - exit 1
  53. - fi
  54. + ldd ./bin/libSystem.Security.Cryptography.Native.OpenSsl.so | grep 'not found'
  55. + if [ $? -eq 0 ]; then
  56. + echo "Dependencies is missing for Dotnet Core 6.0"
  57. + echo $message
  58. + exit 1
  59. + fi
  60. - ldd ./bin/libSystem.IO.Compression.Native.so | grep 'not found'
  61. - if [ $? -eq 0 ]; then
  62. - echo "Dependencies is missing for Dotnet Core 6.0"
  63. - echo $message
  64. - exit 1
  65. + ldd ./bin/libSystem.IO.Compression.Native.so | grep 'not found'
  66. + if [ $? -eq 0 ]; then
  67. + echo "Dependencies is missing for Dotnet Core 6.0"
  68. + echo $message
  69. + exit 1
  70. + fi
  71. fi
  72. if ! [ -x "$(command -v ldconfig)" ]; then
  73. diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs
  74. index 177e3c9..9545981 100644
  75. --- a/src/Runner.Common/Constants.cs
  76. +++ b/src/Runner.Common/Constants.cs
  77. @@ -58,7 +58,8 @@ namespace GitHub.Runner.Common
  78. X86,
  79. X64,
  80. Arm,
  81. - Arm64
  82. + Arm64,
  83. + S390x
  84. }
  85. public static class Runner
  86. @@ -81,6 +82,8 @@ namespace GitHub.Runner.Common
  87. public static readonly Architecture PlatformArchitecture = Architecture.Arm;
  88. #elif ARM64
  89. public static readonly Architecture PlatformArchitecture = Architecture.Arm64;
  90. +#elif S390X
  91. + public static readonly Architecture PlatformArchitecture = Architecture.S390x;
  92. #else
  93. public static readonly Architecture PlatformArchitecture = Architecture.X64;
  94. #endif
  95. diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs
  96. index 97273a1..2a34430 100644
  97. --- a/src/Runner.Common/Util/VarUtil.cs
  98. +++ b/src/Runner.Common/Util/VarUtil.cs
  99. @@ -53,6 +53,8 @@ namespace GitHub.Runner.Common.Util
  100. return "ARM";
  101. case Constants.Architecture.Arm64:
  102. return "ARM64";
  103. + case Constants.Architecture.S390x:
  104. + return "S390X";
  105. default:
  106. throw new NotSupportedException(); // Should never reach here.
  107. }
  108. diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs
  109. index 2042485..a9d8b46 100644
  110. --- a/src/Test/L0/ConstantGenerationL0.cs
  111. +++ b/src/Test/L0/ConstantGenerationL0.cs
  112. @@ -20,6 +20,7 @@ namespace GitHub.Runner.Common.Tests
  113. "linux-x64",
  114. "linux-arm",
  115. "linux-arm64",
  116. + "linux-s390x",
  117. "osx-x64",
  118. "osx-arm64"
  119. };
  120. diff --git a/src/Test/L0/Listener/SelfUpdaterL0.cs b/src/Test/L0/Listener/SelfUpdaterL0.cs
  121. index 26ba65e..6791df3 100644
  122. --- a/src/Test/L0/Listener/SelfUpdaterL0.cs
  123. +++ b/src/Test/L0/Listener/SelfUpdaterL0.cs
  124. @@ -1,4 +1,4 @@
  125. -#if !(OS_WINDOWS && ARM64)
  126. +#if !(OS_WINDOWS && ARM64) && !S390X
  127. using System;
  128. using System.Collections.Generic;
  129. using System.IO;
  130. @@ -16,6 +16,7 @@ using Xunit;
  131. namespace GitHub.Runner.Common.Tests.Listener
  132. {
  133. +#if !S390X // Self-update is not currently supported on S390X
  134. public sealed class SelfUpdaterL0
  135. {
  136. private Mock<IRunnerServer> _runnerServer;
  137. @@ -291,5 +292,6 @@ namespace GitHub.Runner.Common.Tests.Listener
  138. }
  139. }
  140. }
  141. +#endif
  142. }
  143. #endif
  144. diff --git a/src/Test/L0/Listener/SelfUpdaterV2L0.cs b/src/Test/L0/Listener/SelfUpdaterV2L0.cs
  145. index 5115a6b..dd8d198 100644
  146. --- a/src/Test/L0/Listener/SelfUpdaterV2L0.cs
  147. +++ b/src/Test/L0/Listener/SelfUpdaterV2L0.cs
  148. @@ -1,4 +1,4 @@
  149. -#if !(OS_WINDOWS && ARM64)
  150. +#if !(OS_WINDOWS && ARM64) && !S390X
  151. using System;
  152. using System.Collections.Generic;
  153. using System.IO;
  154. diff --git a/src/Test/L0/Worker/StepHostL0.cs b/src/Test/L0/Worker/StepHostL0.cs
  155. index f6b5889..26f8e21 100644
  156. --- a/src/Test/L0/Worker/StepHostL0.cs
  157. +++ b/src/Test/L0/Worker/StepHostL0.cs
  158. @@ -31,7 +31,7 @@ namespace GitHub.Runner.Common.Tests.Worker
  159. return hc;
  160. }
  161. -#if OS_LINUX
  162. +#if OS_LINUX && !S390X
  163. [Fact]
  164. [Trait("Level", "L0")]
  165. [Trait("Category", "Worker")]
  166. diff --git a/src/dev.sh b/src/dev.sh
  167. index fa637d1..8c66f37 100755
  168. --- a/src/dev.sh
  169. +++ b/src/dev.sh
  170. @@ -54,6 +54,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
  171. case $CPU_NAME in
  172. armv7l) RUNTIME_ID="linux-arm";;
  173. aarch64) RUNTIME_ID="linux-arm64";;
  174. + s390x) RUNTIME_ID="linux-s390x";;
  175. esac
  176. fi
  177. elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then
  178. @@ -80,7 +81,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
  179. exit 1
  180. fi
  181. elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then
  182. - if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') ]]; then
  183. + if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'linux-s390x') ]]; then
  184. echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2
  185. exit 1
  186. fi
  187. @@ -199,7 +200,8 @@ function package ()
  188. popd > /dev/null
  189. }
  190. -if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then
  191. +if [[ "${RUNTIME_ID}" != "linux-s390x" && ((! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet")) ]]; then
  192. +
  193. # Download dotnet SDK to ../_dotnetsdk directory
  194. heading "Ensure Dotnet SDK"
  195. @@ -224,8 +226,10 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN
  196. echo "${DOTNETSDK_VERSION}" > "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}"
  197. fi
  198. -echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%"
  199. -export PATH=${DOTNETSDK_INSTALLDIR}:$PATH
  200. +if [[ -d "${DOTNETSDK_INSTALLDIR}" ]]; then
  201. + echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%"
  202. + export PATH=${DOTNETSDK_INSTALLDIR}:$PATH
  203. +fi
  204. heading "Dotnet SDK Version"
  205. dotnet --version
  206. diff --git a/src/dir.proj b/src/dir.proj
  207. index 056a312..8370922 100644
  208. --- a/src/dir.proj
  209. +++ b/src/dir.proj
  210. @@ -41,8 +41,18 @@
  211. </ItemGroup>
  212. <Target Name="Build" DependsOnTargets="GenerateConstant">
  213. - <MSBuild Targets="Restore" Projects="@(ProjectFiles)" StopOnFirstFailure="true" />
  214. - <MSBuild Targets="Publish" Projects="@(ProjectFiles)" BuildInParallel="false" StopOnFirstFailure="true" Properties="Configuration=$(BUILDCONFIG);PackageRuntime=$(PackageRuntime);Version=$(RunnerVersion);RuntimeIdentifier=$(PackageRuntime);PublishDir=$(MSBuildProjectDirectory)/../_layout/bin" />
  215. + <PropertyGroup>
  216. + <!-- Normally we want to publish a self-contained app for $(PackageRuntime) -->
  217. + <PublishRuntimeIdentifier>RuntimeIdentifier=$(PackageRuntime)</PublishRuntimeIdentifier>
  218. + <!-- However, on s390x there are no apphost or runtime packages on nuget.org, so self-contained publishing is not supported.
  219. + Perform a non-self-contained publish using the current runtime identifier (normally something like rhel.8-s390x) instead.
  220. + In addition, when not using an explicit runtime identifier, the SDK will copy runtime assets from dependent packages;
  221. + as this would confuse the expected layout, disable that behavior as well. -->
  222. + <PublishRuntimeIdentifier Condition="'$(PackageRuntime)' == 'linux-s390x'">SelfContained=false;CopyLocalRuntimeTargetAssets=false</PublishRuntimeIdentifier>
  223. + </PropertyGroup>
  224. +
  225. + <MSBuild Targets="Restore" Projects="@(ProjectFiles)" StopOnFirstFailure="true" Properties="$(PublishRuntimeIdentifier)" />
  226. + <MSBuild Targets="Publish" Projects="@(ProjectFiles)" BuildInParallel="false" StopOnFirstFailure="true" Properties="Configuration=$(BUILDCONFIG);PackageRuntime=$(PackageRuntime);Version=$(RunnerVersion);$(PublishRuntimeIdentifier);PublishDir=$(MSBuildProjectDirectory)/../_layout/bin" />
  227. <Exec Command="%22$(DesktopMSBuild)%22 Runner.Service/Windows/RunnerService.csproj /p:Configuration=$(BUILDCONFIG) /p:PackageRuntime=$(PackageRuntime) /p:OutputPath=%22$(MSBuildProjectDirectory)/../_layout/bin%22" ConsoleToMSBuild="true" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86' Or '$(PackageRuntime)' == 'win-arm64'" />
  228. </Target>