From 10bf71da886a4a2f4859ed079a85c5007241a8fa Mon Sep 17 00:00:00 2001 From: DenisRumyantsev Date: Wed, 10 Apr 2024 13:01:06 +0200 Subject: [PATCH] linux-musl-arm64 --- .azure-pipelines/pipeline.yml | 23 +++++++++++++++++++++++ .vsts.ci.yml | 5 +++++ assets.json | 6 ++++++ releaseNote.md | 10 ++++++++++ src/Agent.Worker/JobExtension.cs | 6 +++--- src/Common.props | 3 +++ src/Misc/InstallAgentPackage.template.xml | 7 ++++++- src/Misc/Publish.template.ps1 | 2 ++ src/Misc/externals.sh | 9 +++++++++ src/Test/L0/ConstantGenerationL0.cs | 1 + src/dev.sh | 5 ++++- 11 files changed, 72 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/pipeline.yml b/.azure-pipelines/pipeline.yml index 877e841ddf..62b4c2622c 100644 --- a/.azure-pipelines/pipeline.yml +++ b/.azure-pipelines/pipeline.yml @@ -51,6 +51,9 @@ parameters: - name: alpine_x64 type: boolean default: true +- name: alpine_arm64 + type: boolean + default: true - name: macOS_x64 type: boolean default: true @@ -241,6 +244,26 @@ extends: publishArtifacts: ${{ parameters.publishArtifacts }} buildAlternatePackage: false + # Alpine (ARM64) + - ${{ if parameters.alpine_arm64 }}: + - template: /.azure-pipelines/build-jobs.yml@self + parameters: + jobName: build_alpine_arm64 + displayName: Alpine (ARM64) + pool: + name: 1ES-ABTT-Shared-ARM-64-Pool + vmImage: abtt-mariner_arm64 + os: linux + # container: # arm64v8/alpine (N/A) + os: linux-musl + arch: arm64 + branch: ${{ parameters.branch }} + unitTests: ${{ parameters.test }} + functionalTests: false + sign: false + publishArtifacts: ${{ parameters.publishArtifacts }} + buildAlternatePackage: false + # macOS (x64) - ${{ if parameters.macOS_x64 }}: - template: /.azure-pipelines/build-jobs.yml@self diff --git a/.vsts.ci.yml b/.vsts.ci.yml index 2cae42a6de..c3f4bfe6a2 100644 --- a/.vsts.ci.yml +++ b/.vsts.ci.yml @@ -30,6 +30,10 @@ parameters: type: boolean displayName: Alpine (x64) default: true +- name: alpine_arm64 + type: boolean + displayName: Alpine (ARM64) + default: true - name: macOS_x64 type: boolean displayName: macOS (x64) @@ -59,5 +63,6 @@ extends: linux_arm: ${{ parameters.linux_arm }} linux_arm64: ${{ parameters.linux_arm64 }} alpine_x64: ${{ parameters.alpine_x64 }} + alpine_arm64: ${{ parameters.alpine_arm64 }} macOS_x64: ${{ parameters.macOS_x64 }} macOS_arm64: ${{ parameters.macOS_arm64 }} diff --git a/assets.json b/assets.json index c09cd710b1..de0750d57f 100644 --- a/assets.json +++ b/assets.json @@ -88,5 +88,11 @@ "platform": "linux-musl-x64", "version": "", "downloadUrl": "https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-x64-.tar.gz" + }, + { + "name": "vsts-agent-linux-musl-arm64-.tar.gz", + "platform": "linux-musl-arm64", + "version": "", + "downloadUrl": "https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-arm64-.tar.gz" } ] diff --git a/releaseNote.md b/releaseNote.md index b094608827..2dc54e8ebc 100644 --- a/releaseNote.md +++ b/releaseNote.md @@ -11,6 +11,7 @@ | Linux ARM | [vsts-agent-linux-arm-.tar.gz](https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-arm-.tar.gz) | | | Linux ARM64 | [vsts-agent-linux-arm64-.tar.gz](https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-arm64-.tar.gz) | | | Linux musl x64 | [vsts-agent-linux-musl-x64-.tar.gz](https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-x64-.tar.gz) | | +| Linux musl ARM64 | [vsts-agent-linux-musl-arm64-.tar.gz](https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-arm64-.tar.gz) | | After Download: @@ -65,13 +66,22 @@ C:\myagent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO ## Alpine x64 +***Note:*** Node 6 does not exist for Alpine. + ``` bash ~/$ mkdir myagent && cd myagent ~/myagent$ tar xzf ~/Downloads/vsts-agent-linux-musl-x64-.tar.gz ``` +## Alpine ARM64 + ***Note:*** Node 6 does not exist for Alpine. +``` bash +~/$ mkdir myagent && cd myagent +~/myagent$ tar xzf ~/Downloads/vsts-agent-linux-musl-ARM64-.tar.gz +``` + ## Alternate Agent Downloads Alternate packages below do not include Node 6 and are only suitable for users who do not use Node 6 dependent tasks. diff --git a/src/Agent.Worker/JobExtension.cs b/src/Agent.Worker/JobExtension.cs index 390f1f37e1..48de8f2e30 100644 --- a/src/Agent.Worker/JobExtension.cs +++ b/src/Agent.Worker/JobExtension.cs @@ -169,13 +169,13 @@ public async Task> InitializeJob(IExecutionContext jobContext, Pipel var taskManager = HostContext.GetService(); await taskManager.DownloadAsync(context, message.Steps); - if (!AgentKnobs.DisableNode6Tasks.GetValue(context).AsBoolean()) + if (!AgentKnobs.DisableNode6Tasks.GetValue(context).AsBoolean() && !PlatformUtil.RunningOnAlpine) { Trace.Info("Downloading Node 6 runner."); var nodeUtil = new NodeJsUtil(HostContext); await nodeUtil.DownloadNodeRunnerAsync(context, register.Token); - } - + } + // Parse all Task conditions. Trace.Info("Parsing all task's condition inputs."); var expression = HostContext.GetService(); diff --git a/src/Common.props b/src/Common.props index e4159ce0d2..d680e37ab1 100644 --- a/src/Common.props +++ b/src/Common.props @@ -52,6 +52,9 @@ X64 + + ARM64 + ARM diff --git a/src/Misc/InstallAgentPackage.template.xml b/src/Misc/InstallAgentPackage.template.xml index 574ae727c3..4c60a4f9bf 100644 --- a/src/Misc/InstallAgentPackage.template.xml +++ b/src/Misc/InstallAgentPackage.template.xml @@ -44,11 +44,16 @@ - + + + + + + diff --git a/src/Misc/Publish.template.ps1 b/src/Misc/Publish.template.ps1 index 8d0f3695e5..5d71b86336 100644 --- a/src/Misc/Publish.template.ps1 +++ b/src/Misc/Publish.template.ps1 @@ -18,6 +18,8 @@ if ($pwd -notlike '*tfsgheus20') { Add-DistributedTaskPackage -PackageType agent -Platform linux-musl-x64 -Version -DownloadUrl https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-x64-.tar.gz -HashValue -InfoUrl https://go.microsoft.com/fwlink/?LinkId=798199 -Filename vsts-agent-linux-musl-x64-.tar.gz + Add-DistributedTaskPackage -PackageType agent -Platform linux-musl-arm64 -Version -DownloadUrl https://vstsagentpackage.azureedge.net/agent//vsts-agent-linux-musl-arm64-.tar.gz -HashValue -InfoUrl https://go.microsoft.com/fwlink/?LinkId=798199 -Filename vsts-agent-linux-musl-arm64-.tar.gz + Add-DistributedTaskPackage -PackageType agent -Platform osx-arm64 -Version -DownloadUrl https://vstsagentpackage.azureedge.net/agent//vsts-agent-osx-arm64-.tar.gz -HashValue -InfoUrl https://go.microsoft.com/fwlink/?LinkId=798199 -Filename vsts-agent-osx-arm64-.tar.gz # alternate packages diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh index ddc1b3c3dc..b35ec7e057 100644 --- a/src/Misc/externals.sh +++ b/src/Misc/externals.sh @@ -201,6 +201,15 @@ else ARCH="darwin-arm64" acquireExternalTool "${NODE_URL}/v${NODE16_VERSION}/node-v${NODE16_VERSION}-${ARCH}.tar.gz" node16 fix_nested_dir acquireExternalTool "${NODE_URL}/v${NODE20_VERSION}/node-v${NODE20_VERSION}-${ARCH}.tar.gz" node20_1 fix_nested_dir + elif [[ "$PACKAGERUNTIME" == "linux-musl-arm64" ]]; then + ARCH="linux-arm64-musl" + + if [[ "$INCLUDE_NODE10" == "true" ]]; then + acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE10_VERSION}-${ARCH}.tar.gz" node10/bin fix_nested_dir + fi + + acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE16_VERSION}-${ARCH}.tar.gz" node16/bin fix_nested_dir + acquireExternalTool "${CONTAINER_URL}/nodejs/${ARCH}/node-v${NODE20_VERSION}-${ARCH}.tar.gz" node20_1/bin fix_nested_dir else case $PACKAGERUNTIME in "linux-musl-x64") ARCH="linux-x64-musl";; diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs index 3fb16f4c27..64d2f3a085 100644 --- a/src/Test/L0/ConstantGenerationL0.cs +++ b/src/Test/L0/ConstantGenerationL0.cs @@ -21,6 +21,7 @@ public void BuildConstantGenerateSucceed() "linux-arm", "linux-arm64", "linux-musl-x64", + "linux-musl-arm64", "osx-x64", "osx-arm64" }; diff --git a/src/dev.sh b/src/dev.sh index ab5a3348e4..3424075fb3 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -75,6 +75,9 @@ function detect_platform_and_runtime_id () if [ -e /etc/alpine-release ]; then DETECTED_RUNTIME_ID='linux-musl-x64' + if [ $(uname -m) == 'aarch64' ]; then + DETECTED_RUNTIME_ID='linux-musl-arm64' + fi fi elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then DETECTED_RUNTIME_ID='osx-x64' @@ -298,7 +301,7 @@ else RUNTIME_ID=$DETECTED_RUNTIME_ID fi -_VALID_RIDS='linux-x64:linux-arm:linux-arm64:linux-musl-x64:osx-x64:osx-arm64:win-x64:win-x86' +_VALID_RIDS='linux-x64:linux-arm:linux-arm64:linux-musl-x64:linux-musl-arm64:osx-x64:osx-arm64:win-x64:win-x86' if [[ ":$_VALID_RIDS:" != *:$RUNTIME_ID:* ]]; then failed "must specify a valid target runtime ID (one of: $_VALID_RIDS)" fi