Skip to content

Parameterise execution of runner (update) #152

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

Merged
merged 5 commits into from
Mar 26, 2025

Conversation

esteve
Copy link
Contributor

@esteve esteve commented May 18, 2023

This is just #122 rebased on top of main and dist/index.js updated after running npm run package, all credit goes to @kpturner.

I've also fixed a small issue where if the CI job was set to run as a user, and let it download the GitHub runner code, it wouldn't work (see #122 (comment) for context, fix is in 35580d0)

@esteve
Copy link
Contributor Author

esteve commented May 18, 2023

@kpturner I hope it's ok with you I submitted this PR, I don't mean to take credit for your work, I've submitted it in the hopes that it'd be easier for @machulav to merge your work more quickly (dist/index.js up to date, fix for runner running as a user).

@kpturner
Copy link
Contributor

@kpturner I hope it's ok with you I submitted this PR, I don't mean to take credit for your work, I've submitted it in the hopes that it'd be easier for @machulav to merge your work more quickly (dist/index.js up to date, fix for runner running as a user).

It is fine by me - as long as it helps somebody I am not bothered about who gets the credit :)

@esteve esteve force-pushed the Optionally-execute-runner-as-a-service branch from e78e760 to 07e593a Compare July 12, 2023 10:03
@esteve
Copy link
Contributor Author

esteve commented Jul 12, 2023

@machulav I've rebased this PR on top of main to fix the conflicts. Is there anything that needs to be addressed before being merged? Thanks.

userData.push(`./svc.sh install ${config.input.runAsUser || ''}`);
userData.push('./svc.sh start');
} else {
userData.push(`${config.input.runAsUser ? `su ${config.input.runAsUser} -c` : ''} ./run.sh`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if run.sh supports only running as root then why do we run it under regular user? and if it supported the description of run-runner-as-user parameter should be updated.

and if this is possible why do we need to run it as a service?

also, won't it better to create the user within this script? also add it to sudoers to be closer to github environment?

src/aws.js Outdated
@@ -27,9 +29,18 @@ function buildUserDataScript(githubRegistrationToken, label) {
'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have a parameter/config to specify in which directory we want to extract and run the runner, optionally take some default from the image so the image may specify that.

setting this directory will allow to run the runner on differnt volume than the rootfs, which is large enough to run the job.

@esteve
Copy link
Contributor Author

esteve commented Jul 19, 2023

@alonbl I know nothing about Javascript, I only updated #122 and fixed a bug to make it easier for @machulav to merge this PR as we're currently using at the Autoware Foundation, but if there's any improvements missing, feel free to submit a PR targeting this one, I'm more than happy to incorporate your changes. Thanks!

@hvgazula
Copy link

Hello! Any chance this PR will be merged to enable running the ec2 self-hosted runner as non-root?

@esteve
Copy link
Contributor Author

esteve commented Feb 14, 2024

@machulav @hvgazula we've been using this branch for the past eight months at the Autoware Foundation without an issue, but I'd prefer it to get merged instead of using our fork. Is there any feedback I should address? Thanks.

@hvgazula
Copy link

@machulav @hvgazula we've been using this branch for the past eight months at the Autoware Foundation without an issue, but I'd prefer it to get merged instead of using our fork. Is there any feedback I should address? Thanks.

Thank you for replying @esteve. Is it on the main branch of your fork? I agree it'd be nice to have this feature merged in here. I'll ask this again for attention :). @machulav any chance you can merge this feature?

@esteve
Copy link
Contributor Author

esteve commented Feb 14, 2024

@hvgazula it's here https://github.com/esteve/ec2-github-runner/tree/Optionally-execute-runner-as-a-service

My fork is just an updated version of @kpturner 's work from #122 plus a couple of minor fixes needed to run as a non-root user.

@hvgazula
Copy link

Thanks, @esteve. It worked.

@thimios
Copy link

thimios commented Apr 16, 2024

@machulav we also need to run specs as a non-root user, it would be great to see this merged

@Preen
Copy link
Collaborator

Preen commented Oct 30, 2024

@esteve and @kpturner can you resolve the conflicts, and I will test it out and merge it into main asap.

@esteve
Copy link
Contributor Author

esteve commented Mar 25, 2025

@Preen sorry, I somehow missed your comment from months ago, I'll update the PR. Thanks.

@esteve esteve force-pushed the Optionally-execute-runner-as-a-service branch from 07e593a to e4f971f Compare March 25, 2025 12:04
@esteve esteve force-pushed the Optionally-execute-runner-as-a-service branch from e4f971f to a36f21d Compare March 25, 2025 12:08
@esteve
Copy link
Contributor Author

esteve commented Mar 25, 2025

@Preen I've fixed the conflicts and ran npm run package to update dist/index.js, let me know if there's more feedback to address. However, I know next to nothing about Javascript, I merely updated @kpturner 's work and fixed a couple of bugs, so feel free to push any changes you think this PR needs. Thanks!

@lifeisafractal
Copy link
Contributor

@esteve Thanks for keeping up on this one. I'd love to see this merged into this repo so I can go back to using the main upstream. FYI, I was pointing at your branch and the recent rebase seems to have borken things (I opened a PR to your fork just to highlight it).

@esteve
Copy link
Contributor Author

esteve commented Mar 25, 2025

@lifeisafractal I've just merged your changes, thanks! 🙂

@esteve
Copy link
Contributor Author

esteve commented Mar 26, 2025

@lifeisafractal I ran npm run package, but looks like I must be missing something. This is what I did before your fix:

docker run -e NODE_OPTIONS=--openssl-legacy-provider -it --rm -v `pwd`:`pwd` -w `pwd` node sh -c "npm run package"

I'm working on adding an option to set the root volume size in another branch, but after running npm run package, it seems to be broken. Is there anything I should be running instead? Thanks.

@esteve
Copy link
Contributor Author

esteve commented Mar 26, 2025

@lifeisafractal looks like I had a node_modules directory, I removed that and after running npm run package the action works, I really don't know anything about Node 😅

@lifeisafractal
Copy link
Contributor

@esteve I'm not far (if at all) ahead of you with Node. I did a fresh clone with a npm install followed by npm run package and that did the trick. I don't know too much more than that Glad you got things working!

@Preen Preen merged commit cd07fa6 into machulav:main Mar 26, 2025
@Preen
Copy link
Collaborator

Preen commented Mar 26, 2025

Tested successfully, merged!

@esteve esteve deleted the Optionally-execute-runner-as-a-service branch April 7, 2025 13:05
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.

7 participants