Skip to content

Commit

Permalink
Add an ARM64 agent (microsoft#2881)
Browse files Browse the repository at this point in the history
* add an ARM64 agent
* add ARM64 agent to release def
* break dependency on libcurl for ARM
* only layout the requested RID to save time
* fixup a few relevant strings and dependencies
  • Loading branch information
vtbassmatt authored Mar 31, 2020
1 parent 66d3c26 commit ea34833
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 44 deletions.
30 changes: 30 additions & 0 deletions .vsts.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,36 @@ jobs:
artifactName: agent
artifactType: container

################################################################################
- job: build_linux_arm64_agent
################################################################################
displayName: Linux Agent (ARM64)
pool:
name: buildDevs
demands: 'Agent.OSArchitecture -equals ARM64'
timeoutInMinutes: 75
steps:

# Steps template for non-windows platform
- template: .vsts.template.nonwindows.yml
parameters:
testLogTitle: 'Linux-ARM64'

# Create agent package zip
- script: ./dev.sh package Release
workingDirectory: src
displayName: Package Release
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'))

# Upload agent package zip as build artifact
- task: PublishBuildArtifacts@1
displayName: Publish Artifact (Linux ARM64)
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'))
inputs:
pathToPublish: _package
artifactName: agent
artifactType: container

################################################################################
- job: build_rhel6_x64_agent
################################################################################
Expand Down
29 changes: 29 additions & 0 deletions .vsts.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,35 @@ stages:
artifactName: agent
artifactType: container

################################################################################
- job: build_linux_agent_arm64
################################################################################
displayName: Linux Agent (ARM64)
condition: false
pool:
name: buildDevs
demands: 'Agent.OSArchitecture -equals ARM64'
timeoutInMinutes: 75
steps:

# Steps template for non-windows platform
- template: .vsts.template.nonwindows.yml
parameters:
testLogTitle: 'Linux-ARM64'

# Create agent package zip
- script: ./dev.sh package Release
workingDirectory: src
displayName: Package Release

# Upload agent package zip as build artifact
- task: PublishBuildArtifacts@1
displayName: Publish Artifact (Linux)
inputs:
pathToPublish: _package
artifactName: agent
artifactType: container

################################################################################
- job: build_rhel6_agent_x64
################################################################################
Expand Down
8 changes: 7 additions & 1 deletion assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-linux-arm-<AGENT_VERSION>.tar.gz"
},
{
"name": "vsts-agent-linux-arm64-<AGENT_VERSION>.tar.gz",
"platform": "linux-arm64",
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-linux-arm64-<AGENT_VERSION>.tar.gz"
},
{
"name": "vsts-agent-rhel.6-x64-<AGENT_VERSION>.tar.gz",
"platform": "rhel.6-x64",
"version": "<AGENT_VERSION>",
"downloadUrl": "https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-rhel.6-x64-<AGENT_VERSION>.tar.gz"
}
]
]
10 changes: 9 additions & 1 deletion releaseNote.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| macOS | [vsts-agent-osx-x64-<AGENT_VERSION>.tar.gz](https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-osx-x64-<AGENT_VERSION>.tar.gz) |
| Linux x64 | [vsts-agent-linux-x64-<AGENT_VERSION>.tar.gz](https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-linux-x64-<AGENT_VERSION>.tar.gz) |
| Linux ARM | [vsts-agent-linux-arm-<AGENT_VERSION>.tar.gz](https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-linux-arm-<AGENT_VERSION>.tar.gz) |
| Linux ARM64 | [vsts-agent-linux-arm64-<AGENT_VERSION>.tar.gz](https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-linux-arm-<AGENT_VERSION>.tar.gz) |
| RHEL 6 x64 | [vsts-agent-rhel.6-x64-<AGENT_VERSION>.tar.gz](https://vstsagentpackage.azureedge.net/agent/<AGENT_VERSION>/vsts-agent-rhel.6-x64-<AGENT_VERSION>.tar.gz) |

After Download:
Expand All @@ -26,7 +27,7 @@ C:\> mkdir myagent && cd myagent
C:\myagent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$HOME\Downloads\vsts-agent-win-x86-<AGENT_VERSION>.zip", "$PWD")
```

## OSX
## macOS

``` bash
~/$ mkdir myagent && cd myagent
Expand All @@ -47,6 +48,13 @@ C:\myagent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO
~/myagent$ tar xzf ~/Downloads/vsts-agent-linux-arm-<AGENT_VERSION>.tar.gz
```

## Linux ARM64

``` bash
~/$ mkdir myagent && cd myagent
~/myagent$ tar xzf ~/Downloads/vsts-agent-linux-arm64-<AGENT_VERSION>.tar.gz
```

## RHEL 6 x64

``` bash
Expand Down
9 changes: 5 additions & 4 deletions src/Agent.Listener/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ public static class Program
{
public static int Main(string[] args)
{
// We can't use the new SocketsHttpHandler for now for both Windows and Linux
// On linux, Negotiate auth is not working if the TFS url is behind Https
// On windows, Proxy is not working
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
if (PlatformUtil.UseLegacyHttpHandler)
{
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
}

using (HostContext context = new HostContext("Agent"))
{
return MainAsync(context, args).GetAwaiter().GetResult();
Expand Down
9 changes: 5 additions & 4 deletions src/Agent.PluginHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ public static class Program

public static int Main(string[] args)
{
// We can't use the new SocketsHttpHandler for now for both Windows and Linux
// On linux, Negotiate auth is not working if the TFS url is behind Https
// On windows, Proxy is not working
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
if (PlatformUtil.UseLegacyHttpHandler)
{
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
}

Console.CancelKeyPress += Console_CancelKeyPress;

// Set encoding to UTF8, process invoker will use UTF8 write to STDIN
Expand Down
12 changes: 12 additions & 0 deletions src/Agent.Sdk/Util/PlatformUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,17 @@ public static bool IsArm64
{
get => PlatformUtil.HostArchitecture == Architecture.Arm64;
}

// remove this after addressing
// https://github.com/microsoft/azure-pipelines-agent/issues/2875
public static bool UseLegacyHttpHandler
{
// In .NET Core 2.1, we couldn't use the new SocketsHttpHandler for Windows or Linux
// On Linux, negotiate auth didn't work if the TFS URL was HTTPS
// On Windows, proxy was not working
// But on ARM/ARM64 Linux, the legacy curl dependency is problematic
// (see https://github.com/dotnet/runtime/issues/28891)
get => !(PlatformUtil.RunningOnLinux && (PlatformUtil.IsArm || PlatformUtil.IsArm64));
}
}
}
10 changes: 6 additions & 4 deletions src/Agent.Worker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using Agent.Sdk;

namespace Microsoft.VisualStudio.Services.Agent.Worker
{
public static class Program
{
public static int Main(string[] args)
{
// We can't use the new SocketsHttpHandler for now for both Windows and Linux
// On linux, Negotiate auth is not working if the TFS url is behind Https
// On windows, Proxy is not working
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
if (PlatformUtil.UseLegacyHttpHandler)
{
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
}

using (HostContext context = new HostContext("Worker"))
{
return MainAsync(context, args).GetAwaiter().GetResult();
Expand Down
7 changes: 5 additions & 2 deletions src/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeFrameworkVersion>3.1.0</RuntimeFrameworkVersion>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
<RuntimeIdentifier>$(PackageRuntime)</RuntimeIdentifier>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
<NoWarn>NU1701;NU1603;</NoWarn>
Expand Down Expand Up @@ -48,6 +48,9 @@
<PropertyGroup Condition="'$(OSPlatform)' == 'OS_LINUX' AND '$(PackageRuntime)' == 'linux-arm'">
<OSArchitecture>ARM</OSArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(OSPlatform)' == 'OS_LINUX' AND '$(PackageRuntime)' == 'linux-arm64'">
<OSArchitecture>ARM64</OSArchitecture>
</PropertyGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\rules.ruleset</CodeAnalysisRuleSet>
Expand All @@ -57,4 +60,4 @@
<PropertyGroup>
<DefineConstants>$(OSPlatform);$(OSArchitecture);$(DebugConstant);TRACE</DefineConstants>
</PropertyGroup>
</Project>
</Project>
9 changes: 7 additions & 2 deletions src/Misc/externals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ if [[ "$PACKAGERUNTIME" == "osx-x64" ]]; then
fi

# Download the external tools common across OSX and Linux PACKAGERUNTIMEs.
if [[ "$PACKAGERUNTIME" == "linux-x64" || "$PACKAGERUNTIME" == "linux-arm" || "$PACKAGERUNTIME" == "osx-x64" || "$PACKAGERUNTIME" == "rhel.6-x64" ]]; then
if [[ "$PACKAGERUNTIME" == "linux-x64" || "$PACKAGERUNTIME" == "linux-arm" || "$PACKAGERUNTIME" == "linux-arm64" || "$PACKAGERUNTIME" == "osx-x64" || "$PACKAGERUNTIME" == "rhel.6-x64" ]]; then
acquireExternalTool "$CONTAINER_URL/tee/14_134_0/TEE-CLC-14.134.0.zip" tee fix_nested_dir
acquireExternalTool "$CONTAINER_URL/vso-task-lib/0.5.5/vso-task-lib.tar.gz" vso-task-lib
fi
Expand All @@ -186,6 +186,11 @@ if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then
acquireExternalTool "$NODE_URL/v${NODE10_VERSION}/node-v${NODE10_VERSION}-linux-armv7l.tar.gz" node10 fix_nested_dir
fi

if [[ "$PACKAGERUNTIME" == "linux-arm64" ]]; then
acquireExternalTool "$NODE_URL/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-arm64.tar.gz" node fix_nested_dir
acquireExternalTool "$NODE_URL/v${NODE10_VERSION}/node-v${NODE10_VERSION}-linux-arm64.tar.gz" node10 fix_nested_dir
fi

if [[ "$L1_MODE" != "" || "$PRECACHE" != "" ]]; then
# cmdline task
acquireExternalTool "$CONTAINER_URL/l1Tasks/d9bafed4-0b18-4f58-968d-86655b4d2ce9.zip" "Tasks" false dont_uncompress
Expand All @@ -196,4 +201,4 @@ if [[ "$L1_MODE" != "" || "$PRECACHE" != "" ]]; then
# signed service tree task
acquireExternalTool "$CONTAINER_URL/l1Tasks/5515f72c-5faa-4121-8a46-8f42a8f42132.zip" "Tasks" false dont_uncompress
fi
fi
fi
22 changes: 12 additions & 10 deletions src/Misc/layoutbin/installdependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function print_errormessage()
{
echo "Can't install dotnet core dependencies."
echo "You can manually install all required dependencies based on following documentation"
echo "https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x"
echo "https://docs.microsoft.com/en-us/dotnet/core/dependencies?pivots=os-linux&tabs=netcore31"
}

function print_rhel6message()
Expand All @@ -31,7 +31,7 @@ function print_rhel6errormessage()
{
echo "We couldn't install dotnet core dependencies"
echo "You can manually install all required dependencies based on following documentation"
echo "https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x"
echo "https://docs.microsoft.com/en-us/dotnet/core/dependencies?pivots=os-linux&tabs=netcore31"
echo "In addition, there are some dependencies which require manual installation. Please follow this documentation"
echo "https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md"
}
Expand Down Expand Up @@ -71,18 +71,19 @@ then
exit 1
fi

# debian 9 use libssl1.0.2
# debian 10 uses libssl1.1
# debian 9 uses libssl1.0.2
# other debian linux use libssl1.0.0
apt install -y libssl1.0.0 || apt install -y libssl1.0.2
apt install -y libssl1.0.0 || apt install -y libssl1.0.2 || apt install -y libssl1.1
if [ $? -ne 0 ]
then
echo "'apt' failed with exit code '$?'"
print_errormessage
exit 1
fi

# libicu version prefer: libicu52 -> libicu55 -> libicu57 -> libicu60
apt install -y libicu52 || apt install -y libicu55 || apt install -y libicu57 || apt install -y libicu60
# libicu versions: libicu52 -> libicu55 -> libicu57 -> libicu60 -> libicu63
apt install -y libicu52 || apt install -y libicu55 || apt install -y libicu57 || apt install -y libicu60 || apt install -y libicu63
if [ $? -ne 0 ]
then
echo "'apt' failed with exit code '$?'"
Expand Down Expand Up @@ -111,18 +112,19 @@ then
exit 1
fi

# debian 9 use libssl1.0.2
# debian 10 uses libssl1.1
# debian 9 uses libssl1.0.2
# other debian linux use libssl1.0.0
apt-get install -y libssl1.0.0 || apt install -y libssl1.0.2
apt-get install -y libssl1.0.0 || apt-get install -y libssl1.0.2 || apt-get install -y libssl1.1
if [ $? -ne 0 ]
then
echo "'apt-get' failed with exit code '$?'"
print_errormessage
exit 1
fi

# libicu version prefer: libicu52 -> libicu55 -> libicu57 -> libicu60
apt-get install -y libicu52 || apt install -y libicu55 || apt install -y libicu57 || apt install -y libicu60
# libicu versions: libicu52 -> libicu55 -> libicu57 -> libicu60 -> libicu63
apt-get install -y libicu52 || apt-get install -y libicu55 || apt-get install -y libicu57 || apt-get install -y libicu60 || apt-get install -y libicu63
if [ $? -ne 0 ]
then
echo "'apt-get' failed with exit code '$?'"
Expand Down
24 changes: 12 additions & 12 deletions src/Misc/layoutroot/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $user_id -eq 0 -a -z "$AGENT_ALLOW_RUNASROOT" ]; then
exit 1
fi

# Check dotnet core 2.1 dependencies for Linux
# Check dotnet core 3.1 dependencies for Linux
if [[ (`uname` == "Linux") ]]
then
command -v ldd > /dev/null
Expand All @@ -20,30 +20,30 @@ then

ldd ./bin/libcoreclr.so | grep 'not found'
if [ $? -eq 0 ]; then
echo "Dependencies is missing for Dotnet Core 2.1"
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
echo "Dependencies is missing for .NET Core 3.1"
echo "Execute ./bin/installdependencies.sh to install any missing dependencies."
exit 1
fi

ldd ./bin/System.Security.Cryptography.Native.OpenSsl.so | grep 'not found'
if [ $? -eq 0 ]; then
echo "Dependencies is missing for Dotnet Core 2.1"
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
echo "Dependencies missing for .NET Core 3.1"
echo "Execute ./bin/installdependencies.sh to install any missing dependencies."
exit 1
fi

ldd ./bin/System.IO.Compression.Native.so | grep 'not found'
if [ $? -eq 0 ]; then
echo "Dependencies is missing for Dotnet Core 2.1"
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
echo "Dependencies missing for .NET Core 3.1"
echo "Execute ./bin/installdependencies.sh to install any missing dependencies."
exit 1
fi

ldd ./bin/System.Net.Http.Native.so | grep 'not found'
if [ $? -eq 0 ]; then
echo "Dependencies is missing for Dotnet Core 2.1"
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
exit 1
echo "Warning: on some platforms, libcurl3 is required."
echo "It was not found."
echo "Execute ./bin/installdependencies.sh to install missing dependencies."
fi

if ! [ -x "$(command -v ldconfig)" ]; then
Expand All @@ -59,8 +59,8 @@ then
libpath=${LD_LIBRARY_PATH:-}
$LDCONFIG_COMMAND -NXv ${libpath//:/} 2>&1 | grep libicu >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Libicu's dependencies is missing for Dotnet Core 2.1"
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
echo "libicu's dependencies missing for .NET Core 3.1"
echo "Execute ./bin/installdependencies.sh to install any missing dependencies."
exit 1
fi
fi
Expand Down
1 change: 1 addition & 0 deletions src/Test/L0/ConstantGenerationL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void BuildConstantGenerateSucceed()
"win-x86",
"linux-x64",
"linux-arm",
"linux-arm64",
"rhel.6-x64",
"osx-x64"
};
Expand Down
Loading

0 comments on commit ea34833

Please sign in to comment.