Skip to content

Parameterise execution of runner (update)#152

Merged
Preen merged 5 commits into
machulav:mainfrom
esteve:Optionally-execute-runner-as-a-service
Mar 26, 2025
Merged

Parameterise execution of runner (update)#152
Preen merged 5 commits into
machulav:mainfrom
esteve:Optionally-execute-runner-as-a-service

Conversation

@esteve

@esteve esteve commented May 18, 2023

Copy link
Copy Markdown
Contributor

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

esteve commented May 18, 2023

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

esteve commented Jul 12, 2023

Copy link
Copy Markdown
Contributor Author

@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.

Comment thread src/aws.js
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
Copy Markdown

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?

Comment thread 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
Copy Markdown

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

esteve commented Jul 19, 2023

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

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

@esteve

esteve commented Feb 14, 2024

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

@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

esteve commented Feb 14, 2024

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

Thanks, @esteve. It worked.

@thimios

thimios commented Apr 16, 2024

Copy link
Copy Markdown

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

@Preen

Preen commented Oct 30, 2024

Copy link
Copy Markdown
Collaborator

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

@esteve

esteve commented Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

@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

esteve commented Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

esteve commented Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

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

@esteve

esteve commented Mar 26, 2025

Copy link
Copy Markdown
Contributor Author

@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

esteve commented Mar 26, 2025

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

Preen commented Mar 26, 2025

Copy link
Copy Markdown
Collaborator

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