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

Parameterise execution of runner #122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kpturner
Copy link

@kpturner kpturner commented Nov 1, 2022

No description provided.

@esteve
Copy link

esteve commented May 3, 2023

@kpturner thanks for your PR. I've added your fork to https://github.com/esteve/autoware_packages/blob/main/.github/workflows/generate-debs-aws.yml#L21 but I can't seem to get the CI workflow to run as the ubuntu user (https://github.com/esteve/autoware_packages/blob/main/.github/workflows/generate-debs-aws.yml#L29-L30), is there anything that needs fixing in the workflow configuration?

@esteve
Copy link

esteve commented May 3, 2023

Forgot to link to a CI run (https://pipelines.actions.githubusercontent.com/serviceHosts/0571ff26-7fc8-4c97-8abd-f4480660739f/_apis/pipelines/1/runs/50/signedlogcontent/9?urlExpires=2023-05-03T11%3A18%3A46.7515461Z&urlSigningMethod=HMACV1&urlSignature=ff1ZpjWGpqtpPIOMonwu7zpYjPok%2BVFiRIzjtMTUG94%3D). I added a bunch of commands (whoami, id, etc) to the Debug step to check what user the action is running as, but it's root anyway, can't get it to switch to the ubuntu user.

@esteve
Copy link

esteve commented May 3, 2023

Never mind, I just realized that your PR doesn't have an up to date ./dist/index.js. After running npm run package and rebasing on top of main (https://github.com/esteve/ec2-github-runner/tree/Optionally-execute-runner-as-a-service), and attempting to run an action as ubuntu, the CI workflow gets stuck waiting for the EC2 instance to register on GitHub (see https://pipelines.actions.githubusercontent.com/serviceHosts/0571ff26-7fc8-4c97-8abd-f4480660739f/_apis/pipelines/1/runs/69/signedlogcontent/2?urlExpires=2023-05-03T13%3A39%3A00.4783305Z&urlSigningMethod=HMACV1&urlSignature=5cm9sDE4hEd%2F5KqxUYvc3RmZHzvsvUa9YRzFwP6UAcw%3D)

Is there a way to fix this? Thanks.

];
}
if (config.input.runAsUser) {
userData.push(`chown -R ${config.input.runAsUser} ${config.input.runnerHomeDir}`);
Copy link

Choose a reason for hiding this comment

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

Found the issue that made it not work in my case. If runner-home-dir is empty (i.e. we let the action download the runner code), but we set run-as-user, this won't work because chown expects two arguments. I fixed it by replacing ${config.input.runnerHomeDir} with ., which works because the current directory is already set earlier in cd "${config.input.runnerHomeDir}" or mkdir actions-runner && cd actions-runner

@esteve
Copy link

esteve commented May 16, 2023

@kpturner I've committed the fix I mentioned in #122 (comment) in my fork (https://github.com/esteve/ec2-github-runner/tree/Optionally-execute-runner-as-a-service). I've also rebased your changes on top of main and ran npm run package to update dist/index.js, since the changes to src/aws.js and dist/index.js in this PR were not in sync.

@Flyingliuhub
Copy link

any update on this? we need this for run as non-root. thanks

@alonbl
Copy link

alonbl commented Jul 17, 2023

Hi,
It would be great to run workfow as non-root similar to github environment. There are tools which are failing when running as root.
Also have the ability to select where the workspace is, so it can be redirected to a different filesystem.
Thanks,

@esteve
Copy link

esteve commented Jul 18, 2023

@Flyingliuhub @alonbl I've been updating this PR on top of main in #152 , which also contains a couple of fixes. We've been using these change at the Autoware Foundation for a while (see https://github.com/autowarefoundation/autoware-deb-packages)

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.

4 participants