game-ci / game-ci/unity-builder

Private repo clonining issue

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

Description

**Bug description**

I'm not 100% sure this is a bug but I can't find any resources on it anywhere. Essentially, I followed the docs on setting up multiple private repos on your unity app and when it gets to the stage to clone it errors on the hostname of the repo.

Here's the error:

```
An error occurred while resolving packages:
Project has invalid dependencies:
com.organization.project: Error when executing git command. ssh: Could not resolve hostname key-(long string of characters).github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

com.organization.project: Error when executing git command. ssh: Could not resolve hostname key-(long string of characters).github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

com.organization.project: Error when executing git command. ssh: Could not resolve hostname key-(long string of characters).github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
./External/baselib/builds/Include/Internal/../C/Internal/Baselib_Semaphore_FutexBased.inl.h(158): Assertion failed (count >= 0) - Destruction is not allowed when there are still threads waiting on the semaphore.
Trace/breakpoint trap
Build failed, with exit code 133
```

**How to reproduce**

My yml:

```
name: Build Unity App for Windows x64

on:
push:
branches:
- DevOpsTest

jobs:
build:
runs-on: self-hosted
steps:
- name: 'Add GitHub to the SSH known hosts file'
run: |
mkdir -p -m 0700 /home/runner/.ssh
curl --silent https://api.github.com/meta | jq --raw-output '"github.com "+.ssh_keys[]' >> /home/runner/.ssh/known_hosts
chmod 600 /home/runner/.ssh/known_hosts

# Checkout
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true

# Caching
- name: Restore Cache
uses: actions/cache@v3
with:
path: ./XRC360/Library
key: Library-XRC360-StandaloneWindows64
restore-keys: |
Library-XRC360-
Library-

- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: |
${{ secrets.FIRST_KEY }}
${{ secrets.SECOND_KEY }}
${{ secrets.THIRD_KEY }}

- name: Prepare SSH config for unity builder
run: |
mkdir -p $HOME/.ssh_docker
cp $HOME/.ssh/config $HOME/.ssh_docker/
cp $HOME/.ssh/key* $HOME/.ssh_docker/
cp $HOME/.ssh/known_hosts $HOME/.ssh_docker/
sed -i 's/\/home\/runner/\/root/g' $HOME/.ssh_docker/config
sudo chown -R root:root $HOME/.ssh_docker
GIT_CONFIG_EXTENSIONS=$(git config --list | grep '^url\.')
{
echo 'GIT_CONFIG_EXTENSIONS<> "$GITHUB_ENV"
shell: bash

# Build
- name: Build Project
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
sshAgent: ${{ env.SSH_AUTH_SOCK }}
sshPublicKeysDirectoryPath: ${{ env.HOME }}/.ssh_docker
customImage: 'unityci/editor:2022.3.11f1-base-3'
targetPlatform: StandaloneWindows64
allowDirtyBuild: true
projectPath: ./XRC360

# Upload artifact to GitHub
- uses: actions/upload-artifact@v3
with:
name: Build
path: build

```

Push to correct branch, wait

**Expected behavior**

Project to clone down dependencies.

**Additional details**

This is a self-hosted runner, to my knowledge I followed all of the correct steps. I configured my manifest.json to the SSH url too.

Contributor guide

Open the contributing guide

Research direction

Start with the workflow's SSH setup, especially the copied $HOME/.ssh_docker/config and the sshAgent and sshPublicKeysDirectoryPath inputs to game-ci/unity-builder. Check the project's manifest.json SSH dependency URL and reproduce on a self-hosted runner. Done means the private Unity dependencies clone without the hostname-resolution error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, git, github-actions, unity
Domain
ci-cd, devops, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.