azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

Add preliminary support for linux-arm64

Open amih90 opened this issue 1 year ago • 11 comments

Add support for Debian11 (bulleye) on ARM64.

Issue describing the changes in this PR

resolves #3112

Pull request checklist

  • [X] My changes do not require documentation changes
    • [ ] Otherwise: Documentation issue linked to PR
  • [ ] My changes do not need to be backported to a previous version
    • [ ] Otherwise: Backport tracked by issue/PR #issue_or_pr
  • [ ] I have added all required tests (Unit tests, E2E tests)

amih90 avatar Jan 26 '24 07:01 amih90

@vrdmr @Francisco-Gamino @andystaples @amamounelsayed @ejizba @hossam-nasr @AnatoliB @khkh-ms

This PR was opened 2 months ago. Can somebody review it?

EverybodyKurts avatar Mar 28 '24 17:03 EverybodyKurts

/azp run

khkh-ms avatar Apr 08 '24 16:04 khkh-ms

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Apr 08 '24 16:04 azure-pipelines[bot]

@khkh-ms Thanks for the review! FYI it appears the test failure is just a missing config in the test environment, and it's not clear to me why that'd be related to the current change.

image

alecglen avatar Apr 10 '24 19:04 alecglen

/azp run

amih90 avatar Apr 19 '24 09:04 amih90

Commenter does not have sufficient privileges for PR 3584 in repo Azure/azure-functions-core-tools

azure-pipelines[bot] avatar Apr 19 '24 09:04 azure-pipelines[bot]

The test is failing with the single following error: AZURE_MANAGEMENT_ACCESS_TOKEN is not defined in current environment

dirkesquire avatar May 02 '24 17:05 dirkesquire

I've determined that "AZURE_MANAGEMENT_ACCESS_TOKEN" is referred to in only two places:

https://github.com/Azure/azure-functions-core-tools/blob/605b8b4257eb7122e552cb99157ca1fe006095f5/azure-pipelines.yml#L90

 - task: AzureCLI@2
    displayName: Login via Azure CLI to acquire access token
    inputs:
      azureSubscription: $(E2ETestServiceConnectionName)
      scriptType: ps
      scriptLocation: inlineScript
      inlineScript: |
        # acquire access token from Azure CLI and export it to AZURE_MANAGEMENT_ACCESS_TOKEN
        $accessToken = (az account get-access-token --query "accessToken" | % { $_.Trim('"') })
        echo "##vso[task.setvariable variable=azure_management_access_token]$accessToken"

https://github.com/Azure/azure-functions-core-tools/blob/605b8b4257eb7122e552cb99157ca1fe006095f5/src/Azure.Functions.Cli/Common/Constants.cs#L53

dirkesquire avatar May 06 '24 07:05 dirkesquire

The error is being thrown from this piece of code:

        protected static string AccessToken
        {
            get
            {
                if (_accessToken == null)
                {
                    _accessToken = Environment.GetEnvironmentVariable(Constants.AzureManagementAccessToken);
                    if (string.IsNullOrEmpty(_accessToken))
                    {
                        throw new Exception($"{Constants.AzureManagementAccessToken} is not defined in current environment");
                    }
                }
                return _accessToken;
            }
        }

at Azure.Functions.Cli.Tests.E2E.AzureResourceManagers.BaseAzureResourceManager.get_AccessToken()

Which seems to indicate that, exactly as expected and mentioned above, an environment variable is not being set for this test environment, and that that is the reason this entire PR is being held back, and not an issue with the code in the PR itself.

So what can we do next to push this forward? At the moment the community can not actually run Azure Functions in a dev container on a M1,M2 Mac. This is such a blocker. Should we be looking to try and build the solution locally, and patch it ourselves?

dirkesquire avatar May 06 '24 07:05 dirkesquire

I did manage to have some level of success with the fix. I cloned azure-functions-core-tools locally, and applied the changes, and successfully built and published the solution so that I can now run func locally without errors. Hours spent on this because the Microsoft team does not have the time to spend on this PR.

The next problem that I am facing is that there is no worker for workers/python/3.11/LINUX/Arm64. Please can someone give some advice on how I would arrange to create this worker. (The worker LINUX/x86 does exist, but not the Arm64 one)

Thank you!

dirkesquire avatar May 08 '24 15:05 dirkesquire

@dirkesquire where is it missing from exactly? I've been trying to trace this through and it seems like the Arm64 version should exist: https://github.com/Azure/azure-functions-python-worker/blob/cd13c6aa1db0aba958f4aedded80254d69040899/python/prodV4/worker.config.json#L7

alecglen avatar May 22 '24 15:05 alecglen

Any updates?

joeuy avatar Jan 06 '25 21:01 joeuy

I managed to get this working in WSL2 with node.js with the premilinary changes in this pull request. I updated the changes mentioned here to the latest release. Would be really nice if this could be officially supported.

jhholm avatar Feb 07 '25 11:02 jhholm

I also managed to finally get this working for linux-arm64 inside a DevContainer on Apple Mac Silicon. The python worker for linux-arm64 never gets populated and is completely missing. So it means you cannot run the func cli command inside a Devcontainer on any Apple Mac released after 2020 (i.e. with the M series Apple Silicon chip (not Intel)). If I find some time I may try to submit a pull request.

@alecglen When you checkout azure-function-core-tools on the Release_4.0 branch and build and publish then you will notice that /path/to/publishfolder/workers/python/3.X/LINUX/Arm64 does not exist. Only the X64 version gets built for Linux currently.

dirkesquire avatar Feb 07 '25 14:02 dirkesquire

Hi folks, ownership of this repo recently changed. I'll make this a priority for us to review & merge in our upcoming sprint.

path/to/publishfolder/workers/python/3.X/LINUX/Arm64 does not exist. Only the X64 version gets built for Linux currently.

I can also look into this as well

liliankasem avatar Feb 07 '25 18:02 liliankasem

I’m incredibly excited to see this pull request completed! As someone who works with Azure Functions extensively, I believe this improvement will make a massive difference in my workflow and efficiency. I appreciate the effort that went into this—thank you for pushing this forward! @liliankasem

JoJoAtkinson avatar Feb 21 '25 12:02 JoJoAtkinson

Hi folks, wanted to share an update on this.

Previously, python has been a blocker for getting arm64 out on other platforms, however I believe this is no longer the case and shouldn’t be blocking progress on this.

python/3.X/LINUX/Arm64 does not exist. Only the X64 version gets built for Linux currently.

The python team is looking into adding a arm64 build to the worker package. This will be a pre-requisite before we move forward.

As for next steps, we are thinking to take this into a feature branch to work on testing/validation. This will also allow us to release a preview version of Core Tools to gather feedback about potential issues.

Going forward, updates will be provided in the corresponding issue: #4279

liliankasem avatar Feb 21 '25 19:02 liliankasem

/azp run

liliankasem avatar Feb 21 '25 19:02 liliankasem

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

azure-pipelines[bot] avatar Feb 21 '25 19:02 azure-pipelines[bot]

Merging and will address tests in my own PR.

liliankasem avatar Feb 21 '25 19:02 liliankasem

200w

kurt-mueller-osumc avatar Feb 21 '25 19:02 kurt-mueller-osumc