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

Fix installation error on self-hosted runner #138

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

simonjur
Copy link

@simonjur simonjur commented Feb 13, 2024

Suffix download temporary file with version. Delete the temporary file after extraction.

Should fix #127

@simonjur simonjur force-pushed the fix-self-hosted-runner-install-issue branch from 149c29e to 6a81b92 Compare February 13, 2024 14:34
@simonjur simonjur changed the title fix installation error on self-hosted runner Fix installation error on self-hosted runner Feb 13, 2024
@simonjur simonjur force-pushed the fix-self-hosted-runner-install-issue branch from b5a8507 to 97d4517 Compare February 13, 2024 16:18
@simonjur simonjur force-pushed the fix-self-hosted-runner-install-issue branch from 97d4517 to 737ef29 Compare February 28, 2024 13:59
@soulseekah
Copy link

This works, however, I think that the download should not depend on the username (we use "root" on all our runners) but rather on the runner name instead.

@simonjur
Copy link
Author

Yes true. Good point. Let me fix it.

@simonjur
Copy link
Author

simonjur commented Aug 12, 2024

🤔 actually... it seems there is no (nice) way how to get the runner name from JS action actions/toolkit#1681
I'll investigate a bit more on this... (tomorrow)

@nashpaz123
Copy link

also waiting for the merge on this :-)

@soulseekah
Copy link

soulseekah commented Sep 5, 2024

Here's an idea: why not use - env and RUNNER_NAME: ${{ runner.name }}. And then use the environment variable via process.env as per usual? If it's not set use hostname.

I've also opened a discussion here https://github.com/orgs/community/discussions/137836 if you care to upvote :)

@soulseekah
Copy link

@simonjur https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables it seems that RUNNER_NAME environment variable should actually be there. But I'm not seeing it for some reason. Can you try?

@simonjur
Copy link
Author

simonjur commented Sep 6, 2024

@soulseekah many thanks for the suggestion 👍 . I was a bit stuck on this. Let me try it and get back to you (hopefully today)

@simonjur
Copy link
Author

simonjur commented Sep 6, 2024

Here's an idea: why not use - env and RUNNER_NAME: ${{ runner.name }}. And then use the environment variable via process.env as per usual? If it's not set use hostname.

I've also opened a discussion here https://github.com/orgs/community/discussions/137836 if you care to upvote :)

just a note to this solution. yep this would work and I was considering it...
but passing some env like: RUNNER_NAME: ${{ runner.name }} to this action just doesn't look good...
I mean it just doesn't fit to the other envs:

- uses: gitleaks/gitleaks-action@v2
  env:
    RUNNER_NAME: ${{ runner.name }}.   <-------------------- yep it would work but how is this related to what the action is actually doing? Looks more like a hack to me.
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.

But it's a good suggestion and a last-resort fallback maybe... we'll see 🙈

@simonjur
Copy link
Author

simonjur commented Sep 6, 2024

yep env var is there
self-hosted runner:

...
  "GITHUB_ACTION_REF": "main",
  "RUNNER_OS": "Linux",
  "RUNNER_ARCH": "X64",
  "RUNNER_NAME": "github-actions-runner24-1",
  "RUNNER_ENVIRONMENT": "self-hosted",   <-------------- THIS
  "RUNNER_TOOL_CACHE": "/home/actions-runner-1/runner/_work/_tool",
...

and like this on gh-hosted runner:

...
  "RUNNER_OS": "Linux",
  "RUNNER_ARCH": "X64",
  "RUNNER_NAME": "GitHub Actions 11",   <-------------- THIS
  "RUNNER_ENVIRONMENT": "github-hosted",
  "RUNNER_TEMP": "/home/runner/work/_temp",
...

let me finish this PR then...

@simonjur
Copy link
Author

simonjur commented Sep 6, 2024

fixed ✅

@simonjur simonjur force-pushed the fix-self-hosted-runner-install-issue branch from 8bd842f to 978f6e0 Compare October 14, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can not install gitleaks for selfhosted runner (Destination file path /tmp/gitleaks.tmp already exists)
4 participants