Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All dotnet commands fail due to environment variables #510

Closed
2 of 6 tasks
william-dafriend opened this issue Feb 19, 2024 · 6 comments
Closed
2 of 6 tasks

All dotnet commands fail due to environment variables #510

william-dafriend opened this issue Feb 19, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@william-dafriend
Copy link

Description:
All attempts at using the action fail with the following error

/usr/share/dotnet/sdk/8.0.101/NuGet.targets(424,5): error MSB4018: System.InvalidOperationException: Required environment variable 'HOME' is not set. Try setting 'DOTNET_CLI_HOME' or 'HOME' and running the operation 

Task version:
version 4

Platform:

  • Ubuntu
  • macOS
  • Windows
  • Debian

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Attempt to run an action using setup-dotnet/v4 and call any dotnet command

Expected behavior:
commands should complete successfully

Actual behavior:
Comamnds return errors about missing environment variables

All dotnet commands work fine in the _work directory directly on the runner. I have tried explicitly setting HOME and DOTNET_CLI_HOME environment variables in the action itself. These variables are both set and exported for the user on the github runner.

@william-dafriend william-dafriend added bug Something isn't working needs triage labels Feb 19, 2024
@HarithaVattikuti
Copy link
Contributor

Hello @william-dafriend
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@gd-pmayhew
Copy link

@william-dafriend If you are running your action-runner as a service on Linux, make sure the service is installed to use a user account, otherwise it will default to root; where these aren't defined. If you want to use root, then export DONET_CLI_HOME=/tmp and that will get you past this issue.

@aparnajyothi-y aparnajyothi-y self-assigned this Feb 27, 2024
@aparnajyothi-y
Copy link

aparnajyothi-y commented Mar 19, 2024

Hello @william-dafriend, Thank you for creating the issue and we have investigated the issue. Understood that
you have tried setting both the HOME and DOTNET_CLI_HOME environment variables directly in the action itself and you might do this in a workflow file:

steps:

  • name: Set Environment Variables
    run: |
    echo ""DOTNET_CLI_HOME=$HOME"" >> $GITHUB_ENV
    echo ""HOME=$HOME"" >> $GITHUB_ENV
  • name: Run dotnet command
    run: dotnet build

We have tested the same in our local, able to set the the environment variables through the workflow and the commands are successful. Please find the screenshot for reference.

image

Please confirm whether you have set the env variables by following the above step in your workflow.

@aparnajyothi-y
Copy link

Hello @william-dafriend, Please confirm whether you have set the env variables by following the above step in your workflow.

1 similar comment
@aparnajyothi-y
Copy link

Hello @william-dafriend, Please confirm whether you have set the env variables by following the above step in your workflow.

@aparnajyothi-y
Copy link

Closing this issue as we don't hear any response from long time. Please feel free to reach us if you are still facing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants