Skip to content

Unclear when customBuildTarget or buildTarget is now defined #741

@DenverGylee

Description

@DenverGylee

Bug description

There is mixed usage of customBuildTarget and/or buildTarget as of 30 Sept or 1 Oct sometime around midnight EST. It seemed to happen inexplicably as our yaml has been untouched for 1.5 months now.

How to reproduce
We use a mix of buildProfiles and regular builds for historical reasons so some of these variables are intentionally blank. The scenario where it seemed to break was when using a build profile.

Utilize an action similar to the following.

      - name: Unity Build
        id: build
        uses: game-ci/unity-builder@v4
        env:
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          #runAsHostUser: true
          enableGpu: true
          buildMethod: ${{ matrix.storeType.buildMethod }}
          customParameters: ${{ steps.vars.outputs.customParameters }}
          targetPlatform: ${{ matrix.targetPlatform }}
          projectPath: [REDACTED]
          buildProfile: ${{ matrix.storeType.buildProfile }}
          buildName: ${{ matrix.buildType.productName }}
          versioning: Tag
          allowDirtyBuild: true
          sshAgent: ${{ env.SSH_AUTH_SOCK }}
          sshPublicKeysDirectoryPath: /home/runner/.ssh_docker

Observe the following logs when it runs:

COMMAND LINE ARGUMENTS:
/opt/unity/Editor/Unity
-batchmode
-logfile
/dev/stdout
-quit
-customBuildName
[REDACTED]
-projectPath
/github/workspace/Unity/[REDACTED]
-customBuildTarget                    # Note that -buildTarget is not logged
StandaloneWindows64
-customBuildPath
/github/workspace/build/StandaloneWindows64/[REDACTED].exe
-customBuildProfile
Assets/Settings/Build Profiles/Steam.asset
-activeBuildProfile
Assets/Settings/Build Profiles/Steam.asset
-executeMethod
Game.Editor.BuildScript.BuildWithProfile
[TRUNCATED]

Expected behavior

I'm not entirely sure if it's specifying a build profile that causes the problem but on a version of our pipeline's that does not use the build profile, we get the following:

OMMAND LINE ARGUMENTS:
/opt/unity/Editor/Unity
-batchmode
-logfile
/dev/stdout
-quit
-customBuildName
[REDACTED]
-projectPath
/github/workspace/Unity/[REDACTED]
-buildTarget                          # -buildTarget specified
StandaloneWindows64
-customBuildTarget                    # -customBuildTarget specified
StandaloneWindows64
-customBuildPath
/github/workspace/build/StandaloneWindows64/[REDACTED].exe
-customBuildProfile

-executeMethod
Game.Editor.BuildScript.Build
[TRUNCATED]

Additional details

We use a very slightly modified version of the following script provided in the documentation for custom build methods: https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs

Our pipelines are failing at the following section of code.

if (!validatedOptions.TryGetValue("buildTarget", out string buildTarget)) {
    Console.WriteLine("Missing arguments -buildTarget and/or -customBuildTarget");
    EditorApplication.Exit(120);
}

We have modified our code as follows in the interim as we are unsure which direction the pipeline is moving:

if (!validatedOptions.TryGetValue("buildTarget", out string buildTarget)) {
    Console.WriteLine("Missing argument -buildTarget");
    if (!validatedOptions.TryGetValue("customBuildTarget", out buildTarget)) {
        Console.WriteLine("Missing argument -customBuildTarget. Exiting.");
        EditorApplication.Exit(120);
    } else {
        validatedOptions["buildTarget"] = buildTarget;
    }
} else {
    validatedOptions["customBuildTarget"] = buildTarget;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions