bicep icon indicating copy to clipboard operation
bicep copied to clipboard

az bicep build failed using latest (v0.6.1 Latest) version of Bicep in azure devops pipeline. Issue with latest version of Bicep

Open sunilkhuttan opened this issue 4 years ago • 17 comments

It looks like there are some issue with latest version of Bicep. We are using "az bicep install" command in CICD pipeline and the lastest version of bicep failed with following error message

Installing Bicep CLI v0.6.1... Successfully installed Bicep CLI to "/apps/agent3/_work/_temp/.azclitask/bin/bicep". ERROR: Failure processing application bundle. Failed to determine location for extracting embedded files. DOTNET_BUNDLE_EXTRACT_BASE_DIR is not set, and a read-write cache directory couldn't be created.

I have try the old version and it works fine. Following work fine

az bicep install --version v0.5.6

Agent: Linux

Please fix the issue with new version

sunilkhuttan avatar May 04 '22 04:05 sunilkhuttan

I could not reproduce the issue with the ubuntu-latest build agent. Are you using self-hosted build machines?

shenglol avatar May 04 '22 05:05 shenglol

yes, My organization is using self hosted agents. I don't have further details about agents as I don't have access but it works fine with older bicep version and never have this issue before

sunilkhuttan avatar May 04 '22 05:05 sunilkhuttan

We are going to do some investigation on our side.

This will be very hard to debug if we don't have a clear sense of what the self-hosted agent looks like. Are you able to get us any more details?

As a workaround, you might be able to set the DOTNET_BUNDLE_EXTRACT_BASE_DIR yourself, but not sure what the value of this variable should be...

alex-frankel avatar May 04 '22 19:05 alex-frankel

Here are some more details about the env variable: https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file/overview#including-native-libraries

alex-frankel avatar May 04 '22 19:05 alex-frankel

@sunilkhuttan Also, it might help to narrow down why the behavior is different in the newest Bicep if you set the COREHOST_TRACEFILE=t.log or COREHOST_TRACE=1 variables (see https://github.com/dotnet/runtime/issues/3821#issuecomment-548216385), once with the new Bicep and once with the old, and compare them. Thanks!

StephenWeatherford avatar May 04 '22 20:05 StephenWeatherford

@StephenWeatherford, I try to set these variable 'COREHOST_TRACEFILE=t.log or COREHOST_TRACE=1' inside the bash script task, just before running the 'az bicep install' command and it does not produce any output in console. I am not sure if this is correct place to set these. image

As an alternative I am using older version of bicep using this command and it is working fine 'az bicep install --version v0.5.6'

sunilkhuttan avatar May 05 '22 01:05 sunilkhuttan

Following is the output

image

sunilkhuttan avatar May 05 '22 01:05 sunilkhuttan

Is t.log being written out to the file system when you try this out in your pipeline? Also, can you try this with the newest v0.6.11 release?

majastrz avatar May 11 '22 19:05 majastrz

Same issue with v0.6.11 as well image

sunilkhuttan avatar May 12 '22 04:05 sunilkhuttan

In order to solve this, we need some more debugging info. This does not appear to be a bicep-specific issue. We're happy to try to help debug this, but there may be other better forums for solving this one.

alex-frankel avatar Jun 01 '22 19:06 alex-frankel

This seems related: https://github.com/dotnet/runtime/issues/53346

alex-frankel avatar Jun 01 '22 19:06 alex-frankel

Will Reopen upon User Feedback/Response

stephaniezyen avatar Jun 24 '22 18:06 stephaniezyen

Hi, I am still having the same issue. az bicep build only work with following version "az bicep install --version v0.5.6"

It does not work with latest version Here is the debug output AzTaks-Debug-output.txt

Please provide any suggestion how can I fix it, thanks

sunilkhuttan avatar Aug 17 '22 23:08 sunilkhuttan

@sunilkhuttan does the problem go away if you run the following immediately before invoking the az bicep command?

export DOTNET_BUNDLE_EXTRACT_BASE_DIR="$HOME/.net"

e.g.

export DOTNET_BUNDLE_EXTRACT_BASE_DIR="$HOME/.net"
az bicep install

anthony-c-martin avatar Aug 18 '22 00:08 anthony-c-martin

Thanks @anthony-c-martin it worked fine after setting the environment variable - export DOTNET_BUNDLE_EXTRACT_BASE_DIR="$HOME/.net"

Just a question, It used to work fine before when installing bicep v0.5.6 or earlier but why it failed after this specific version?

sunilkhuttan avatar Aug 18 '22 23:08 sunilkhuttan

We're not sure, likely a change in dotnet although we haven't been able to track anything down. Since we don't see it we'd need more info to try to understand. But if this works for you, and since it doesn't seem to be bothering anyone else, there seems to be no reason to investigate further. Thanks!

StephenWeatherford avatar Aug 18 '22 23:08 StephenWeatherford

This happens today in my azure devops pipeline (totally unrelated to az bicep). This seems to be related to the user's permission. The app is trying to exract the bundle but the user doesn't have write permission, so setting the directory as sugggested works.

In azure devops pipeline this is what I do:

export DOTNET_BUNDLE_EXTRACT_BASE_DIR="$(System.ArtifactsDirectory)/.net"

rosdi avatar Dec 17 '22 03:12 rosdi