game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
857 stars 253 forks source link

Windows IL2CPP build failing to activate ULF License #569

Closed davidmfinol closed 1 year ago

davidmfinol commented 1 year ago

Bug description

Trying to build with Windows IL2CPP for Unity 2022.3.x. Getting this error during the activate step:

An error occurred while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 299
.[UnityConnect] An error occurred.
[UnityConnect::TryLogin] Request Aborted.
[Licensing::Module] Trying to connect to existing licensing client channel...
[Licensing::IpcConnector] Connection attempt to the License Client on channel: "LicenseClient-ContainerAdministrator" failed because channel doesn't exist; code: "0x80000002"
...
[Licensing::Module] Error: Access token is unavailable; failed to update
[Licensing::Module] Error: Failed to activate entitlement license
[Licensing::Module] Error: Access token is unavailable; failed to update
[Licensing::Module] Error: Failed to activate ULF license
Exiting without the bug reporter. Application will terminate with return code 1

Which ultimately ends with this error:

[Licensing::Module] Error: Access token is unavailable; failed to update
[Licensing::Client] Error: Code 500 while processing request (status: Unable to update licenses. Errors: No ULF license found.,Token not found in cache)
[Licensing::Client] Error: Code 500 while updating license in client (status: Unable to update licenses. Errors: No ULF license found.,Token not found in cache)
Built from '2022.3/staging' branch; Version is '2022.3.8f1 (b5eafc012955) revision 11922172'; Using compiler version '192829333'; Build Type 'Release'
OS: 'Windows 10  (10.0.17763) 64bit ServerDatacenter' Language: 'en' Physical Memory: 7167 MB
[Licensing::Client] Successfully resolved entitlements
[Licensing::Module] Error: License is not active (com.unity.editor.headless). HasEntitlements will fail.
...
[Licensing::Module] Error: Serial number unavailable for ULF return; aborting operation

How to reproduce

Using this workflow: https://github.com/finol-digital/Card-Game-Simulator/actions/runs/6098557061/workflow Specifically, this job:

  buildWithWindows:
    name: Build for ${{ matrix.targetPlatform }}
    runs-on: windows-2019
    needs: [buildWithLinux, buildWithMac]
    outputs:
      buildVersion: ${{ steps.build.outputs.buildVersion }}
    strategy:
      fail-fast: false
      matrix:
        targetPlatform:
          - StandaloneWindows
          - StandaloneWindows64
    timeout-minutes: 90
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Create LFS file list
        run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
      - name: Restore LFS cache
        uses: actions/cache@v3
        id: lfs-cache
        with:
          path: .git/lfs
          key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
      - name: Git LFS Pull
        run: |
          git lfs pull
          git add .
          git reset --hard
      - name: Cache Library
        uses: actions/cache@v3
        with:
          path: Library
          key: Library-buildWindows-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-buildWindows-${{ matrix.targetPlatform }}-
            Library-buildWindows-
      - name: Build Unity Project
        id: build
        uses: game-ci/unity-builder@main
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          buildMethod: Cgs.Editor.BuildCgs.BuildOptions

Expected behavior

Build should succeed.

Additional details

Discord thread: https://discord.com/channels/710946343828455455/1149754243562090516

davidmfinol commented 1 year ago

Adding a retry to my workflow lets me gets pass this error. Ideally retry would not be needed, but I'm ok to leave this is as is for now.

EDIT: For those that run into the same issue, this is my current workaround:

    name: Build for ${{ matrix.targetPlatform }}
    runs-on: windows-2019
    needs: [buildWithLinux, buildWithMac]
    outputs:
      buildVersion: ${{ steps.build-1.outputs.buildVersion }}
    strategy:
      fail-fast: false
      matrix:
        targetPlatform:
          - StandaloneWindows
          - StandaloneWindows64
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Create LFS file list
        run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
      - name: Restore LFS cache
        uses: actions/cache@v3
        id: lfs-cache
        with:
          path: .git/lfs
          key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
      - name: Git LFS Pull
        run: |
          git lfs pull
          git add .
          git reset --hard
      - name: Cache Library
        uses: actions/cache@v3
        with:
          path: Library
          key: Library-buildWindows-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-buildWindows-${{ matrix.targetPlatform }}-
            Library-buildWindows-
      - name: Build Unity Project
        id: build-0
        continue-on-error: true
        timeout-minutes: 45
        uses: game-ci/unity-builder@main
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }}
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          buildMethod: Cgs.Editor.BuildCgs.BuildOptions
      - name: Sleep for Retry
        if: ${{ steps.build-0.outcome == 'failure' }}
        run: Start-Sleep -s 120
      - name: Build Retry
        id: build-1
        continue-on-error: true
        timeout-minutes: 45
        if: steps.build-0.outcome == 'failure'
        uses: game-ci/unity-builder@main
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }}
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          buildMethod: Cgs.Editor.BuildCgs.BuildOptions
      - name: Sleep for Retry 2
        if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
        run: Start-Sleep -s 240
      - name: Build Retry 2
        id: build-2
        timeout-minutes: 45
        if: ${{ steps.build-0.outcome == 'failure' && steps.build-1.outcome == 'failure' }}
        uses: game-ci/unity-builder@main
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_PERSONAL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_PERSONAL }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_PERSONAL }}
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          buildMethod: Cgs.Editor.BuildCgs.BuildOptions
      - name: Upload Build
        uses: actions/upload-artifact@v3
        if: github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && contains(matrix.targetPlatform, 'StandaloneWindows'))
        with:
          name: cgs-${{ matrix.targetPlatform }}
          path: build/${{ matrix.targetPlatform }}
      - name: Zip Build
        uses: vimtor/action-zip@v1
        if: github.event.action == 'published' && matrix.targetPlatform != 'WSAPlayer'
        with:
          files: build/${{ matrix.targetPlatform }}/
          dest: build/cgs-${{ matrix.targetPlatform }}.zip
      - name: Upload Zip to GitHub Release
        uses: svenstaro/upload-release-action@v2
        if: github.event.action == 'published' && matrix.targetPlatform != 'WSAPlayer'
        with:
          repo_token: ${{ secrets.CGS_PAT }}
          asset_name: cgs-${{ matrix.targetPlatform }}.zip
          file: build/cgs-${{ matrix.targetPlatform }}.zip
          tag: ${{ github.ref }}
          overwrite: true
          body: ${{ github.event.release.body }}

Would definitely appreciate help if anyone has a better solution to this!

lukas-prodviz commented 1 year ago

+1 Same problem for me.

davidmfinol commented 1 year ago

Fixed with v4 of the images

DynoTan commented 11 months ago

This bug is still present with v4 of the image for us. It does happen from time to time and requires manual restart of the CD for us.

webbertakken commented 11 months ago

@DynoTan Can you confirm it is indeed the same bug (i.e. same output)?

Haelle commented 7 months ago

I had the same problem and it was because my password had special characters... I removed them and it worked !

kijz commented 6 months ago

had this issue today, restart of our local runner solved this. No clue how and why though

Schrodinger123 commented 3 months ago

Weird. Remove -serial solved this.