Cmake plugin failure in Azure Pipelines

Hi all,

I have a cmake-based part which fails to build in Azure Pipelines, even though it works locally with e.g. snapcraft --use-lxd.

This is the specific part:

Azure Pipelines reports the failure as:

2020-03-03T19:49:37.0073842Z Building llvm 
2020-03-03T19:49:37.5146968Z /tmp/snapcraft-5047/ 171: export: agent.jobstatus: bad variable name
2020-03-03T19:49:37.5188283Z Verify that the part is using the correct parameters and try again.
2020-03-03T19:49:37.5790364Z ##[error]Bash exited with code '2'.
2020-03-03T19:49:37.6531284Z ##[section]Finishing: Build ldc2 snap package

Full log here:
And in raw form:

Does anyone have any suggestion as to what is going wrong? It’s really not obvious to me what could be making the difference, given that it works when I invoke snapcraft on my local machine.

Thanks in advance for any advice or feedback,

   -- Joe

The problem is indicated by this snippet:

export: agent.jobstatus: bad variable name

It looks like snapcraft’s cmake plugin copies the active environment when calling cmake via creating a bash script with export calls followed by the call to cmake and executing that. Bash does not understand environment variables with a dot . as part of the name, like here with agent.jobstatus and therefore throws this error and exits with a non-zero return code.

@sergiusens, @cjp256 is it a good idea to add code in snapcraft/internal/ function _run() to filter environment variables that cannot be safely exported by bash?

1 Like

I assumed that was related to it but didn’t know how to interpret the error. Thanks for explaining.

Should I raise a Launchpad issue, or do you have enough to take it from here?

Thanks & best wishes,

-- Joe