Skip to content

GITHUB_ENV file intermittently corrupted on OSX #683

@anthony-c-martin

Description

@anthony-c-martin

Issue

Our GitHub CI is intermittently failing on macOS build machines when running dotnet build, with this cryptic error:

Error: Unable to process file command 'env' successfully.
Error: Value cannot be null. (Parameter 'name')

Example run here: https://github.com/Azure/bicep/runs/4073161120?check_suite_focus=true

Here's what this step looks like in the workflow definition: https://github.com/Azure/bicep/blob/d41b31884bdb1e8311e357711ebad9933d293aa2/.github/workflows/build.yml#L60-L61

Troubleshooting

To troubleshoot, I pushed a minimal build definition (OSX only, only run dotnet build) to my own fork of the repro and kicked off a number of builds, and added some logging for the contents of $GITHUB_ENV.

The step I'm using to troubleshoot is here: https://github.com/anthony-c-martin/bicep/blob/031f226ffea5c8e88af82f6bfa99bc6fa19d85f4/.github/workflows/build.yml#L45-L50

Good run

What I found was on a good run, the $GITHUB_ENV file contained a bunch of well-formatted nerdbank env variables - e.g.:

...
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitAssemblyInformationalVersion=0.4.1080+9f9a6b01ee
GitBuildVersion=0.4.1080.39583
GitBuildVersion=0.4.1080.39583
GitBuildVersion=0.4.1080.39583
...

Example run: https://github.com/anthony-c-martin/bicep/runs/4079159672?check_suite_focus=true

Bad run

On a bad run however, the $GITHUB_ENV file appears corrupted (note the missing key when setting an env var):

...
GitAssemblyInformationalVersion=0.4.1079+91a0cb236a
GitBuildVersion=0.4.1079.41105
GitBuildVersion=0.4.1079.41105
=0.4.1079+91a0cb236a
GitBuildVersion=0.4.1079.41105
GitAssemblyInformationalVersion=0.4.1079+91a0cb236a
...

Example run: https://github.com/anthony-c-martin/bicep/runs/4079159378?check_suite_focus=true

I suspect the lack of key when setting some env vars in the $GITHUB_ENV file is corresponding to the cryptic error coming back from GitHub (Error: Value cannot be null. (Parameter 'name'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions