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

Support non-ephemeral runners #58

Closed
toast-gear opened this issue Oct 4, 2021 · 0 comments · Fixed by #59
Closed

Support non-ephemeral runners #58

toast-gear opened this issue Oct 4, 2021 · 0 comments · Fixed by #59

Comments

@toast-gear
Copy link

toast-gear commented Oct 4, 2021

Feature
Ensure that any files / folders that get touched by this action in the mounted workspace have thier permissions fixed back to their original owner (probably the owner of the $GITHUB_WORKSPACE)

Problem
As it stands when you use this action the .terraform folder will have its owner set to root root as the container makes changes to the files (as well as any other file or folder the container creates / updates). This then results in the next run of the workflow failing as the checkout action fails to delete the .terraform folder due to it being owned by root root rather than the user running the actions service.

To wokraround this you can use the action peter-murray/reset-workspace-ownership-action to reset the permissions on the repository code.

      - name: Get Actions user id
        id: get_uid
        run: |
          actions_user_id=`id -u $USER`
          echo $actions_user_id
          echo ::set-output name=uid::$actions_user_id
      - name: Correct Ownership in GITHUB_WORKSPACE directory
        uses: peter-murray/reset-workspace-ownership-action@v1
        with:
          user_id: ${{ steps.get_uid.outputs.uid }}

This is faff though and needs to be done in any workflow that uses this action, it should be handled natively or there be an input that can solve this.

https://vsupalov.com/docker-shared-permissions/ Basically support this problem.

EDIT For posterity's sake this is the type of error you'll get due to docker messing with the permission bits of files / folders it touches:

Run actions/checkout@v2
Syncing repository: owner/repo
Getting Git version info
Deleting the contents of '/actions-runner/_work/repo/repo'
Error: Command failed: rm -rf "/actions-runner/_work/repo/repo/.terraform"
rm: cannot remove '/actions-runner/_work/repo/repo/.terraform/modules/modules.json': Permission denied
@toast-gear toast-gear changed the title Add the ability to define a container --user as an input Support non-ephemeral runners Oct 8, 2021
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 a pull request may close this issue.

1 participant