Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Problems with self-hosted runners #91

Closed
tegorov opened this issue May 23, 2022 · 7 comments
Closed

Problems with self-hosted runners #91

tegorov opened this issue May 23, 2022 · 7 comments
Labels
wontfix This will not be worked on

Comments

@tegorov
Copy link

tegorov commented May 23, 2022

There are two problems with self-hosted runners:

  1. Every run creates a new docker image.
  2. A container is run as root user, that causes some problems with the files in future runs

The first problem is solved by building a docker image and referencing it in a workflow:

- name: 'Create pull request'
  uses: docker://ghcr.io/tegorov/pull-request:v2.6.2
  with:
     source_branch: develop
  ...

The second problem is solved by passing USER_ID parameter in a container:

- name: 'Create pull request'
  uses: docker://ghcr.io/tegorov/pull-request:v2.6.2
  with:
     source_branch: develop
     ...
  env:
     USER_ID: 1000

Here is my pull request as an example #90

@tegorov tegorov changed the title Problems for self-hosted runners Problems with self-hosted runners May 23, 2022
@wei
Copy link
Member

wei commented Oct 31, 2022

Fixed

pull-request/action.yml

Lines 52 to 54 in 992f4d7

runs:
using: 'docker'
image: docker://ghcr.io/repo-sync/pull-request:v2.8

@wei wei closed this as completed Oct 31, 2022
@tegorov
Copy link
Author

tegorov commented Nov 1, 2022

@wei thanks, but you fixed only the first problem.
This pr #90 fixes the second problem.

@wei
Copy link
Member

wei commented Nov 1, 2022

Can you elaborate and provide reproduction steps?

causes some problems with the files in future runs

@wei wei reopened this Nov 1, 2022
@tegorov
Copy link
Author

tegorov commented Nov 2, 2022

Can you elaborate and provide reproduction steps?

When a container runs, it uses the root user by default, that new files created in a container will be added to a runner with root user permissions.
After the first run, next runs will fail at this step:
- uses: actions/checkout@v3
because a runner is using a different user (not root) and can not clear files with root permission (git clean)

jobs:
  pull-request:
    runs-on: [ self-hosted, Linux ]
    steps:
    - uses: actions/checkout@v3
    - uses: docker://ghcr.io/repo-sync/pull-request:v2.8 
      with:
        destination_branch: "main"
        github_token: ${{ secrets.GITHUB_TOKEN }}

@chosten
Copy link

chosten commented Nov 10, 2022

Same problem here, the workflow cannot run twice. Second run fails to delete files created with the root user by the first run.

@wei
Copy link
Member

wei commented Nov 10, 2022

The permission issue with self-hosted runners is a general issue that happens to all docker based actions on self-hosted runners.

You can find discussions, solutions, and provide feedback at actions/runner#434

I'm going to mark this as a wontfix for now but open to revisit in the future.

@wei wei closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2022
@wei wei added the wontfix This will not be worked on label Nov 10, 2022
@wei
Copy link
Member

wei commented Nov 11, 2022

Added a section to README: Docker Container Image Usage

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants