unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

Private repo clonining issue

Open Oolix opened this issue 1 year ago • 2 comments

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/[email protected]
        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<<EOF'
            echo "$GIT_CONFIG_EXTENSIONS"
            echo EOF
          } >> "$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.

Oolix avatar Jan 10 '24 16:01 Oolix

bump

Oolix avatar Feb 12 '24 16:02 Oolix

It seems to not be able to resolve the hostname from the context of your runner.

It's hard to say something more about it without having your complete context.

Try to determine why the hostname can not resolve. For example, inside the runner, try to connect to it manually with those credentials. Consider whether a VPN or other measures are required etc.

webbertakken avatar Feb 12 '24 17:02 webbertakken