Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: compatibility with self-hosted runners with SELinux #355

Merged
merged 6 commits into from
Mar 11, 2022

Conversation

paulpach
Copy link
Contributor

@paulpach paulpach commented Mar 11, 2022

When using a self-hosted runner with SELinux (fedora)
volumes need to be mounted with ":z" in order to have write access
these flags are documented here

Also the in self-hosted runners, _temp is empty, so this creates the child folders.

Changes

  • mount volumes with SELinux labels
  • create folders _github_home and _github_workflow if they are missing

Checklist

  • Read the contribution guide and accept the code of conduct
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

When using a self-hosted runner with SELinux (fedora)
volumes need to be mounted with ":z" in order to have write access

these flags are documented [here](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label)
@github-actions
Copy link

Cat Gif

Comment on lines 47 to 50
const github_home = join(runnerTemporaryPath, "_github_home");
existsSync(github_home) || mkdirSync(github_home);
const github_workflow = join(runnerTemporaryPath, "_github_workflow");
existsSync(github_workflow) || mkdirSync(github_workflow);
Copy link
Member

Choose a reason for hiding this comment

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

I believe these directories should exist according to the spec. Could you explain a little bit about why this is needed?

Also prefer the more semantic if(condition) // do something over || which makes the code harder to read for new developers

Copy link
Contributor Author

@paulpach paulpach Mar 11, 2022

Choose a reason for hiding this comment

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

They do exist in github runners, but when running in self-hosted runners, the _temp folder is completely empty.

I get this error:

Error: statfs /var/github/_temp/_github_home: no such file or directory
Error: The process '/usr/bin/docker' failed with exit code 125

I worked around the problem by doing this in my workflow:

      # this is a workaround for self hosted runners
      - name: Create Folders
        run: |
          cd $RUNNER_TEMP
          mkdir -p _github_home
          mkdir -p _github_workflow
      - uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          targetPlatform: StandaloneLinux64
          buildMethod: com.mindblocks.build.BuildAutomation.LinuxServer

and that worked.

I will change them to if

@webbertakken
Copy link
Member

webbertakken commented Mar 11, 2022

Could you run yarn husky install? Looks like none of the hooks are working for you.

Also make sure you install ESLint and Prettier plugins in your editor.

paulpach added a commit to paulpach/unity-test-runner that referenced this pull request Mar 11, 2022
similar to game-ci/unity-builder#355

* Use $RUNNER_TEMP variable instead of hardcoded path for _github_home and _github_workflow
* create the folders if they don't exist
* mount volumes with :z for compatibility with SELinux
paulpach added a commit to paulpach/unity-test-runner that referenced this pull request Mar 11, 2022
similar to game-ci/unity-builder#355

* Use $RUNNER_TEMP variable instead of hardcoded path for _github_home and _github_workflow
* create the folders if they don't exist
* mount volumes with :z for compatibility with SELinux
@webbertakken webbertakken merged commit 9358a3a into game-ci:main Mar 11, 2022
@webbertakken
Copy link
Member

Thank you very much!

webbertakken pushed a commit to game-ci/unity-test-runner that referenced this pull request Mar 11, 2022
* feat: support self-hosted runners

similar to game-ci/unity-builder#355

* Use $RUNNER_TEMP variable instead of hardcoded path for _github_home and _github_workflow
* create the folders if they don't exist
* mount volumes with :z for compatibility with SELinux

* compile typescript files
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants