unity-azure-pipelines-tasks icon indicating copy to clipboard operation
unity-azure-pipelines-tasks copied to clipboard

Activate Unity Task keeps opening wrong project

Open ikriz opened this issue 4 years ago • 7 comments

I have a project with a git repo root that looks like this:

- root
- - Directory1
- - Directory2
- - - Directory21
- - Directory3

When i pass the unityProjectPath to the activation task as the following unityProjectPath: 'Directory2/Directory21'

It opens some random project instead of the desired one, it seems to be the previously built project, but not always? I have a pipeline with only this task and it doesn't want to open the correct project. Possibly because my pipeline hasn't built succesfully yet.

I have the following output in the log: image

In the image above the working directory is C:\AzurePipelineAgent\_work\5\s\ but the task ends up opening the working directory of a different project C:\AzurePipelineAgent\_work\1\s\ also note the slashes are in the other direction?

ikriz avatar Sep 14 '21 15:09 ikriz

After modifiying the task to accomodate the -projectPath argument it opens the correct project with a nice log message from unity "Successfully changed project path to: C:\AzurePipelineAgent_work\5\s....etc" why is the default unityProjectPath variable not working?

ikriz avatar Sep 14 '21 17:09 ikriz

We also have this issue. Any idea on what might be happening? Thx

joaocc avatar May 18 '22 14:05 joaocc

Looking a bit more into this, got into several walls :) Some observations (v1.0.42) that may or may not help:

  • This only happens when some other project was built on the machine by a different pipeline. The first time a project builds on a machine, it never fails.
  • For instance, we use VMSS agents, and it's common to have C:\a\1\s as base folder for one of the projects and C:\a\2\s as base folder for the other.
  • This never seems to happen on the UnityBuildV3 task, only in UnityActivateLicenseV1
  • Looking at the logs from the executions, the "COMMAND LINE ARGUMENTS" from UnityActivateLicenseV1 seem that project path command line option is not being specified, which then seems to trigger something in Unity or the extension to start looking for another project;
  • Looking at the code from UnityActivateLicenseV1, and as @ikriz mentioned, the command line argument for the project path is there, before the log file path (https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/blob/bf14decbc5f1432a4ef67605a81acede4adbdc3d/Tasks/UnityActivateLicense/UnityActivateLicenseV1/unity-activate-license.ts#L50).

@ikriz, could it be that the extension code that is deployed with 3.1.12 didn't include the -projectPath option (even though it appears in Unity)? This could explain the occurrence, even though it doesn't explain the component that triggers a new path being searched.

Thx

joaocc avatar May 19 '22 22:05 joaocc

Adding some outputs to support my hypothesis, from real outputs.

UnityActivateLicense v1.0.42

2022-05-19T00:45:33.9183343Z ##[debug]check path : C:\a\_tasks\UnityActivateLicenseTask_13159b9a-b7ba-4977-922c-2b5cb63c90df\1.0.42\task.json
2022-05-19T00:45:33.9184863Z ##[debug]adding resource file: C:\a\_tasks\UnityActivateLicenseTask_13159b9a-b7ba-4977-922c-2b5cb63c90df\1.0.42\task.json
2022-05-19T00:45:33.9185540Z ##[debug]system.culture=en-US
2022-05-19T00:45:33.9203475Z ##[debug]username=***
2022-05-19T00:45:33.9205887Z ##[debug]password=***
2022-05-19T00:45:33.9207227Z ##[debug]serial=***
2022-05-19T00:45:33.9212437Z ##[debug]unityProjectPath=C:\a\1\s\THE-GOOD-PROJECT\
2022-05-19T00:45:33.9239641Z Determining Unity editor version for project at C:\a\1\s\THE-GOOD-PROJECT\
2022-05-19T00:45:33.9245996Z Success, Unity editor version found 2019.4.28f1, revision=1381962e9d08, alpha=false, beta=false
2022-05-19T00:45:33.9247506Z ##[debug]unityEditorsPathMode=unityHub
2022-05-19T00:45:33.9247994Z ##[debug]customUnityEditorsPath=undefined
2022-05-19T00:45:33.9249454Z ##[debug]Build.Repository.LocalPath=C:\a\1\s
2022-05-19T00:45:33.9256712Z ##[debug]set logsOutputPath=C:\a\1\s\Logs
2022-05-19T00:45:33.9259450Z ##[debug]Processed: ##vso[task.setvariable variable=logsOutputPath;isOutput=false;issecret=false;]C:\a\1\s\Logs
2022-05-19T00:45:33.9260828Z ##[debug]which 'C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe'
2022-05-19T00:45:33.9265492Z ##[debug]found: 'C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe'
2022-05-19T00:45:33.9267746Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -batchmode
2022-05-19T00:45:33.9269795Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -quit
2022-05-19T00:45:33.9270295Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -nographics
2022-05-19T00:45:33.9270803Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -username
2022-05-19T00:45:33.9271366Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: ***
2022-05-19T00:45:33.9271856Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -password
2022-05-19T00:45:33.9272380Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: ***
2022-05-19T00:45:33.9272894Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -serial 
2022-05-19T00:45:33.9273419Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: ***
2022-05-19T00:45:33.9273904Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: -logfile
2022-05-19T00:45:33.9274446Z ##[debug]C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe arg: C:\a\1\s\Logs\UnityActivationLog_2022-05-19-00-45-33.log
2022-05-19T00:45:33.9274998Z ##[debug]exec tool: C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe
2022-05-19T00:45:33.9275426Z ##[debug]arguments:
2022-05-19T00:45:33.9276161Z ##[debug]   -batchmode
2022-05-19T00:45:33.9276540Z ##[debug]   -quit
2022-05-19T00:45:33.9277102Z ##[debug]   -nographics
2022-05-19T00:45:33.9277455Z ##[debug]   -username
2022-05-19T00:45:33.9277821Z ##[debug]   ***
2022-05-19T00:45:33.9278167Z ##[debug]   -password
2022-05-19T00:45:33.9278546Z ##[debug]   ***
2022-05-19T00:45:33.9278920Z ##[debug]   -serial
2022-05-19T00:45:33.9279305Z ##[debug]   ***
2022-05-19T00:45:33.9279654Z ##[debug]   -logfile
2022-05-19T00:45:33.9280062Z ##[debug]   C:\a\1\s\Logs\UnityActivationLog_2022-05-19-00-45-33.log
2022-05-19T00:45:33.9285964Z [command]"C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe" -batchmode -quit -nographics -username *** -password *** -serial *** -logfile C:\a\1\s\Logs\UnityActivationLog_2022-05-19-00-45-33.log
(...)
2022-05-19T00:45:39.0015034Z  COMMAND LINE ARGUMENTS:
2022-05-19T00:45:39.0015281Z C:\Program Files\Unity\Hub\Editor\2019.4.28f1\Editor\Unity.exe
2022-05-19T00:45:39.0015527Z -batchmode
2022-05-19T00:45:39.0015783Z -quit
2022-05-19T00:45:39.0015983Z -nographics
2022-05-19T00:45:39.0016144Z -username
2022-05-19T00:45:39.0016475Z ***
2022-05-19T00:45:39.0016635Z -password
2022-05-19T00:45:39.0016787Z (hidden)
2022-05-19T00:45:39.0016931Z -serial
2022-05-19T00:45:39.0017083Z (hidden)
2022-05-19T00:45:39.0017236Z -logfile
2022-05-19T00:45:39.0017444Z C:\a\1\s\Logs\UnityActivationLog_2022-05-19-00-45-33.log
2022-05-19T00:45:39.0017815Z C:/a/2/s/THE-BAD-PROJECT/BASE-DIR
2022-05-19T00:45:39.0018038Z Using Asset Import Pipeline V2.
2022-05-19T00:45:39.0018248Z DisplayProgressbar: Unity Package Manager
2022-05-19T00:45:40.0152320Z Rebuilding Library because the metadata folder could not be found!
2022-05-19T00:45:42.4444331Z 

joaocc avatar May 19 '22 22:05 joaocc

Hum... Looking at the source, it seems that commit https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/commit/bf14decbc5f1432a4ef67605a81acede4adbdc3d hasn't been published as to AzureDevops. @FejZa, would it be possible to send a new build? Alternatively, is there any way to reference the extension by source? Thanks!

joaocc avatar May 19 '22 22:05 joaocc

v2.8.6 passes the right param :) Thx! I think this can be closed.

However, now the activation seems to hang (https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/issues/200).

joaocc avatar Jun 18 '22 11:06 joaocc

Facing the same issue, and looking for solution.

GunLengend avatar Sep 06 '22 04:09 GunLengend