game-ci / game-ci/unity-builder

UPM authentication and runAsHostUser on self-hosted linux runner

Open
#660 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
1.1k
Forks
313
Avg merge
1h 39m
Merged PRs (30d)
1

Description

**Bug description**

I created a self-hosted Linux runner for GitHub, to build my unity app. When I set the unity-builder `runAsHosteUser` to true authentication to UPM Server fails:
```
An error occurred while resolving packages:
Project has invalid dependencies:
com.neobird.bootstrap: Request [GET ] failed because it lacks valid authentication credentials
```

**How to reproduce**

Install Linux runner like described on:
https://game.ci/docs/self-hosting/host-provisioning/ubuntu-setup

Use these two steps:
```yaml
- name: Setup UPM Authentication
timeout-minutes: 10
run: |
mkdir ${{ runner.temp }}/_github_home
cd ${{ runner.temp }}/_github_home
echo "[npmAuth.\"my verdaccio url"]" >> .upmconfig.toml
echo "alwaysAuth = true" >> .upmconfig.toml
echo "token = \"${{ secrets.NPM_AUTH_TOKEN }}\"" >> .upmconfig.toml

```
and
```yaml
- name: Unity Build (${{ matrix.targetPlatform }}, ${{ matrix.buildProfile }}, ${{ matrix.unityVersion }})
uses: game-ci/unity-builder@v4
timeout-minutes: 60
env:
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
runAsHostUser: ${{ matrix.runAsHostUser }}
versioning: Semantic
dockerWorkspacePath: /github/workspace
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
buildMethod: NeoBird.Build.BuildScript
customParameters: '-buildProfile ${{ matrix.buildProfile }
```

`matrix.runAsHostUser` of course is true.

**Expected behavior**

UPM packages should be resolved.

Maybe it's because of step Setup, UPM Authentication does not run as HostUser.
Thx for your help.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Setup UPM Authentication step with the unity-builder@v4 step when runAsHostUser is true, using the self-hosted Ubuntu setup as context. Reproduce the workflow and verify that the UPM package request succeeds with valid authentication credentials while running as the host user.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, linux, unity
Domain
authentication, ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.